Member-only story

C++ Framework for More Expressive Inter-Process Message Passing

Debby Nirwan
Better Programming
Published in
9 min readDec 14, 2021
Photo by Markus Spiske on Unsplash

Inter-Process Communication

Processes — a recap

We often read online that a process is a program in execution, but wait a minute, what exactly does that really mean? For some, it might not be very clear what that means. Wikipedia provides a hopefully clearer definition:

A process is the instance of a computer program that is being executed by one or many threads.

Let’s look at an example. We have an executable that we are developing named app, so we have a file called app, or app.exe on Windows. When we run it, for example, by launching ./app from the shell, we will have an instance of our program, app, running. We can execute ./app multiple times and have multiple instances (multiple processes) of our app running on our OS.

Our app can have single or multiple threads depending on how we design it.

Simplified Illustration of Processes (Image by Author)

In the simple illustration above, we can see that each process is assigned a separate virtual memory space. process1 knows nothing about process2’s virtual memory space, nor does it have access to it.

On the other hand, threads live in the same process, they share the same virtual memory space. I hope this illustration clarifies the difference between process and thread.

Inter-thread vs. Inter-process Communications

Threads can communicate more easily because they share the same address space as described above. We can use a shared global variable for threads to exchange data/messages, with a proper synchronization mechanism. Read my article about inter-thread message passing below.

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Debby Nirwan
Debby Nirwan

Written by Debby Nirwan

Software Engineering Manager who loves reading, writing, and coding.

Responses (2)

Write a response

Thank you for sharing this. Very useful 💯👏

Saved! It's something I want to get into but software prices are daunting. What do you use? I love your graphics btw - that one at the bottom is clever!

This was helpful. Thank you for sharing.