Having an application that needs preemptive multitasking across threads might be lazy design. Can you think of a legitimate example when it isn't?

Reply to this note

Please Login to reply.

Discussion

It might be, it might not be. Either way the OS doesn’t incur additional cost (since it’s doing it across applications already) and it provides for a more robust platform. In what world is it reasonable to ship an OS in this decade that is a less robust platform just because?

(I’ve hit it a few times in many-threaded tests, eg the rust test runner, in the latest it makes it basically impossible to test https://github.com/lightningdevkit/rust-lightning/pull/3680 on windows).

Sounds like Rust test framework is broken.

I guess there might be cost for applications that want to control the scheduling on their own but it could've been opt-in.

Nope, it just spawns too many threads all at once so you don’t get predictability on a platform like windows with two threads on a slow CPU. Windows really just is not a real operating system, it’s a toy that somehow convinced people to use.

That's my point, Rust test binary should only spawn as many threads as there are CPUs.

I hate Windows as much as anyone else but pretending that your tests will run faster if you inject a bunch of context switches into them is just naive.