shmget()
shmget() is used to obtain a shared memory identifier:
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
int shmget( key_t key, int size, int flag );
shmget() returns a shared memory ID if OK, -1 on error
key is typically the constant “IPC_PRIVATE”, which lets the kernel choose a new key -- keys are non-negative integer identifiers, but unlike fds they are system-wide, and their value continually increases to a maximum value, where it then wraps around to zero
size is the size of the shared memory segment, in bytes
flag can be “SHM_R”, “SHM_W”, or “SHM_R|SHM_W”