Advanced Rust
Q89 / 100

What is the difference between tokio::spawn and std::thread::spawn in Rust?

Correct! Well done.

Incorrect.

The correct answer is B) tokio::spawn creates a lightweight async task run on the tokio runtime; thread::spawn creates an OS thread with its own stack

B

Correct Answer

tokio::spawn creates a lightweight async task run on the tokio runtime; thread::spawn creates an OS thread with its own stack

Explanation

tokio::spawn creates Tasks — lightweight async work units. thread::spawn creates OS threads with ~8MB stack. You can run millions of Tasks; thousands of threads struggle.

Progress
89/100