Correct Answer - Option 1 : At most one process can be in the critical section at any time
Given code is a N process synchronization solution (known as Lamport’s bakery algorithm)
This helps in getting the token. Each process which wants to enter into critical section, gets a token number (as in a restaurant) and wait for his turn.
c[i]=1 //announce that process Pi is ready to take it’s token number
t[i] = pmax (t ,…, t[n-1]) +1 //get token number
c[i]=0; // means process Pi has taken it’s token number
As more than one process can get same token value and then suppose P2 wants to enter the critical section. So, this line will be executed
while (t[j] != 0 && t[j]<=t[i]) ;
Now, j!=i, P2 scans for other processes and check if anyone of them have it’s token value less than or equal to it’s own token value. When P2 finds true then it starts looping at the condition. Similar for other processes. So, when P1 finds that all other processes have their token value as non zero and have value less than token of P1. It also waits. It becomes the situation of deadlock.
When deadlock in the system, progress will not be satisfied here.
Also, when a process reaches critical section, all other processes which started before it must have its token value as 0. This means that no two processes can be in critical section at the same time.