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

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.
answered
User Mamnarock
by
8.6k points
Welcome to Qamnty — a place to ask, share, and grow together. Join our community and get real answers from real people.