Forms of Communications
Communications between concurrent functions can either be direct or indirect.
With direct communication one function sends a message and another function receives the message. On the level of abstraction we are working, the combination of the sending of the message and the receiving of the message between concurrent functions can be seen as a single indivisible action.
With indirect communication one function writes a message to a dedicated location and another function reads the message from that location. Indirect communication conversely can not be seen as an indivisible action as parts of the indirect communication may interfere with eachother. We list some problems that can occur with indirect communication.
- If the write and read actions are divisible then these actions can interfere with each other.
- It is possible that a new message is written before the old message is read.
- If the location the messages are written to is accessible by other concurrent functions, interference from these functions is possible as well.
As opposed to unidirectional communications, bidirectional communication can occur between concurrent functions. Bidirectional communication between two functions consists of two unidirectional communications. Bidirectional direct communication can lead to a deadlock when both function want to either write or read a message. Such a problem can be solved by using indirect communication with at least one of the unidirectional communications.
With bidirectional indirect communication interference between the two unidirectional communications is possible when the same location for storing the messages is used. Messages can be overwritten before they are read. If that is not allowed, separate locations for storing the messages should be used for the two unidirectional communications. Of course when it is known that this is never the case sharing the location is an option, but one that is prone to errors by later alterations. If it is allowed, it means that messages do not have to be read. But then write actions from both sides can interfere with each other.