Exams Knowledge Hub

MCQs for Competitive Exams, School & College Exams

Module: | Arrays, Strings & Exception Handling

Q54: Consider the following statements regarding Thread Synchronization and Intrinsic Locks:

1. Every instance of an object in Java implicitly possesses a single, built-in intrinsic lock (monitor) that is utilized to enforce mutual exclusion during multithreading operations.
2. When a method is explicitly declared as static synchronized, the executing thread acquires the intrinsic lock of the specific object instance rather than the class-level blueprint.
3. A synchronized block provides higher performance flexibility than a synchronized method by allowing the developer to restrict the lock's scope to only the most critical lines of code.

Which of the above statements is/are correct?
A
Only 1 and 2
B
Only 1 and 3
C
Only 2 and 3
D
1, 2, and 3
✅ Correct Answer: B
🎯 Quick Answer:
The correct combination is 1 and 3. Statement 2 is incorrect because a static method belongs to the class itself, not to any specific object instance. Therefore, a static synchronized method acquires the universal Class-level lock (e.g., ClassName.class), completely ignoring individual instance locks.
Concept Definition: Synchronization is the architectural mechanism that strictly controls the access of multiple threads to a shared resource, preventing race conditions and ensuring absolute data consistency.
Structural Breakdown: A synchronized method locks the entire method execution (`public synchronized void update()`). A synchronized block locks only a specific segment (`synchronized(this) { // critical section }`). Historical/Related Context: Early Java applications heavily overused synchronized methods, causing severe performance degradation known as "thread contention," where threads spent 90% of their lifespan waiting in line.
Modern enterprise standards strongly advocate for synchronized blocks to ensure the lock is held for the absolute shortest millisecond duration possible.
Causal Reasoning: The separation of instance locks and class locks is critical for system architecture.
A thread executing a static synchronized method (holding the Class lock) will not block a different thread executing an instance-level synchronized method on a specific object, allowing parallel execution of distinct operational scopes without triggering a deadlock.