You could read about it in original documentation (
http://docs.oracle.com/javase/tutorial/essential/concurrency/sync.html[
^]), but it would be better to understand the background first. This can help more, please try to understand it thoroughly:
http://en.wikipedia.org/wiki/Mutual_exclusion[
^].
The big essential feature of Java (and other systems') mutual exclusion is that the synchronization is done by some object. It means that if two different threads execute some fragments of code "guarded" by different objects, no synchronization happens, none of the thread won't wait for another one. The rationale on this is easy to explain on the example of such a simple
shared resource as some set of objects in memory. Suppose you have some object set you need to keep in integrity. If you access it by some other thread, it can be broken, because one thread modifies "half of it", but another thread works in assumption that the integrity is preserved, which could lead to unpredictable results. But if some two different shared sets of objects are unrelated, it's apparent that one thread can safely modify one while any other thread is working at another one. So, each set of shared objects can be guarded by a separate synchronization object. If you analyze performance considerations, you could see that it involves less coupling and is much better for throughput. (Common threading wisdom says: "best synchronization is no synchronization".)
Due to synchronization mechanism, when a thread starts to execute a synchronized fragment of code while some other thread is already executing it, this second thread will be put to a wait queue (the queue is always needed, because more than one thread might be waiting) and put to sleep, not wasting any CPU time, until it is "waken up". This waiting thread is said to be put in a "wait state": it is switched off from and not scheduled back to execution until it is waken up. One of the waking event is releasing the lock by the thread executing the guarded fragment of code, which happens when this thread goes out of the synchronized context.
—SA