Skip to content

Beta · Data may be lost.Your data may be reset or lost.

GateBrew
← GATE CSE 2022
Questions

Q9

MCQ1 mark, −0.33Operating systems

Consider the following threads, T1,T2,\text{T}_{1}, \text{T}_{2}, and T3\text{T}_{3} executing on a single processor, synchronized using three binary semaphore variables, S1,S2,\text{S}_{1}, \text{S}_{2}, and S3,\text{S}_{3}, operated upon using standard wait()\textsf{wait}() and signal().\textsf{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…?\text{BCABCABCA} \dots ?

Sign in to save attempts.

Solutions and discussion are hidden while you attempt this question. They open once you check or show the answer.