220k views
0 votes
Does peterson's solution to the mutual-exclusion problem shown in fig. 2-24 work when process scheduling is preemptive

User Galfisher
by
9.2k points

1 Answer

7 votes
Yes. Not only does Peterson's Solution work with preemptive scheduling, but it was designed for that very case. In fact, when scheduling is non-preemptive, there is a possibility it might fail. For example, in a case where 'turn' is initially 0, but process 1 runs first, it will loop perpetually, and never release the CPU.
User Mamnarock
by
8.6k points
Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.