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...
Mutual Exclusion: A way of making sure that if one process is using a shared modifiable data, the other processes will be excluded from doing the same thing. while one process executes the shared variable, all other processes desiring to do so at the same time moment should be kept waiting; when that process has finished executing the shared variable, one of the processes waiting; while that process has finished executing the shared variable, one of the processes waiting to do so should be allowed to proceed. In this fashion, each process executing the shared data (variables) excludes all others from doing so simultaneously. This is called Mutual Exclusion.
Progress Requirement: If no process is executing in its critical section and there exist some processes that wish to enter their critical section, then the selection of the processes that will enter the critical section next cannot be postponed indefinitely.
Solution: 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...
Explanation:

The given methods show two processes, P1 and P2, trying to access their critical sections. Let's analyze the properties achieved by these methods:

Mutual Exclusion:
Mutual exclusion means that only one process can access the critical section at a time. In the given methods, both P1 and P2 are using a while loop to check the value of shared variables S1 and S2 respectively. The while loop continues until the condition is satisfied.

In the case of P1, the condition is "S1 == S2", which means P1 will keep looping until S1 and S2 have the same value. Once the condition is satisfied, P1 enters its critical section and updates the value of S1 to be equal to S2. This ensures that when P2 tries to access its critical section, the condition "S1 != S2" will be false, and it will keep looping until P1 completes its critical section.

Similarly, in the case of P2, the condition is "S1 != S2", which means P2 will keep looping until S1 and S2 have different values. Once the condition is satisfied, P2 enters its critical section and updates the value of S2 to be the opposite of S1. This ensures that when P1 tries to access its critical section, the condition "S1 == S2" will be false, and it will keep looping until P2 completes its critical section.

Therefore, both processes P1 and P2 achieve mutual exclusion as only one process can access its critical section at a time.

Progress:
Progress means that if a process wants to enter its critical section, it should eventually be able to do so. In the given methods, both P1 and P2 use a while loop to check the condition before entering their critical sections.

However, there is a possibility that both processes are stuck in an infinite loop waiting for the condition to be satisfied. This can happen if the initial values of S1 and S2 are the same, resulting in an indefinite wait.

For example, if S1 = true and S2 = true initially, both P1 and P2 will keep looping as the conditions "S1 == S2" and "S1 != S2" will always be true. In this case, neither process will be able to enter its critical section, and progress is not achieved.

Therefore, the given methods achieve mutual exclusion but not progress.

Answer:
The correct answer is option 'A' - Mutual exclusion but not progress.
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