2,051 views
3 3 votes
In process synchronozation , when we can say progress is satisfied and when progress not satisfied?

Explain with example.

(Donot give just definition, need clear difference when progress is satisfied and when not satisfied)

1 Answer

Best answer
8 8 votes
section1. Entry_try(cs);

section2. < CS >


section3. Leave_cs(cs);

section4. // some code which have nothing to do with critical section

Definition :

  • If no process is executing in its critical section then,
  • If there exist some processes that wish to enter their critical sections,
  • then only those processes that are not executing in their section 4. can participate in the decision of which will enter its critical section next.
  • This decision cannot be postponed indefinitely.

Indirectly, if no process is in the critical section, the algorithm must decide quickly who enters next if someone wants.

If above conditions are satisfied then we call progress is satisfied. Otherwise not.

Explanation :

If some process is inside the critical section, assume some progress is going on.

( now we assume CS is free  )

  1. If no process wants to enter the critical section, means nothing left to do. (do not consider progress here)
  2. Assume a process is executing section4. That means this process is executing something which has no relation at all to the critical section. This process must not involve in the decision of who will enter in the critical section next.
  3. Only those process who wish to enter into the critical section and executing in section1 can participate in the decision of who will enter next in CS.
  4. "the algorithm must decide quickly who enters next if someone wants.",
    1. Sometimes two or more processes while trying to enter into CS and executing some entry_try code , they get stuck in deciding who will enter first (or next). And it happens indefinitely, causing deadlock and NO PROGRESS at all.

 We will take two examples of two process solutions

  1. Peterson's solution. (progress satisfied)
  2. Strict alteration solution using turn variable. (progress not satisfied)

First Peterson's solution. (progress satisfied)

Assume p and q are the two processes. interested_flag[2] = {0,0}

  1. If only p tries to enter into CS, p will definitely enter CS. why because, interested_flag[q] = FALSE
  2. If only q tries to enter into CS, q will definitely enter CS. why because, interested_flag[p] = FALSE
  3. If both p and q try simultaneously, one of them will definitely enter into section2 (CS) in finite time. The process who executed assigned turn first will enter CS first.

 Next, Strict alteration. (progress not satisfied)

  1. Assume turn value becomes zero after few alteration. and now P0 no more wants to enter into CS. (P0 exits)
  2. Then if P1 tries to enter into CS and arrive at section1. it never breaks the while loop and forever loops in there. So P0's decision not to execute in section1 or section2 is affecting P1's entry indefinitely.
• edited by
Position:
Show:

Related questions

4 4 votes
0 0 answers
1.7k
1.7k views
atulcse asked Jan 19, 2022
1,699 views
Consider the following proposed solution to Dining Philosopher’s problem to avoid deadlock. The binary semaphore lock is initialized to 1.Which of the following is correc...
7 7 votes
2 2 answers
5.7k
5.7k views
target2017 asked Nov 23, 2016
5,684 views
Consider the following program: Const int n= 10 int Count= 0 Void A( ) { int i; for(i= 1 to n) Count= Count + 1; } Main ( ) { Par begin A( ); A( ); A( ); A( ); Par end }5...
2 2 votes
1 1 answer
745
745 views
junaid ahmad asked Jan 20, 2018
745 views
States which of the statements are true and please give some reference :S1:Bounded waiting and progress implies no starvationS2:Bounded waiting doesn't imply starvation f...
4 4 votes
1 1 answer
274
274 views
GO Classes asked Jul 25
274 views
Which of the following statements are correct?Mutual exclusion ensures that if one process is executing in its critical section, no other process can execute in its criti...