You are on page 1of 1

CoSc – 451

Chapter 8
Exercise 1.
Synchronization

Name_____________________________________________________ sec_______________

1. Show skeletal code using P and V operators to handle synchronization from the concurrent
processes described below.
A.
P2
P4
P1

P3

P1 must finish before P2 and P3 start


P2 and P3 will run concurrently
P4 can not start until both P2 and P3 are complete.

B. Assume: Three processes A, B, and C


Question: Draw process diagram & show skeletal code using P and V operators and semaphore.
steps: 1. Start from A
2. B must wait till A is done
3. C must wait till A is done.
4. Go to 1. But, A must wait until both B and C are done.

C. Use ONLY two semaphores to synchronize question in B.


TIP: Use “counting semaphore”.

You might also like