Given the following code, where id indicates a process number or ID), launch() indicates concurrent start of the processes passed on its parameters, and N is an integer representing the number of processes that will be launched (i.e. processes that will run on that system).
boolean blocked[N];
for(int i = 0; i < N;i++)
blocked[i] = false.
int turn = 0;
int other;
P(int id)
while(true)
blocked[id] = true;
while(turn != id)
if(id == 0 || id == 2)
other = 1;
else other = 0;
while(blocked[other])
{ turn = other;}
turn = id;
/* <<<< CRITICAL SECTION IS EXECUTED HERE>>>>>> */
blocked[id] = false;
a. Will the above code work (achieves mutual execution, good progress and deadlock-free) if launch is called as: launch(P(0), P(1)). Explain your answer in full details and in terms of each of mutual exclusion, good progress and deadlock-free.
b. Will the above code work (achieves mutual execution, good progress and deadlock-free) if launch is called as: launch(P(0), P(1), P(2)). Explain your answer in full details and in terms of each of mutual exclusion, good progress and deadlock-free.