1,280 views
0 votes
0 votes
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. Plz address to these doubts but give a valid reason prior to conlusion.So ,

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? Also plz support your answer with proper reason..

2 Answers

Best answer
6 votes
6 votes

Deadlock and Bounded waiting are independent of each other . What bounded waiting says => That if a process expresses its desire to enter critical section then there exists a bound on the number of processes that can enter CS, after this request has been made .

Take the function B = Count of the processes that can enter CS after any process has made a request .

1). One of the GATE questions,

/*  P1   */
while (true) {
    wants1 = true;
    while (wants2 == true);
    /* Critical Section */
    wants1 = false;
}
/* Remainder section */

/*  P2   */
while (true) {
    wants2 = true;
    while (wants1 == true);
    /* Critical Section */
    wants2=false;
}
/* Remainder section */

Clearly, Deadlock can happen in this case but is the BW satisfied ?

Yes, it is as when P1 and P2 are both in a while loop busy waiting , then both are desiring to go into the CS. So, suppose P1 wants to enter CS , then think of the case that how many times P2 has bypassed P1 before P1 is allowed to enter critical section. If you agree, that the number of times a process P1 may be bypassed is 0 ,i.e, B = 0 then yes, bounded waiting holds .

But, any other condition was not given in this question like priority of any process is higher or anything else, we can think like this. But, if there is a synchronization protocol, like CPU always executes P2, and never provides P1 the CPU to execute.

Well thats how suppose Synchronization mechanism is programmed for P1 and P2, that Mutex is satisfied and Progress is satisfied, but CPU always makes P2 run. 

Now, if P1 has a desire to enter CS, then how many times has P2 bypassed it. It can be finite but not bounded, as there is a difference between Finite and bounded . So, it all depends on how the synchronization protocol is designed .


2). Yes, thats how the progress works. Progress means finite decisive time to enter critical section, that some day process will enter CS which is done in the entery section only.

For bounded waiting, How many processes in remainder section are allowed to enter CS after any other process has made a request . Also, all other parts of code which are not CS, i.e, except CS are called remainder sections, so how many of those processes are allowed to enter CS or bypass the process which has made a request to enter CS .

selected by
0 votes
0 votes
Bounded waiting:->>There exists a bound, or limit, on the number of times other processes are allowed to enter their critical sections after a process has made request to enter its critical section and before that request is granted.

Part1:->>
Yes; Bounded Waiting Can be violated with 2 processes.
#Psudocode

/* i is this process; j is the other process */

while (true)

{

         while (turn != i); /* spin until it’s my turn */      

           <<< critical section >>>

            turn = j;

             <<< code outside critical section >>>

}

Here Only Process i Get acess to CS repetadely but process j never gets CS (though it may get CPU time).

So No bounded Waiting for Process j.

Part2:->> partialy Yes

Mutual exclusion is implemented @entry section to restrict malfunction of cuncurrent processes at the critical section where shared resources are used.

But wheather ME satisfy or not we cant take decision by looking only @Entry section it depends on code of Exit section also.

I M commenting for Progress and  Bounded waiting.
edited by

Related questions

0 votes
0 votes
1 answer
4
ajayraho asked Oct 23, 2022
876 views
What is the significance of infinite loop that is written in every example of process synchronisation? What would happen if there wasn't any infinite loop?