1. Create shared memory
2. Attach shared memory
int shmget(key_t key, int size, int shmflg);
if ((shm_id = shmget (mykey, sizeof (struct sharedbuf), 0600 | IFLAGS)) < 0)
perror ("shmget");
2. Attach shared memory
char *buf = shmat (shm_id, 0, 0);
3. Read / Write shared memory
sharedbuf->size = size_;
memcpy(sharedbuf->buf, mybuf, size_);
memcpy(mybuf, sharedbuf->buf, sharedbuf->size);
3. Detach shared memory (optional)
shmdt (buf);
4. Remove shared memory
if (shmctl (shm_id, IPC_RMID, (struct shmid_ds *)0) < 0)
perror ("shmctl");