System V, once also known as the T System V, is one of many versions of the UNIX operating system.
Traditionally, System V is considered one of two Unix flavors (the other is BSD). However, with the advent of UNIX implementations that are not based on both codes, such as Linux and QNX, this generalization is no longer accurate.
System V IPC Basics
The IPC mechanism of system V consists of 3 mechanisms: Message Queuing , semaphore , and shared memory .
The ipcs command in the shell can view the IPC tools that are being used in the current system.
IPCRM command in the shell: manually delete an IPC mechanism.
ID value : Each IPC mechanism is assigned a unique ID value, using the ID value to operate on the IPC mechanism.
Key value : 32-bit integer. Two processes cannot access each other's space arbitrarily, that is, when one process creates an ID value, another process cannot get it. To do this, the IPC convention is created using the key value as the parameter, and the same key value will get the ID of the same IPC object.
To prevent all programs from using the same key value, use the Ftok () function to create a key value
key_t Ftok (__const char *__pathname, int __proj_id) : The first parameter is a pathname, the second argument is an int variable
The 第31-24位 of the key value, which is a low 8-bit for the Ftok 2nd parameter
The 第23-16位 of the key value, the lower 8 bits of the file's St_dev property
The 第15-0位 of the key value, the lower 16 bits of the file's St_ino property
31--> 0 The first few are defined in this order
owner and Authority : IPC access rights with IPC tools are defined as struct ipc_perm in/usr/include/bits/ipc.h
"Linux Advanced Programming" (Chapter 11th) System v interprocess communication 1