531 views
1 votes
1 votes

Two concurrent processes P1 and P2 want to use 2 resources J1 and J2 in a Mutually Exclusive way. Assume that initially J1 and J2 are both free. The programs executed by these two processes are as below :

Program for P1: Program for P2:
S1:while J1 is busy do no-operation;
S2:set J1<- busy;
S3:while J2 is busy do no-operation;
S4:set J2 <- busy;
S5:use J1 and J2 ;
S6:set J1 <- free;
S7:set J2 <- free;
Q1 while J1 is busy do no-operation;
Q2 set J1<- busy;
Q3 while J2 is busy do no-operation;
Q4 set J2<- busy;
Q5 use J1 and J2;
Q6 set J2<- free;
Q7 set J1<- free;

What can be said about the processes P1 and P2?

  1. Mutual Exclusion is guaranteed, deadlock would not occur
  2. Mutual Exclusion is not guaranteed, deadlock would not occur
  3. Mutual Exclusion is guaranteed, deadlock might occur
  4. Mutual Exclusion is not guaranteed, deadlock might occur

Please log in or register to answer this question.

Answer:

Related questions

1 votes
1 votes
2 answers
2