POSIX shared memory (1)
A great way to communicate between processes
without going through expensive system calls.
Open a shared memory object:
shm_fd = shm_open(“acme”, O_CREAT |
O_RDWR, 0666);
A zero size /dev/shm/acme file appears.
Set the shared memory object size
ftruncate(shm_fd, SHM_SIZE);
/dev/shm/acme is now listed with the specified size.
If the object has already been sized by another process,
you can get its size with the fstat function.