I came across following problem:
Consider following code:
π ππππ(π·) { ππππ[π] = ππππ; π ππππ(ππππ[π]); /* π²πππππππ πππππππ */ ππππ[π] = πππππ; /*πππππππππ πππππππ */ }
Let flag is declared as Boolean
flag[2]
andPi
denote one process whilePj
denotes other process andi=1-j
. Both processes execute concurrently, then does the progress requirement of the solution to the critical section problem satisfied in the above case?
Doubt
The solution says that both processes Pi and Pj can simultaneously execute flag[i]=true
and then both may busy wait on while(flag[j])
, thus leading to deadlock and hence progress requirement of the solution to the critical section problem is not satisfied.
I know the normal / day to day meaning of "progress" gives us feeling that if there can be deadlock, then there may not be the progress. But Galvin's book defines "Progress" as this:
If no process is executing in its critical section and some processes wish to enter their critical sections, then only those processes that are not executing in their remainder sections can participate in deciding which will enter its critical section next, and this selection cannot be postponed indefinitely.
So I am guessing whether progress has anything to do with deadlock. And whether the code indeed satisfies progress requirement of critical section problem.