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);
 
Q. 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 used by processes P1 and P2 are used for accessing 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 this case, both processes P1 and P2 are using while loops to check the values of shared boolean variables S1 and S2. It can be observed that both processes are checking for different conditions in their while loops.

- Process P1 is checking for (S1 == S2), which means it will enter the critical section only when S1 and S2 have the same value.
- Process P2 is checking for (S1 != S2), which means it will enter the critical section only when S1 and S2 have different values.

Since the values of S1 and S2 are randomly assigned initially, there is a possibility that the conditions in the while loops are not satisfied simultaneously for both processes. Therefore, mutual exclusion is achieved as only one process can enter the 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 this case, both processes P1 and P2 are using while loops to repeatedly check the conditions for entering the critical section.

- Process P1 is checking for (S1 == S2) and will keep looping until the condition is satisfied.
- Process P2 is checking for (S1 != S2) and will keep looping until the condition is satisfied.

It can be observed that if a process wants to enter its critical section, it will eventually be able to do so because the conditions in the while loops are based on the values of shared boolean variables S1 and S2, which can change over time.

Conclusion:
Based on the analysis, it can be concluded that the given methods achieve mutual exclusion but not progress. Mutual exclusion is achieved because only one process can enter the critical section at a time. However, progress is not achieved because a process may have to wait indefinitely in its while loop until the condition is satisfied.
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);Q.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);Q.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);Q.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);Q.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);Q.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);Q.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);Q.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);Q.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);Q.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);Q.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