Subtle errors are easily made, and can lead to big problems. E.g. suppose a particular critical region needs access to data protected by two different semaphores S1 and S2. One process might code:
| Process 0 | Process 1 |
|---|---|
P(S1); P(S2);
critical region;
V(S1); V(S2);
|
P(S2); P(S1);
critical region;
V(S2); V(S1);
|
which could lead to deadlock if the two processes both did their first P() before either did its second.