• Post Reply Bookmark Topic Watch Topic
  • New Topic

sychronized method  RSS feed

 
kumarth ravi
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suppose when a thread is executing the synchroized method of a some shared resource,at that time the resource was locked by some other thread.

question:
what is the status of the thread, trying to get a resource?.whether it is continuously excute the synchroized method and without executing it,it may go the next statement or is the thread suspend.
 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The thread is "blocked waiting for monitor". In this state, it uses hardly any CPU, until it is able to get the lock on the monitor and continue execution.
 
kumarth ravi
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can I understand the block waiting is a suspend state.during the block waiting where will be the thread.(in case of calling wait() , then the thread will be in the waiting queue).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!