20. Inter-Process Communication

Prologue

Message Queues

// returns the message queue ID on success.
int msgget(key_t key, int msgflg);

// generates a key.
key_t ftok(const char *path, int id);

// sends a message into the queue
int msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg);

// receive from a queue
int msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg);

// destroy the queue
int msgctl(int msqid, int cmd, struct msqid_ds *buf);

// shared memory segment
int shmid = shmget(key_t key, size_t size, int shmflg);

Shared Memory

21. Signals

Conditions that generate signals