Today's learning process communication IPC (InterProcess Communication)
purpose:
data transmission
Process control
Share data
Notice event
Resource Sharing
The basic concept is the signal and pipeline and the IPC mechanism of UNIX SYSTEM V.
Question: The signal and pipeline probably understand how UNIX SYSTEM V IPC communication mechanism.
Signals: SIGUSR1 and SIGUSR2 can be defined by the application, pressing the CTRL C kernel to send a sigint to the front desk process
There are 29 different signals in Linux, huh, huh, similar to the original interruption, I have been thinking so, and the signal has a default processing behavior, replacing the default response by providing signal processing functions.
The process is waiting for the arrival of SIGPAUSE
The signal system is over-selling, the number is limited, and the transmission information is limited.
The process can ignore most of the information, except: Sigstop and Sigkill
Process can block certain signals Block, similar to shield
There is no priority between the signals, which is different from the signal and the interrupt, and the system will be used as a signal as a process.
The number of all signals has a CPU word long decision
Program maintenance signal information in Sigction
Only kernel and super users have permissions to send signals to other processes, ordinary users can only signal from processs with the same UID and GID or in a process group.
pipeline
The pipe provides a simple flow control mechanism, which is one-way, first in the first outable, fixed-size data stream.
Pipes have sizes
limit:
1. Read the data, also move the data from the pipeline, so you cannot broadcast more than one more
2. Data in the pipe is byte stream, no boundary
3. If there are multiple read processes, write processes cannot specify a read process. If there are multiple write processes, it is impossible to judge who sends data.
System V IPC mechanism
Includes: message queue, signal light and shared memory
They use the same authentication method to get these resources
IPC_PERM structure includes user IDs and group IDs for owners, creators, and processes, and access to access, IPC object keywords
Keywords have public and private
message queue
Linux maintains a message queue's chain table called Msgque, a message called MSG
Link list points to a data structure of a MSQID_DS, the MSQID_DS structure is used to describe the message, each MSQID_DS contains a pointer of IPC_Perm and a pointer to the message, and MSQID_DS also includes writing a wait queue and reading waiting queue.
Signal light SemaphoRes