Question: c) The buffer can be in three states. Draw the buffer states. [2 Marks] a) Peterson's Algorithm: Given a code for Process O and Process
![states. [2 Marks] a) Peterson's Algorithm: Given a code for Process O](https://s3.amazonaws.com/si.experts.images/answers/2024/09/66de90155c311_90866de9014ec3bc.jpg)
c) The buffer can be in three states. Draw the buffer states. [2 Marks] a) Peterson's Algorithm: Given a code for Process O and Process 1 in Table 4. Fill in flags and turn variables if Process 1 initiates the request to enter the critical section. [3 Marks] Table 4 Process o Process 1 do ! do i flag[0- TRUE; turn = 1; while (flag[1] && turn= : * do nothing / critical section fag(01 - FALSE; remainder section while (TRUE): flag|11 - TRUE; turn = 0; while (flag[0] && turn=0) ; /* do nothing * critical section flag11 - FALSE; remainder section while (TRUE); Table 5 flag01 Magill Turn Events e FALSE TRUE 0 4 P request to enter CS P, enters CS P requests to enter CS Table 4 Process do! fagio - TRUE turn-1: while (fagl && turn-1 I do nothing critical section flag-FALSE remainder section while (TRUEX Process 1 do! flagll- TRUE turn 0; while (flag Aktur * do nothing critical section flagll - FALSE remainder section while (TRUEX Table 5 tim flag flaglll Turn Events FALSE TRUE P request to enter CS Pencs Prequests to emer CS P.RS Penters CS Perles RS PER RS Pexecutes RS Proquests to emers Justify your answer by showing: Mutual exclusion is preserved [1 marks) The Progress requirement is satisfied [1 marks) The bounded-waiting requirement is met [1 marks)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
