The Gateway to Computer Science Excellence
+2 votes
126 views

If two processes R1 and R2 accessing the shared variables A and B protected by two binary semaphores SA and SB respectively, both initialized to 1.
R and Q denote the usual semaphore operators, where R decrements the semaphore value, and Q increments the semaphore value. The pseudo code of R1 and R2 is as follows:

R1:

while(True){
    do{
        k1:____;
        k2:____;
        a = a+1;
        b = b-1;
        R(SA);
        R(SB);
    }
}

R2:

while(True){ 
    do{
        k3:____;
        k4:____;
        a = a+1;
        b = b-1; 
        R(SB);
        R(SA);
    }
}

The options are :

  • R(SB ),R(SA ),R(SA ),R(SB )
  • R(SB ),R(SA ),R(SB ),R(SA )
  • R(SA ),R(SB ),R(SA ),R(SB )
  • R(SA ),R(SB ),R(SB ),R(SA )
  • None of the above
in Operating System by (35 points) | 126 views
0
1st and 3rd option results in deadlock

2nd and 4th can lead to Starvation
0
There is no signal operation in the above transaction .. How semaphore value turn=1 to execute another process.. ?
0

 R decrements the semaphore value, and Q increments the semaphore value

0
there is no Q operation in the given transactions ?

Correct  me if i am wrong
0
oh yeah how did i missed that :o

there is something wrong with the question or answer is none of the above

Please log in or register to answer this question.

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,314 answers
198,358 comments
105,085 users