Thread Synchronization
https://docs.oracle.com/javase/tutorial/essential/concurrency/sync.html
-
- Mutex Semaphore (aka Mutex) controls only one thread at a time executing on the shared resource by lock & unlock.
- Counting Semaphore (aka Semaphore – Java7) controls the number of threads executing on the shared resource by acquire & release.
- Monitor controls only one thread at a time, and can execute in the monitor (shared object) by wait & notify/notifyAll.