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