title: Implementing an N process barrier using semaphores
body: <p>I'm currently training for an OS exam with previous iterations and I came across this:</p>
  <blockquote>
  <p>Implement a &quot;N Process Barrier&quot;, that
  is, making sure that each process out
  of a group of them waits, at some
  point in its respective execution, for
  the other processes to reach their
  given point.</p>
  <p>You have the following
  ops available:</p>
  <p><code>init(sem,value), wait(sem) and signal(sem)</code></p>
  </blockquote>
  <p>N is an arbitrary number. I can make it so that it works for a given number of processes, but not for any number.</p>
  <p>Any ideas? It's OK to reply with the pseudo-code, this is not an assignment, just personal study.</p>