What happens when a thread cannot acquire a lock on an object

If a thread attempts to execute a synchronized method or synchronized statement and isunable to acquire an object's lock, it enters the waiting state until the lock becomesavailable.

Showing Answers 1 - 1 of 1 Answers

It goes to blocked state as it can not continue.
but the cpu scheduler will wake him up once in a while .
every time he wakes up he will try to get the lock again until he can finally get it.
if he never get's the lock he will circle around  from blocked to ready until:

     a) some other thread interrupts him and he has a check for the interrupted flag
     b) you kill the whole program
     c) you turn off your computer

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions