Saturday, 24 December 2016

Synchronization In Java

Ex :
            synchronized(threadobj)
            {        
                        threadobj.start();
            }

            * A method wants to allow only one thread at a time to execute,
then that should be declared as synchronized method or that should be called within synchronized block.
            * When a thread enters into synchronized method, it is locked and monitored.
Meanwhile, other threads are waiting for sometime until it terminates.
            * It is used to achieve InterThread Communication.
 (Output of one thread is used as input by another thread.)

            * It is used to avoid DeadLock prone.

No comments:

Post a Comment

Featured post

Development Of JAVA Program