A process is a running activity that can be executed concurrently by a program with independent functions. It is a computer program in the active state.
Process status: User status/kernel status/in-memory readiness/in-memory sleep/ready and swapped out/preemptive/created/frozen.
Fork, exec, wait, exit
Process Communication Methods in Linux:
1. pipe-used for inter-process communication, half-duplex. Two pipelines are required for communication between the two parties. An unknown pipeline can only be used between parent and child processes and brother processes to form an independent file system, and only exists in the memory. data can be read and written. write Data to the end of the buffer and read data from the buffer header.
Only non-formatted byte streams can be transferred, and the buffer size is limited.
2. signal-a simulation of the interrupt mechanism at the software level. signals are the only asynchronous communication mechanism in the program communication mechanism. reliable and unreliable, real-time and non-real-time signals. phase Signal Generation --- register in process --- cancel in process --- signal processing function execution completed
Traffic signal lamp-provides a mechanism to control the access to shared resources among processes, which is equivalent to a memory flag. A process can determine whether it can access some shared resources, and the process can also change the flag. used for Process Synchronization and access control.
3. Message Queue-a message can be regarded as a record with a specific format and priority. A message queue is a linked list of messages and is sustained with the kernel.
4. Shared Memory-the most useful method for inter-process communication, the fastest IPC form, and the process shared memory, which is achieved through synchronization mechanisms such as mutex locks and semaphores.
5. semaphore-as a means of synchronization between processes and different threads of the same process.
6. socket-used for communication between different computers.