title: Can context switch take place while in a critical section?
body: <p>Recently I read an interesting blog comparing mutex and semaphore:<br>
  "<br>
  <a href="http://www.feabhas.com/blog/2009/09/mutex-vs-semaphores-%E2%80%93-part-1-semaphores/" rel="noreferrer">http://www.feabhas.com/blog/2009/09/mutex-vs-semaphores-%E2%80%93-part-1-semaphores/</a><br>
  "  </p>
  
  <p>Quote from it:<br>
  "<br>
  If a context switch happens while that task is in the critical region, and another task also calls on P(S), then that second task (and any subsequent tasks) will be blocked from entering the critical region by being put in a waiting state by the operating system. At a later point the first task is rescheduled and calls V(S) to indicate it has left the critical region. The second task will now be allowed access to the critical region.
  "  </p>
  
  <p>If this is true for semaphore, is it also true for mutex? I don't think it's true as if a block of code is locked, it should be "atomic" that cannot be context switched out or interrupted. Am I right?</p>