edited by
1,652 views
1 votes
1 votes

Consider the methods used by processes $P_1$ and $P_2$ for accessing their critical sections.  The initial values of shared Boolean variables $S_1$ and $S_2$ are randomly assigned,

$P_1$

while ($S_1$==$S_2$);

critical section

$S_1$=$S_2$;

$P_2$

while ($S_1$==S2);

critical section

$S_1$=$S_2$;

Which one of the following statements describes the properties achieved?

  1. Mutual exclusion but not progress
  2. Progress but not mutual exclusion
  3. Neither mutual exclusion nor progress
  4. Both mutual exclusion and progress
edited by

1 Answer

0 votes
0 votes

OPTION B: PROGRESS BUT NOT MUTUAL EXECUTION

WHY NOT ME:

SUPPOSE S1=S2=5

1.NOW LET P1 EXECUTED THE WHILE LOOP WHICH IS TRUE  AND PREEMPTED

2.THEN P2 COMES AND EXECUTES THE WHILE LOOP WHICH IS TRUE SO ACCESSING THE CRITICAL SECTION 

3. THEN P1 COMES AND ENTERS CRITICAL SECTION

BOTH PROCESS IN CRITICAL SECTION  THEREFORE NOT ME

BUT PROGRESS IS THERE:

SUPPOSE  P1 IS NOT INTRESTED IN CRITICAL SECTION SO IT WILL NOT EXECUTE THE CODE..AND P2 WILL EXECUTE ITS CODE ...SINCE THERE IS NO DEPENDENCY ON P1(S1,S2 VALUES WILL NOT DEPENDS UP ON P1'S EXECUTION) SO P2 CAN EXECUTE ANY NUMBER OF TIMES IT WANT

Answer:

Related questions

0 votes
0 votes
2 answers
1
shivajikobardan asked Jul 22, 2023
793 views
Sorry if this is a stupid question. But it really intrigued me. Same resources at different algorithms are telling different ways to test these stuffs.Here's an algorith...
0 votes
0 votes
0 answers
2
Raj Singh 1 asked Jan 1, 2019
1,429 views
Many problems on gateoverflow asks whether the given code satisfies progress requirement of the solution for the critical section problem. Most of these code contain mult...