title: Understanding semaphores
body: <p>I am reading about semaphores in "Operating System Concepts" (for those of you who know it), and I thought I understood semaphores completely until I read this passage:</p>
  
  <blockquote>
    <p>The critical aspect of semaphores is that they are executed
    atomically. We must guarantee that no two processes can execute wait
    and signal operations on the same semaphore at the same time.</p>
  </blockquote>
  
  <p>And also:</p>
  
  <blockquote>
    <p>If the hardware does not provide any special atomic instructions, we
    can employ any of the software solutions for the critical section
    problem, where critical sections consist of the wait and signal
    procedures.</p>
  </blockquote>
  
  <p>This passage refers to the face to <code>Signal</code> and <code>Wait</code> operations must be atomic. 
  I thought that the whole purpose of the semaphore was to let only one process in the critical section at any given time - if I have to use another algorithm (like the bakery algorithm), why do I also need the semaphore?</p>
  
  <p>I realize my question might be confusing. If it is, its only because the subject is still vague to me, so even asking a question is a little hard.</p>
  
  <p>Would love to read any clarifications...</p>