GATE Computer Science (CS) 2022 Shift 1 Solved Paper

© examsiri.com
Question : 19 of 65
 
Marks: +1, -0
Consider the following threads, T1, T2, and T3 executing on a single processor, synchronized using three binary semaphore variables, S1, S2, and S3, operated upon using standard wait() and signal(). The threads can be context switched in any order and at any time.
T1
T2
T3
While(true) {
Wait(S3);
Print(“C”);
Signal (S2); }
While(true) {
Wait(S1);
Print(“B”);
Signal (S3); }
While(true) {
Wait(S2);
Print(“A”);
Signal (S1); }
 
Which initialization of the semaphores would print the sequence BCABCABCA….?
Go to Question: