November 21, 2010

Simple shared memory using mmap()

I was checking out some examples in the Linux Programming Interface. The idea of using shared memory bits between the children and the parent process for synchronization looked like a simple yet powerful idea, here is an example program that does exactly that :

Note : to map allocate the memory from the virtual memory space of the proccess, you have to use MAP_ANONYMOUS.