Thread
Thread
As both threads are waiting for each other to release this condition is called
deadlock.
9) What is a monitor?
The monitor is a body of code that can be executed by only one thread at a time.
If any other thread attempts to get access at the same time, it will be suspended
until the current thread releases the Monitor.
14) How can you pause the execution of a Thread for a certain amount of time?
sleep () method is used to pause the execution of the thread for a certain amount
of time. However, this will not stop the processing of thread for a specific time.
However, when the thread awake from sleep its state changes to runnable and based
on thread scheduling, it will be executed.