6 - What Is Inter Thread Communication In Java? | Multithreading | Almighty Java

Publié le: 25 octobre 2018
sur la chaîne: Almighty Java
1,836
13

#InterThreadCommunication #ThreadCommunication #Multithreading
=============================
What is Inter thread communication?

Two or more threads exchange information or communicating each other.

It is all about making synchronized threads communicate with each other.

ITC concept is one of the specialized form of inter process communication of operating system.

One thread paused for it critical section/region and another thread is allowed in same critical section/region to be executed.

It helps to avoid thread pooling (is usually implemented by loop to check some condition repeatedly. Once condition is true appropriate action is taken. This waste CPU time).

How many ways to implement ITC?

Using wait, notify or notifyAll method – Both methods are non-static, final and from object class.

Where ever use wait method, it releases a lock and allow other threads.

If thread is in wait state then only notify method can invoke that thread after invoked, thread come back in runnable state.

Methods can only be invoked from synchronized code. And must be in try catch block because it throws IOException.


Sur cette page du site, vous pouvez voir la vidéo en ligne 6 - What Is Inter Thread Communication In Java? | Multithreading | Almighty Java durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Almighty Java 25 octobre 2018, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 1,836 fois et il a aimé 13 téléspectateurs. Bon visionnage!