Date: September 1, 2024

Topic: Inter Process Communication (IPC)

Recall

Types of IPCs:

Message passing uses a channel which the OS manages, allowing for common APIs but incurring overheads

Shared memory doesn’t have any overhead as there is a direct link, but is more error-prone and reimplementation is required since fixed and well-defined APIs for OS is not used

Notes

Inter Process Communication (IPC)

Multiple processes have to interact to allow a more complex multi-process application

IPC Mechanisms:

Message-passing IPC:

write / read through a channel (shared buffer) between processes

write / read through a channel (shared buffer) between processes

Advantages:

Disadvantages:

Shared Memory IPC

Direct shared memory channel

Direct shared memory channel

Advantages:

Disadvantages:

<aside> 💡

While shared memory data exchange may be cheap as no copying is required, the operation of mapping memory between two processes can be expensive. Only efficient if that setup cost can be amortized (spread out) across a sufficiently large number of messages

</aside>


<aside> 📌 SUMMARY: IPC can be done through message-passing, requiring context switching; or through shared-memory, which has a direct channel but requires memory mapping

</aside>