GATE Assistant

Past questions › Computer Science and Information Technology › GATE 2022

GATE 2022 · CS · MCQ · 1 mark · Operating System › Process Synchronization

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

  1. (A)

  2. (B)

  3. (C)

  4. (D)

Show answer

Official answer: C

Practise this question with exam-style marking

Discussion

No discussion yet.

Join the discussion