Presentation On:: Multi-Threading and Thread Synchronization
Presentation On:: Multi-Threading and Thread Synchronization
Presentation On:: Multi-Threading and Thread Synchronization
MULTI-THREADING AND
THREAD SYNCHRONIZATION
In this state, the local data members are allocated and
initialized.
Runnable :
The runnable state means that a thread is ready to run and
is waiting for the availability of the processor.
Terminated:-
Mutual Exclusion.
Inter- Thread Communication(Cooperation)
MUTUAL EXCLUSION
Syntax:
Synchronized return_type method_name()
{//block}
JAVA SYNCHRONIZED BLOCK
synchronized (object reference expression)
{
//code block
}
STATIC SYNCHRONIZATION
Syntax:
public final void notify()
3) notifyAll() method
Syntax:
public final void notifyAll()