Linux under inter-process communication Overview

  1. Pipe (PIPE)
  2. FIFO (named pipe)
  3. XSI message queue
  4. XSI semaphores
  5. XSI shared memory
  6. POSIX semaphores
  7. Domain sockets (Domain Socket)
  8. Signal (Signal)
  9. Mutex (Mutex)

      Wherein the signal (Signal) and semaphore (semaphore) is not regarded as essentially inter-process communication, inter-process mode should be synchronized, but may also play a role in communication, it is also listed above. Further common action between thread synchronization mutex is used, it may be processes A and B share a memory initialization mutex, you can use this mutex used by the inter-process communication.      

And compare the advantages and disadvantages of various means of communication

  1. Pipeline: slow, limited capacity, only a parent and child can communicate

  2. FIFO: can any interprocess communication, but slower

  3. Message Queuing: system capacity is restricted, and care should be first read, not to consider the last data read

  4. Semaphore: complex message is not transmitted, synchronization can only be used

  5. Shared memory: the ability to easily control capacity, it is among the fastest way synchronization process, but to keep pace, such a process at the time of writing, another process should pay attention to the issue of literacy, which is equivalent thread-safe thread and, of course, can also be used as a shared memory area inter-thread communication, but will not be necessary, inter-thread already has shared a piece of memory within the same process

Guess you like

Origin www.cnblogs.com/best-farmer/p/10981292.html