Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  Consider the methods used by processes P1 and... Start Learning for Free
Consider the methods used by processes P1 and P2 for accessing their critical sections whenever needed, as given below. The initial values of shared boolean variables S1 and S2 are randomly assigned.
Method Used by P1
while (S1 == S2) ;
Critica1 Section
S1 = S2;
Method Used by P2
while (S1 != S2) ;
Critica1 Section
S2 = not (S1);
Which one of the following statements describes the properties achieved?
  • a)
    Mutual exclusion but not progress
  • b)
    Progress but not mutual exclusion
  • c)
    Neither mutual exclusion nor progress
  • d)
    Both mutual exclusion and progress
Correct answer is option 'A'. Can you explain this answer?
Verified Answer
Consider the methods used by processes P1 and P2 for accessing their c...
It can be easily observed that the Mutual Exclusion requirement is satisfied by the above solution, P1 can enter critical section only if S1 is not equal to S2, and P2 can enter critical section only if S1 is equal to S2. But here Progress Requirement is not satisfied. Suppose when s1=1 and s2=0 and process p1 is not interested to enter into critical section but p2 want to enter critical section. P2 is not able to enter critical section in this as only when p1 finishes execution, then only p2 can enter (then only s1 = s2 condition be satisfied). Progress will not be satisfied when any process which is not interested to enter into the critical section will not allow other interested process to enter into the critical section.
View all questions of this test
Most Upvoted Answer
Consider the methods used by processes P1 and P2 for accessing their c...
P1 Method:
The P1 method uses a while loop to continuously check if S1 is equal to S2. If they are equal, it enters the critical section and then assigns the value of S2 to S1.

P2 Method:
The P2 method also uses a while loop, but it checks if S1 is not equal to S2. If they are not equal, it enters the critical section and then assigns the negation of S1 to S2.

Analysis:
Let's analyze the properties achieved by these methods.

Mutual Exclusion:
Mutual exclusion means that at any given time, only one process can be in its critical section. In this case, both processes use a while loop to continuously check the values of S1 and S2. If both processes simultaneously enter their while loop, it means that S1 and S2 are equal for both processes. As a result, neither process will be able to enter its critical section, ensuring mutual exclusion.

Progress:
Progress means that if a process is not in its critical section, and there are no other processes in their critical sections, then any process that wants to enter its critical section should be able to do so. In this case, if P1 is not in its critical section, it will keep checking the values of S1 and S2. Similarly, if P2 is not in its critical section, it will also keep checking the values of S1 and S2. Therefore, if either process wants to enter its critical section, it will eventually be able to do so, ensuring progress.

Conclusion:
Based on the analysis above, the methods used by processes P1 and P2 achieve mutual exclusion but not progress. This is because the while loops in both methods create a deadlock situation where neither process can enter its critical section if the values of S1 and S2 are initially equal. In such a case, both processes will keep checking the values indefinitely, resulting in a lack of progress.
Free Test
Community Answer
Consider the methods used by processes P1 and P2 for accessing their c...
It can be easily observed that the Mutual Exclusion requirement is satisfied by the above solution, P1 can enter critical section only if S1 is not equal to S2, and P2 can enter critical section only if S1 is equal to S2. But here Progress Requirement is not satisfied. Suppose when s1=1 and s2=0 and process p1 is not interested to enter into critical section but p2 want to enter critical section. P2 is not able to enter critical section in this as only when p1 finishes execution, then only p2 can enter (then only s1 = s2 condition be satisfied). Progress will not be satisfied when any process which is not interested to enter into the critical section will not allow other interested process to enter into the critical section.
Explore Courses for Computer Science Engineering (CSE) exam

Similar Computer Science Engineering (CSE) Doubts

Top Courses for Computer Science Engineering (CSE)

