Member-only story
C++ Framework for More Expressive Inter-Process Message Passing
Writing Inter-Process Message Passing Framework to improve the expressiveness of our code and make our code more elegant.
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.

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.