Reputation: 1
As mentioned in Doug Lea's "Concurrent Programming in Java",
Every instance of class Object (and its subclasses) possesses a lock that is obtained on entry to a synchronized method and automatically released upon exit.
Does JVM implement lock mechanism completely in user space?
or
Does JVM rely on OS kernel space system calls to implement lock? Please provide reference to the code that implements lock mechanism.
Note: New to java multi-threading
Upvotes: 1
Views: 249
Reputation: 533710
Does JVM implement lock mechanism completely in user space?
Mostly, but not completely.
Does JVM rely on OS kernel space system calls to implement lock?
It tries to handle the lock in user space but if the lock cannot be obtained for a while, it drops back to an OS lock.
The reference implementation is in the OpenJDK, which you free to download.
New to java multi-threading
Getting buried/lost in the details might not be very helpful.
Upvotes: 2