The extract below is from the rust documentation (https://doc.rust-lang.org/book/ch16-01-threads.html#creating-a-new-thread-with-spawn). Why does it say "allowing a different thread to run". Aren't threads running concurrently ,i.e at the same time?
From the docs:
The calls to thread::sleep force a thread to stop its execution for a short duration, allowing a different thread to run. The threads will probably take turns, but that isn’t guaranteed: it depends on how your operating system schedules the threads. In this run, the main thread printed first, even though the print statement from the spawned thread appears first in the code. And even though we told the spawned thread to print until i is 9, it only got to 5 before the main thread shut down.
If you run this code and only see output from the main thread, or don’t see any overlap, try increasing the numbers in the ranges to create more opportunities for the operating system to switch between the threads.
its an informational question