Module: | Arrays, Strings & Exception Handling
Q51: Consider the following statements regarding the Thread Lifecycle in Java:
1. A thread enters the RUNNABLE state immediately after it is instantiated using the 'new' keyword, even before the start() method is formally invoked.
2. A thread transitions into the BLOCKED state strictly when it attempts to enter a synchronized block or method but the required intrinsic monitor lock is currently held by another thread.
3. The TIMED_WAITING state is triggered when a thread executes methods with a specified timeout parameter, such as Thread.sleep(1000) or wait(2000).
Which of the above statements is/are correct?
2. A thread transitions into the BLOCKED state strictly when it attempts to enter a synchronized block or method but the required intrinsic monitor lock is currently held by another thread.
3. The TIMED_WAITING state is triggered when a thread executes methods with a specified timeout parameter, such as Thread.sleep(1000) or wait(2000).
Which of the above statements is/are correct?
✅ Correct Answer: C
🎯 Quick Answer:
The correct combination is 2 and 3. Statement 1 is incorrect because a newly instantiated thread exists strictly in the NEW state. It does not transition into the RUNNABLE state until the developer explicitly invokes the start() method.Structural Breakdown: The Thread.State enum defines six absolute states: NEW (created but not started), RUNNABLE (executing or waiting for CPU time), BLOCKED (waiting for a lock), WAITING (indefinitely waiting for another thread's signal), TIMED_WAITING (waiting for a specific duration), and TERMINATED (execution completed). Historical/Related Context: Understanding these states is critical for diagnosing enterprise application freezes.
Using a "Thread Dump" diagnostic tool allows a developer to see the exact state of all threads.
If 500 threads are stuck in the BLOCKED state, the developer instantly knows there is a massive synchronization bottleneck in the code.
Causal Reasoning: A thread in the RUNNABLE state is not guaranteed to be actively calculating data on the CPU.
The OS scheduler frequently pauses RUNNABLE threads (time slicing) to allow other RUNNABLE threads to utilize the CPU core, swapping them seamlessly without altering their JVM state classification.