Concurrency and Synchronization questions

Q19

GATE CS 2022 CSConcurrency and SynchronizationMCQ1 mark−1/3 if wrong
Consider the following threads, T1T_1, T2T_2, and T3T_3 executing on a single processor, synchronized using three binary semaphore variables, S1S_1, S2S_2, and S3S_3, operated upon using standard wait() and signal(). The threads can be context switched in any order and at any time.
T1
while(true){
  wait(S3);
  print(“C”);
  signal(S2);
}

T2
while(true){
  wait(S1);
  print(“B”);
  signal(S3);
}

T3
while(true){
  wait(S2);
  print(“A”);
  signal(S1);
}
Which initialization of the semaphores would print the sequence BCABCABCA....?
Show answer without attempting

Answer: C

0/10 correct0 marks

Related topics in Operating Systems