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….?

1
S1 = 1; S2 = 1; S3 = 1
2
S1 = 1; S2 = 1; S3​ = 0
3
S1 = 1; S2 = 0; S3​ = 0
4
S1 = 0; S2 = 1; S3​ = 1
5
Question Not Attempted

Sponsored

hivanix.in

Visit

This quiz is brought to you by hivanix.in

🌐 Web App Development

Quick Navigation