126
Using semaphores to synchronize processes
nWe have 2 processes: P1 and P2 nStatement S1 in P1 needs to be performed before statement S2 in P2 nThen define a semaphore “synch”
nInitialize synch to 0
nProper synchronization is achieved by having in P1:
 S1;
 signal(synch);
n
nAnd having in P2:
 wait(synch);
 S2;