Re: help on split binary semaphores


R. Clayton (rclayton@monmouth.edu)
(no date)


  In the 27 July lecture notes on split binary semaphores, I see three
  semaphores initialized (mutex(1), waiting_readers(0), and
  waiting_writers(0)). There are methods signal() and wait() for both the
  waiting readers and waiting writers and lock() and unlock() for the mutex.

  So, mutex is a simple mutual exclusion semaphore, yes? Then waiting-readers
  and waiting_writers should be binary semaphores? How am I supposed to deal
  with signal() and wait()? Should I just use the Java notify() and wait()
  methods here?

They're all binary semaphores; I used lock-unlock and signal-wait to indicate
the different roles they're playing: lock-unlock for mutual exclusion and
signal-wait for conditional synchronization.

You can implement signal() and wait() using either the instance mutex or wait
set; the mutex is easier because it has simpler release behavior than does the
wait set.

Ultimately, you'll have to rely on wait() and notify() and friends (unless you
implement your own synchronization algorithm); the question is how much code do
you want to put in front of them to hide them.



This archive was generated by hypermail 2.0b3 on Tue Aug 20 2002 - 12:45:05 EDT