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
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.
To make sure you are not studying endlessly, EduRev has designed Computer Science Engineering (CSE) study material, with Structured Courses, Videos, & Test Series. Plus get personalized analysis, doubt solving and improvement plans to achieve a great score in Computer Science Engineering (CSE).