Synchronization
From the concept of multithreading, joining threads is termed synchronization. Usually, the main thread needs to wait until the processing threads have finished with their execution. Also, multiple threads should be safeguarded not to update a shared resource called mutual exclusion, which is achieved with the usage of the keyword called synchronized. Statements and methods referred to with the synchronized keyword can be accessed and updated by only one process at a time. One thread has to wait for the other to complete the processing of the synchronized block and communicate with the wait() and notifyall() methods to let other threads know they need to wait and allow this other thread to be executed first.
The following ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access