Interview Questions

Why suspend() and resume() methods are deprecated?

Java Interview Questions and Answers (part 4)


(Continued from previous question...)

25. Why suspend() and resume() methods are deprecated?

Suspend() method is deadlock prone. If the target thread holds a lock on object when it is suspended, no thread can lock this object until the target thread is resumed. If the thread that would resume the target thread attempts to lock this monitor prior to calling resume, it results in deadlock formation.
These deadlocks are generally called Frozen processes.

Suspend() method puts thread from running to waiting state. And thread can go from waiting to runnable state only when resume() method is called on thread. It is deprecated method.

Resume() method is only used with suspend() method that’s why it’s also deprecated method.

(Continued on next question...)

Other Interview Questions