Summary of inter-process communication in several ways - Linux

pipeline

advantage

  1. Pipeline files do not take up disk space, allocated space in memory when you open the pipeline;
  2. Read into the pipe end automatically blocked in the pipe after the data has been read until the end of the write data is written again;

Shortcoming

  1. Pipe is half-duplex, data can only flow from one direction;
  2. Duct size PIPE_SIZE limited to 64K;

 

Shared memory

advantage

  1. Shared memory is the fastest the IPC, because the client and server share a given storage area is not required between the copy;
  2. Shared memory allows multiple processes to share a storage space;
  3. Shared memory size is no upper limit, there is no way of limitation;

Shortcoming

  1. Shared memory does not provide a synchronization mechanism, need semaphores to synchronize multiple processes simultaneously access the space;

 

message queue

advantage

  1. Message Queuing independent of the process outside the process exits after the data still exists in the queue;
  2. Message Queuing provides type field, different processes may be the type of message field of the received message;

Shortcoming

  1. Linux is a maximum number of bytes in the message queue for the 16k, the presence of up to 16 message queue system;
  2. The message queue is not set in the reference counter, still use the delete queue process errors will occur at the next exit queue operation after a message queue;
  3. Message Queuing need to manually remove after use;

Guess you like

Origin www.cnblogs.com/chenxinshuo/p/11936469.html