I want to share memory between two processes. One way I know is to mmap a shared file. However, I don't want to use a shared file, I want an anonymous mapping in the memory. How can I do that.
5 Answers
Shared memory is what you want: http://en.wikipedia.org/wiki/Shared_memory
Since you're on linux, here you go: http://www.kernel.org/doc/man-pages/online/pages/man7/shm_overview.7.html
Comments
shm_get is a good starting point, but you also need to read up about semaphores for mutual exclusion so that memory does not get corrupted.