The following multi-threaded program uses 3 concurrent threads (T0, T1, and T2). The threads are synchronized by 3 semaphores (S0, S1, S2). What is the maximum number of times '0' will be printed by thread T0?
// Global to all threads Semaphore S0(1), S1(0), S2(0)
Thread T0
While (true)
S0.wait()
print( '0' )
S1.signal()
S2.signal()
endWhile
Thread T1
S1.wait()
S0.signal()
Thread T2
S2.wait()
S0.signal()
HERE IS THE SOLUTION..PLEASE GIVE AN UPVOTE
Get Answers For Free
Most questions answered within 1 hours.