#define FALSE 0
#define TRUE 1
#define N 2
int turn;
int interested[N];
void enter_region(int process) {
int other;
other = 1 - process;
interested[process] == TRUE;
turn = process; // set flag
while (turn == process && interested[other] == TRUE)
}
void leave_region(int process) { interested[process] = FALSE; }
wouldn't it be a violation of the third criteria of critical regions if a clock interrupt ocurred after process 0 executed the statement
interested[process]==TRUE;
because process one would wait in the while loop in his whole processor time being blocked from processor 0 .
Perterson's solution or algoruthm is a famous concurrent programming algorithm for mutual exclusion that allows two processes to share a single-use resource without conflict, using only shared memory for communication.
the criteria i'm referring to is : No process running outside its critical region may block any process.