LoginSignup
0

More than 5 years have passed since last update.

petalinux / microzed > N. プロセス間通信( IPC ; inter process communication )の種類

Last updated at Posted at 2016-01-10

自分の過去メモ(2014年ころ)より

プロセス間の通信手法 (スレッド間通信に使ってもいいとのこと) stackoverflow

  1. Pipe
  2. FIFO (named pipe)
  3. Socket (Unix Domain Socket)
  4. Message Queue
  5. Signal
  6. Semaphore
  7. Shared memory
  • それぞれについて
    • Pipe is useful only among processes related as parent/child. Call pipe(2) and fork(2). Unidirectional.
    • Two unrelated processes can use FIFO unlike plain pipe. Call mkfifo(3). Unidirectional.
    • Bidirectional. Meant for network communication, but can be used locally too. Can be used for different protocol. There's no message boundary for TCP. Call socket(2).
    • Message Queue. OS maintains discrete message. See sys/msg.h.
    • Signal sends an integer to another process. Doesn't mesh well with multi-threads. Call kill(2).
    • Semaphore is a synchronization mechanism for multi processes or threads, similar to a queue of people waiting for bathroom. See sys/sem.h. Shared memory is a shared memory. Do your own concurrency control. Call shmget(2).

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0