Consider the methods used by processes P1 and P2 for accessing their critical sections whenever needed, as given below. The initial values of shared boolean variables S1 and S2 are randomly assigned.Method Used by P1while (S1 == S2) ;Critica1 SectionS1 = S2;Method Used by P2while (S1 != S2) ;Critica1 SectionS2 = not (S1);Which one of the following statements describes the properties achieved?a)Mutual exclusion but not progressb)Progress but not mutual exclusionc)Neither mutual exclusion nor progressd)Both mutual exclusion and progressCorrect answer is option 'A'. Can you explain this answer?
Question Description
Consider the methods used by processes P1 and P2 for accessing their critical sections whenever needed, as given below. The initial values of shared boolean variables S1 and S2 are randomly assigned.Method Used by P1while (S1 == S2) ;Critica1 SectionS1 = S2;Method Used by P2while (S1 != S2) ;Critica1 SectionS2 = not (S1);Which one of the following statements describes the properties achieved?a)Mutual exclusion but not progressb)Progress but not mutual exclusionc)Neither mutual exclusion nor progressd)Both mutual exclusion and progressCorrect answer is option 'A'. Can you explain this answer? for Computer Science Engineering (CSE) 2024 is part of Computer Science Engineering (CSE) preparation. The Question and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus. Information about Consider the methods used by processes P1 and P2 for accessing their critical sections whenever needed, as given below. The initial values of shared boolean variables S1 and S2 are randomly assigned.Method Used by P1while (S1 == S2) ;Critica1 SectionS1 = S2;Method Used by P2while (S1 != S2) ;Critica1 SectionS2 = not (S1);Which one of the following statements describes the properties achieved?a)Mutual exclusion but not progressb)Progress but not mutual exclusionc)Neither mutual exclusion nor progressd)Both mutual exclusion and progressCorrect answer is option 'A'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2024 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for Consider the methods used by processes P1 and P2 for accessing their critical sections whenever needed, as given below. The initial values of shared boolean variables S1 and S2 are randomly assigned.Method Used by P1while (S1 == S2) ;Critica1 SectionS1 = S2;Method Used by P2while (S1 != S2) ;Critica1 SectionS2 = not (S1);Which one of the following statements describes the properties achieved?a)Mutual exclusion but not progressb)Progress but not mutual exclusionc)Neither mutual exclusion nor progressd)Both mutual exclusion and progressCorrect answer is option 'A'. Can you explain this answer?.
Solutions for Consider the methods used by processes P1 and P2 for accessing their critical sections whenever needed, as given below. The initial values of shared boolean variables S1 and S2 are randomly assigned.Method Used by P1while (S1 == S2) ;Critica1 SectionS1 = S2;Method Used by P2while (S1 != S2) ;Critica1 SectionS2 = not (S1);Which one of the following statements describes the properties achieved?a)Mutual exclusion but not progressb)Progress but not mutual exclusionc)Neither mutual exclusion nor progressd)Both mutual exclusion and progressCorrect answer is option 'A'. Can you explain this answer? in English & in Hindi are available as part of our courses for Computer Science Engineering (CSE). Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free.
Here you can find the meaning of Consider the methods used by processes P1 and P2 for accessing their critical sections whenever needed, as given below. The initial values of shared boolean variables S1 and S2 are randomly assigned.Method Used by P1while (S1 == S2) ;Critica1 SectionS1 = S2;Method Used by P2while (S1 != S2) ;Critica1 SectionS2 = not (S1);Which one of the following statements describes the properties achieved?a)Mutual exclusion but not progressb)Progress but not mutual exclusionc)Neither mutual exclusion nor progressd)Both mutual exclusion and progressCorrect answer is option 'A'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of Consider the methods used by processes P1 and P2 for accessing their critical sections whenever needed, as given below. The initial values of shared boolean variables S1 and S2 are randomly assigned.Method Used by P1while (S1 == S2) ;Critica1 SectionS1 = S2;Method Used by P2while (S1 != S2) ;Critica1 SectionS2 = not (S1);Which one of the following statements describes the properties achieved?a)Mutual exclusion but not progressb)Progress but not mutual exclusionc)Neither mutual exclusion nor progressd)Both mutual exclusion and progressCorrect answer is option 'A'. Can you explain this answer?, a detailed solution for Consider the methods used by processes P1 and P2 for accessing their critical sections whenever needed, as given below. The initial values of shared boolean variables S1 and S2 are randomly assigned.Method Used by P1while (S1 == S2) ;Critica1 SectionS1 = S2;Method Used by P2while (S1 != S2) ;Critica1 SectionS2 = not (S1);Which one of the following statements describes the properties achieved?a)Mutual exclusion but not progressb)Progress but not mutual exclusionc)Neither mutual exclusion nor progressd)Both mutual exclusion and progressCorrect answer is option 'A'. Can you explain this answer? has been provided alongside types of Consider the methods used by processes P1 and P2 for accessing their critical sections whenever needed, as given below. The initial values of shared boolean variables S1 and S2 are randomly assigned.Method Used by P1while (S1 == S2) ;Critica1 SectionS1 = S2;Method Used by P2while (S1 != S2) ;Critica1 SectionS2 = not (S1);Which one of the following statements describes the properties achieved?a)Mutual exclusion but not progressb)Progress but not mutual exclusionc)Neither mutual exclusion nor progressd)Both mutual exclusion and progressCorrect answer is option 'A'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice Consider the methods used by processes P1 and P2 for accessing their critical sections whenever needed, as given below. The initial values of shared boolean variables S1 and S2 are randomly assigned.Method Used by P1while (S1 == S2) ;Critica1 SectionS1 = S2;Method Used by P2while (S1 != S2) ;Critica1 SectionS2 = not (S1);Which one of the following statements describes the properties achieved?a)Mutual exclusion but not progressb)Progress but not mutual exclusionc)Neither mutual exclusion nor progressd)Both mutual exclusion and progressCorrect answer is option 'A'. Can you explain this answer? tests, examples and also practice Computer Science Engineering (CSE) tests.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev