Recently I read an interesting blog comparing mutex and semaphore:
"
http://www.feabhas.com/blog/2009/09/mutex-vs-semaphores-%E2%80%93-part-1-semaphores/
"
Quote from it:
"
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.
"
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?