Thread - Shared Variable


shared state in threads.

Threads communicate primarily by sharing access to fields and the objects reference fields refer to. This form of communication is extremely efficient, but makes two kinds of errors possible:

The tool needed to prevent these errors is synchronization.

Function Programming Language characteristics like immutability and no side-effects are extremely helpful while writing multi-threaded code because developers doesn't to worry about synchronizing of the state.


Threads often have to coordinate their actions. The most common coordination idiom is the guarded block.

Powered by ComboStrap