Question
Q-What are the disadvantages of Petersons solution for critical-section problem? Code below shows the solution to two process mutual exclusion problem. Process P i do
Q-What are the disadvantages of Petersons solution for critical-section problem? Code below shows the solution to two process mutual exclusion problem.
Process Pi
do {
flag[i] = true;
turn = j;
while (flag[j] && turn == j);
critical section
flag[i] = false;
remainder section
} while (true);
Process Pj
do {
flag[j] = true;
turn = i;
while (flag[i] && turn == i);
critical section
flag[j] = false;
remainder section
} while (true);
Answer True or False to the following questions:
(i) This algorithm satisfies the mutual exclusion, progress and bounded waiting condition.
ii) This algorithm has a flaw as the variable turn can be modified by both processes at the same time.
iii) This algorithm may cause deadlock if both processes set their flags to True at the same time.
iv) This algorithm satisfies only the mutual exclusion and progress condition
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started