3 ms·
OS threads are preemptive and their scheduling is beyond your control, which introduces potential data races. Green threads allow for cooperative scheduling, wh
by 10000truths 6y ago
OS threads are preemptive and their scheduling is beyond your control, which introduces potential data races. Green threads allow for cooperative scheduling, which is much harder to mess up.
- sanxiyn 6y agoThis is moot. Rust prevents data races.
- brundolf 6y agoIt doesn't prevent race conditions, which may be what the GP meant to say
- Yoric 6y agoIn my experience, past some level of code complexity, you get the pretty much same kind of races with cooperative scheduling as with preemptive scheduling – with the added risk that you did not expect a race with preemptive scheduling. Still a fan of async programming, but that's a false benefit in my books :)