How to check for progress in given question ?

How to check for progress in given question ?

1Comment
Prashant Sharma @prashantsharma
11 Jun 2017 10:28 pm

What do we mean by checking for progress  ?

Let P1, P2, P3 .....Pn be processes sharing critical section. The progress requirement will state that the decision about the processes which want to enter the critical section must take into account only the process that want to enter the critical section and not those that do not what to enter the critical section.

What does this all means ?

Lets consider an example:

consider two processes , P1 & P2 sharing critical section and the critical section problem is resolved as follows:

P1

   Non-CS
while(turn !=0);
    CS
turn = 1
    Non-CS

 

P2

    Non-Cs
while(turn != 1);
     CS
turn = 0
    Non-CS

 

Lets , say initially turn = 0 and process P1 wants to enter the critical section (CS) means it has executed codes residing in Non-CS area

Now, process P1 will enter CS ( since while loop condition is false)

Now after execting CS, P1 sets turn = 1

Lets assume, P2 is still not finished will execution of its Non-CS section or it could still be in ready ques and not scheduled to the CPU.

Meanwhile, suppose Pagain gets scheduled to the CPU and again it want to enter the CS but it can not as turn =1 thus while loop for P1 will keep running.

So, here although P2 does not wants to enter the CS it is taken into consideration while designing the solution.

Therefore, progress condition is not met here.

Although, Mutual Execution condition is met here.(chek this for yourself).

Final Point: Yes, it can get hard to identify all the condition which are met or not when you are just beginning. It'll get easier if you practice more question (only practice quality question, start with previous GATE questions).

Pick a question, and dive deep into it. If stuck post it here. Will try to help!