When a message is filled in the buffer, software interrupt is used to notify thereceiver. However, user level interrupts make programming difficult.
Handling blocking receives:
A timeout value may be used with a blocking receiveprimitive to prevent a receiving process from getting blocked indefinitely if the senderhas failed.
Synchronous Vs Asynchronous Communication
When both send and receive primitives of a communication between two processes useblocking semantics, the communication is said to be synchronous. If one or both of theprimitives is non-blocking, then the communication is said to be asynchronous.Synchronous communication is easy to implement. It contributes to the reliable deliveryof messages. Asynchronous communication limits concurrency and is prone tocommunication deadlocks
The transmission of messages from one process to another can be done by copying the
body of the message from the sender’s address space to the receiver’s address space.
In some cases, the receiving process may not be ready to receive the message but itwants the operating system to save that message for later reception. In such cases, the
operating system would rely on the receiver’s buffer space in which the transmitted
messages can be stored prior to receiving process executing specific code to receivethe message.The synchronous and asynchronous modes of communication correspond to the twoextremes of buffering: a null buffer, or no buffering, and a buffer with unboundedcapacity. Two other commonly used buffering strategies are single-message and finite-bound, or multiple message buffers. These four types of buffering strategies are givenbelow:
In this case, message remains in the sender’s address space until the
receiver executes the corresponding receive.
Single message buffer:
A buffer to hold a single message at the receiver side isused. It is used for implementing synchronous communication because in this case anapplication can have only one outstanding message at any given time.
Unbounded - Capacity buffer:
Convenient to support asynchronous communication.However, it is impossible to support unbounded buffer.
Used for supporting asynchronous communication.Buffer overflow can be handled in one of the following ways:
send returns an error message to the sendingprocess, indicating that the message could not be delivered to the receiver because thebuffer is full.
The sender is blocked until the receiver acceptssome messages. This violates the semantics of asynchronous send. This will also resultin communication deadlock.