Most modern operating systems use memory virtualization support provided by the underlying hardware platform to isolate application processes from each other.
Each process has its own virtual address space that is completely independent of the address spaces of other applications. This provides huge benefits to developers. Since the address processes of applications are independent, an application cannot accidentally corrupt the memory of another application. As a result, a failure in one application does not affect the whole system. Since all the other applications keep working, the system can recover by restarting the failing application.
The benefits of memory isolation come at a cost. Since one process cannot access the memory of another, it needs to use a dedicated Application Program Interface (API) for data exchange, or inter-process communication (IPC), which is provided by the operating system.
In this recipe, we will learn how to exchange information between two processes using shared files. It may not be the most performance-efficient mechanism, but it is ubiquitous, easy to use, and good enough for various practical use cases.