Machine-translated by Google. Questions are authored in English.
Top

Discussion

Which of these statements about BLOCKED compared with WAITING is correct?

  • A.A thread waiting to enter a synchronized block and one inside wait() are both BLOCKED.
  • B.A thread waiting to enter a synchronized block is WAITING, while one inside wait() is BLOCKED.
  • C.Both cases report RUNNABLE, since the thread has already been started.
  • D.A thread waiting to enter a synchronized block is BLOCKED, while one inside wait() is WAITING.

Answer: D

BLOCKED means waiting for a monitor lock in order to enter or re-enter a synchronized region. WAITING means the thread called something like wait() or join() with no timeout and is waiting for another thread to act. The distinction is what makes a thread dump readable.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.