1,308 views
3 votes
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 votes
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

Related questions

7 votes
7 votes
2 answers
2
2 votes
2 votes
1 answer
3
junaid ahmad asked Jan 20, 2018
475 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...
0 votes
0 votes
1 answer
4
N3314nch41 asked Sep 10, 2023
360 views
How to approach synchronization (specifically semaphore) question, there size are really intimidating and i’m unable to decode the code written? What to do??