Question: Q4. (Inter Processing Communications) With regard to proposal 4 (Petersons Solution), if there are two processes Process 0 and Process 1 and Context Switching happens
Q4. (Inter Processing Communications)
With regard to proposal 4 (Petersons Solution), if there are two processes Process 0 and Process 1 and Context Switching happens like the following sequence, please complete the execution flow and answer the question whether both these processes can enter the critical section.
1 #define FALSE 0
2 #define TRUE 1
3
4 int turn;
5 int interested[2] = {0,0};
6
7 void enter_region(int process)
8 {
9 int other;
10
11 other = 1-process;
12 interested[process] = TRUE;
13 turn = process;
14 while (turn == process && interested[other] == TRUE)
15 ; /* busy waiting */
16 }
17
18 void leave_region(int process)
19 {
20 interested[process] = FALSE;
21 }
Given sequence:

Process 0 Process 1 Process 1 enter region: 7-12 Context Switching enter region: 7-12 Context Switching enter region: 13-14 Context Switching
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
