Skip to main content

run

Function run 

Source
pub fn run(
    command: Command,
    config: DetConfig,
    print_summary: bool,
    print_summary_to_json_file: &Option<PathBuf>,
) -> Result<ExitStatus, Error>
Expand description

Run the given command as deterministically as possible.

§Stack size

On the ptrace backend this and the other launch functions (run*, record*, replay*, HermitData::record) run the whole ptrace session on a tracer thread of their own, with an 8 MiB stack (the main thread’s usual size, the default ulimit -s), so the calling thread needs no particular stack: a recording through the library returned on a 95 KiB caller thread. One tracer thread serves each calling thread for the caller’s lifetime, so an operation kept at a HermitCleanupUnconfirmed checkpoint is resumed from the same caller. That thread stays, idle, until the caller exits, and a tracing subscriber set for the calling thread only does not see the session’s events (a global subscriber does). The session itself, in a debug build, needs about 2 MiB, mostly Detcore’s syscall handler, which at opt-level 0 keeps every syscall arm’s temporaries in one frame (https://github.com/rrnewton/hermit/issues/4389).

The other backends still run on the calling thread, which then needs that stack itself: launching from a thread spawned with 4 MiB (std::thread::Builder::stack_size) is recommended for them, and Rust’s default 2 MiB for a spawned thread or a test is not enough in a debug build with the third-party-backends feature. Optimised builds need much less: in the validate profile a 512 KiB thread was enough.