Interviewer, the interprocess communication you want to ask!

As an embedded software development engineer, when interviewing, I will always be cue, application programming, and then not to talk about inter-process communication? ? ?
Then let me summarize it for everyone.

7 ways to communicate between processes

  • Pipeline: Pipeline is a half-duplex communication method. Data can only flow in one direction, and can only be used between related processes. Process kinship usually refers to the father-son process.
  • Named Pipe FIFO: A well-known pipe is also a half-duplex communication method, but it allows communication between unrelated processes.
  • Message Queue MessageQueue: The message queue is a linked list of messages, stored in the kernel and identified by the message queue identifier. The message queue overcomes the shortcomings of less signal transmission information, the pipeline can only carry unformatted byte streams, and the buffer size is limited.
  • Shared storage: Shared memory: shared memory is a piece of memory that can be accessed by other processes. This shared memory is created by one process, but multiple processes can access it. Shared memory is the fastest IPC method. It is specifically designed for the low efficiency of other inter-process communication methods. It is often used in conjunction with other communication mechanisms, such as semaphores, to achieve synchronization and communication between processes.
  • Semaphore: Semaphore is a counter that can be used to control multiple processes' access to shared resources. It is often used as a lock mechanism to prevent a process from accessing a shared resource while other processes are also accessing the resource. Therefore, it is mainly used as a synchronization method between processes and between different threads in the same process.
  • Socket: Socket is also an inter-process communication mechanism. Unlike other communication mechanisms, it can be used for different and inter-process communication.
  • Signal (signal): Signal is a more complex communication method, used to notify the receiving process that an event has occurred.

Detailed communication methods

Pipeline

Published 162 original articles · praised 183 · 120,000 views

Guess you like

Origin blog.csdn.net/qq_31339221/article/details/105423168