There is more than one way - and you get to decide which is right for you!
Shared Memory
Shared memory is pretty self-explanatory. It is a memory segment that is allocated by one program, and then made available to other programs. When all the programs are done with it, then it is disposed of. You can name shared memory. So if you want two programs to communicate, then let them look for memory with the same name and communicate that way.
Named Pipes
Named pipes are a lot like shared memory, but think of a named pipe as a file instead of a single block of memory. Each process can create, read, write, and destroy a named pipe, much like you can a file.
The difference between named pipes and shared memory is that a named pipe link is hot; With shared memory, data can be left in (as a sleeper, if you will), process 1 exits, process 2 accesses the data in memory, then deallocates the memory. With shared memory, a process doesn't even have to exist to leave a message for another process.
Queues
An OS/2 queue is either a standard First-In First-Out (FIFO) queue data/operation
structure, a LIFO structure, or a user-based-priority structure. However,
OS/2 makes it unique because more than one process (or thread) can write
to this queue.
Related Information:
What is the best way to communicate
between threads?