Question:

How does thread synchronization occurs inside a monitor ? What levels of synchronization can you apply ?

Answer:

The JVM uses locks in conjunction with monitors. A monitor is basically a guardian that watches over a sequence of synchronized code and ensuring that only one thread at a time executes a synchronized piece of code. Each monitor is associated with an object reference. The thread is not allowed to execute the code until it obtains the lock.


Keywords:

© 2017 QuizBucket.org