August 2018
Intermediate to advanced
380 pages
10h 2m
English
The simplest approach that can be used to synchronize the threads is called synchronization. It is implemented on the language level and is a standard construct in most programming languages.
The idea is as follows. Certain chunks of your programming code can be made guarded, which means they cannot be executed by the thread unless a certain condition is true. The condition in question is ownership of a so-called monitor. Therefore, a thread can own certain monitors. In a JVM setting, a monitor can be any object. So, on the JVM level, we can declare that a thread owns a monitor. Threads can take ownership and release the ownership of monitors at their own discretion. Another rule is that a monitor can only be held by one thread ...