how does preemptive kernel lead to race conditions? if a process is preempted i.e. isn't kicked out of its critical section . from my understanding race condition is when several processes try to access and manipulate resources concurrently right. I have trouble grasping the concept
A preemptive kernel can start and stop threads at any point. This means that threads that don't carefully coordinate their accesses through locks and critical sections end up in race conditions.
The other form of multithreading is cooperative multithreading, where threads can be stopped only at points where they explicitly offer to yield the processor. This helps prevent race conditions because threads are not interrupted at random unexpected points in their processing.
The downside of cooperative multithreading is that a thread written not to yield can hog the processor, and this is why most modern operating systems use preemptive multithreading rather than cooperative multithreading.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With