Discussion
Consider the following two-process synchronization solution.
Process 0
---------
Entry: loop while (turn == 1);
(critical section)
Exit: turn = 1;
Process 1
----------
Entry: loop while (turn == 0);
(critical section)
Exit: turn = 0;The shared variable turn is initialized to zero. Which one of the following is TRUE?
Answer: C
The solution violates the progress requirement.
This is strict alternation. Mutual exclusion holds: turn is either 0 or 1, and each process can enter only when turn has its own value, so both can never be inside together. Bounded waiting also holds, because after a process leaves it hands the turn to the other, so neither can enter twice while the other waits.
Progress fails. Suppose Process 0 runs its critical section and sets turn = 1, and Process 1 has no wish to enter. If Process 0 now wants to enter again, it must wait for Process 1 to take its turn, which may never happen. A process outside its critical section is blocking another from entering, which is exactly what the progress requirement forbids.
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development