Professional Documents
Culture Documents
Pete Solutionn
Pete Solutionn
solution
1
Why Peterson solution ?
2
Algorithm for Peterson solution
# define N 2
# define TRUE 1
# define FALSE 0
int interested[N] = FALSE;
int turn;
For entry section
Entry section(process)
{ For two process
1. int other; synchronization
2. other = 1-process; //other=partner
3. interested[process]=TRUE;
4. turn = process
5. while(interested[other] = TRUE &&
turn = process )
}
If condition 5 satisfy, it enter CS