Passing data quickly from one process to another

Sometimes we write programs that will communicate with each other a lot. When programs are run on different machines, using sockets is the most common technique for communication. But if multiple processes run on a single machine, we can do much better!

Let's take a look at how to make a single memory fragment available from different processes using the Boost.Interprocess library.

Getting ready

Basic knowledge of C++ is required for this recipe. Knowledge of atomic variables is also required (take a look at the See also section for more information about atomics). Some platforms require linking against the runtime library.

How to do it...

In this example we'll be sharing a single atomic variable between ...

Get Boost C++ Application Development Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.