Sockets

Sockets

System V IPC Mechanisms

Linux supports three types of interprocess communication mechanisms that first appeared in Unix TM System V (1983). These are message queues, semaphores and shared memory. These System V IPC mechanisms all share common authentication methods. Processes may access these resources only by passing a unique reference identifier to the kernel via system calls. Access to these System V IPC objects is checked using access permissions, much like accesses to files are checked. The access rights to the System V IPC object is set by the creator of the object via system calls. The object’s reference identifier is used by each mechanism as an index into a table of resources. It is not a straightforward index but requires some manipulation to generate it.

All Linux data structures representing System V IPC objects in the system include an ipc_perm structure which contains the owner and creator process’s user and group identifiers. The access mode for this object (owner, group and other) and the IPC object’s key. The key is used as a way of locating the System V IPC object’s reference identifier. Two sets of keys are supported: public and private. If the key is public then any process in the system, subject to rights checking, can find the reference identifier for the System V IPC object. System V IPC objects can never be referenced with a key, only by their reference identifier.