As we saw in the previous chapter, processing shared data from multiple threads introduces all sorts of problems that cannot be easily fixed especially if we want the program to executed faster than in a single—threaded version.
A common solution for this problem is to redesign the program. Instead of using the shared data access and locking pattern, we replace the shared data with multiple copies of the same and synchronize (lock) with the message pattern.
If you play chess on the internet, you are not sharing a chessboard with your partner. Instead, each of you have your own copy of the chessboard and figures, and you synchronize the state between the two copies by sending messages (representing the piece moves) to each other.
Messaging is not a design but an architectural pattern. The implementation of messaging is, however, usually specific to a platform or...