When a thread tries to enter into a synchronized method and if the lock is already taken by another thread , then the thread trying to get the lock will be blocked on the object's lock.
and the thread goes into a kind of pool for that particular object and sits there until the lock is released and the thread CAN again become runnable/running thread when the lock released on the object. but if there are many thread waiting for the objects lock then we cant say which thread will get a chance to occupy the lock on the object
and the thread goes into a kind of pool for that particular object and sits there until the lock is released and the thread CAN again become runnable/running thread when the lock released on the object. but if there are many thread waiting for the objects lock then we cant say which thread will get a chance to occupy the lock on the object
No comments:
Post a Comment