search
Log In
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
Welcome to GATE CSE Doubts, where you can ask questions and receive answers from other members of the community.
0 votes
6 views

Two processes, P1 and P2, need to access a critical section of code. Consider the following synchronization construct used by the processes:

/*  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 */

Here, wants1 and wants2 are shared variables,

My question is to argue on PROGRESS.

A case can be possible when P1 wants to enter in the critical section and set its interested variable to true and checks whether the interested variable of P2 is true. Here, (consider )P2's interest variable to be True hence P1 will get stuck in the while loop and waits for P2 become uninterested. Since, P2 still stuck in the while loop waiting for the P1’s interested variable to become false. Therefore, both the processes are waiting for each other and none of them is getting into the critical section..

DEFINITION of progress: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 section can participate in deciding which will enter its critical section next, AND THIS SELECTION CANNOT BE POSTPONED INDEFINITELY.

SO WHY EVERYWHERE IT IS WRITTEN PROGRESS IS THERE?

In the case when both wants1 and wants2 are true it will indefinitely be postponed then why progress is there?

in Operating System 5 points 6 views

Please log in or register to answer this question.

...