Requirements of Critical Section

I have some fundamental doubts regarding the conditions which need to be followed for a correct synchronisation solution i.e. about mutual exclusion , progress and bounded wait. I m asking these queries.

Q 1 . Can bounded wait condition be invalidated for 2 process solution ? If yes ,plz explain how ?

Q 2.  Is it true that the entry section is the decisive factor for the fact whether the solution satisfies mutual exclusion and progress condition and remainder section for the fact whether the bounded wait condition is satisfied or not? If yes or no whatever the case may be , plz explain why??

Plz help @ranita Ma'am , @pritam Sir....Thank you..

Sumit Verma @sumitkgp
14 Oct 2016 01:09 pm

1. Bounded waiting means that it shuold be defined after how much time(or processes) one process will excute in it's critical section. For a 2 process solution:
do {
    turn1 = True;
    while (turn2 == True);
    // critical section //
    turn1 = False;
    // Remainder section //
Note that the instruction "turn1 = True"  or "turn2 = True" are atomic, that is it is a single machine instruction which cannot be interrupted.But say because of priority, CPU interrupts this and every time executes P1 then there is no bounded time for another process P2 to be executed.

2. Definitely Yes . Consider this peterson's solution :
 do {
 flag[i] = true;
  turn = j;
   while (flag[j] && turn == j);
  // critical section //
  flag[i] = false;
 //  remainder section //
  } while (true);
In the entry section, process i first raises a flag indicating a desire to enter the critical section.
Then turn is set to j to allow the other process to enter their critical section if process j so desires.
The while loop is a busy loop ( notice the semicolon at the end ), which makes process i wait as long
as process j has the turn and wants to enter the critical section.Process i lowers the flag[ i ] in the exit section, allowing process j to continue if it has been waiting.