Computer Science · Operating Systems
Consider three 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. Thread T1: while(true) { wait(S3); print("C"); signal(S2); } Thread T2: while(true) { wait(S1); print("B"); signal(S3); } Thread T3: while(true) { wait(S2); print("A"); signal(S1); } Which initialization of the semaphores would print the sequence BCABCABCA...?
- 1S1 = 0; S2 = 1; S3 = 1
- 2S1 = 1; S2 = 0; S3 = 0✓
- 3S1 = 1; S2 = 1; S3 = 0
- 4S1 = 1; S2 = 1; S3 = 1
Correct answer
S1 = 1; S2 = 0; S3 = 0
Download Single Question PDF
Save this question and verified answer as a clean study sheet with live clickable link.
Share with Friends & Study Groups
Challenge your peer aspirants on WhatsApp or Telegram to solve this question!
Preparing for Computer Science?
Practice full-length mock tests with real exam timers, instant score analysis, and all-India ranking.
Want more practice questions on Operating Systems?
Solve complete topic-wise tests with detailed solutions on GkGet.
Related Practice Questions
Recommended practice questions in Computer Science · Operating Systems