Only do question 3
Posted: Thu Jun 02, 2022 8:02 am
Only do question 3
do { } flag = true; turn = i; while (flag[j] && turn Critical section flag = FALSE; Remainder section = j);
Question 3. [Points 4] Three processes P1, P2, and P3 are sharing a resource R1 in a mutually exclusive manner. Using compare_and_swap instruction, show code for P1, P2, and P3 that shows the entry section and exit section (similar to the code shown in Question 1). Using this code, show a scenario if all three processes want to enter their critical sections.
do { } flag = true; turn = i; while (flag[j] && turn Critical section flag = FALSE; Remainder section = j);
Question 3. [Points 4] Three processes P1, P2, and P3 are sharing a resource R1 in a mutually exclusive manner. Using compare_and_swap instruction, show code for P1, P2, and P3 that shows the entry section and exit section (similar to the code shown in Question 1). Using this code, show a scenario if all three processes want to enter their critical sections.