Similar questions 1 more →
Synchronization & Concurrency

Answer & solution
Official answer: C
T2 waits on S1 and prints B, then signals S3. T1 waits on S3 and prints C, then signals S2. T3 waits on S2 and prints A, then signals S1. Initialize only S1 to 1, with S2=S3=0, to force B→C→A repeatedly. That is C. This assumes ordinary successful semaphore operations and eventual scheduling of enabled threads.
Track the unique token: (1,0,0) enables only T2. Its wait consumes S1 and its signal creates the S3 token; then T1 creates S2; then T3 restores S1. Context switching can delay progress, but cannot permit a different letter while its semaphore is zero.