GATE 2022 Computer Science and Information Technology question: Consider the following threads, T 1, T 2, and T 3 executing on a single processor,…
Consider the following threads, , , and executing on a single processor, synchronized using three binary semaphore variables, , , and , operated upon using standard wait() and signal(). The threads can be context switched in any order and at any time.
while(true){ |
while(true){ |
while(true){ |
wait(S3); |
wait(S1); |
wait(S2); |
print("C"); |
print("B"); |
print("A"); |
signal(S2); } |
signal(S3); } |
signal(S1); } |
Which initialization of the semaphores would print the sequence BCABCABCA….?
Show answer
Official answer: C