Question

The following multi-threaded program uses 3 concurrent threads (T0, T1, and T2). The threads are synchronized...

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()


Homework Answers

Answer #1

HERE IS THE SOLUTION..PLEASE GIVE AN UPVOTE

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions