互斥是加锁的目的,这个就不说了。
dead lock是常见问题,如果两个线程同用两个或以上的锁,线程A取得锁1,等待锁2,
而线程B取得锁2,等待锁1,则会形成死锁。
starvation则是一种活锁问题,著名的例子有哲学家就餐问题:http://zh.wikipedia.org/wiki/哲学家就餐问题
Unfortunately, these are not the only problems that lock-based code is faced with. In time-sliced systems, locks can lead to a very unhealthy coupling between synchronization and scheduling. If a thread is preempted, and – at the time when it is preempted – owns a lock, all other threads dependent on that lock are effectively blocked until the preempted thread finishes its operation and releases the lock. This remains true even when the preempted thread is of a low priority, and the blocked threads are of a higher priority. The result, in these cases, is known as priority inversion. Another phenomenon that may occur – perhaps even in combination with priority inversion – is that a large number of threads will queue up, waiting for the thread to release the desired lock. This phenomenon is known as convoy formation.