プロセス間通信




プロセス間通信(IPC、英: interprocess communication)はコンピュータの動作において、複数プロセス(の複数スレッド)間でデータをやりとりする仕組み。通信プロセスは、同一コンピュータ内で帰結するローカル、ネットワーク接続された別のコンピュータと相互にリモート、などのほかに多様な観点で分類され、スレッド間の通信帯域幅とレイテンシや扱うデータの種類も多種多様である。メッセージパッシング、同期、共有メモリ、RPCなどのメカニズムやプリミティブがある。


プロセス間通信の目的と理由は



  • 情報の共有

  • 計算の高速化

  • モジュール性の向上

  • 利便性

  • 特権分離(英語版)


であり、「スレッド間通信」や「アプリケーション間通信」と呼ぶこともある。


IPCとアドレス空間のコンセプトの組合せは、アドレス空間分離の基盤である[1]




目次






  • 1 主なIPC技法


  • 2 実装例


  • 3 脚注


  • 4 参考文献


  • 5 関連項目


  • 6 外部リンク





主なIPC技法























































技法 提供しているオペレーティングシステムや環境
ファイル 多くのOS
シグナル 多くのOS。WindowsではCのランタイムライブラリでのみ実装しており、IPCとしての利用は推奨していない[要出典]
メッセージキュー 多くのOS
ソケット 多くのOS
UNIXドメインソケット
POSIX準拠システム
パイプ POSIX準拠システム、Windows
名前付きパイプ POSIX準拠システム、Windows
セマフォ POSIX準拠システム、Windows
共有メモリ POSIX準拠システム、Windows
メモリマップトファイル POSIX準拠システム、Windows

メッセージパッシング
(shared nothing)

MPI パラダイム、Java RMI、CORBA、MSMQ(英語版), MailSlot(英語版)、QNX、その他
Binder
Android


実装例


IPCとして使われているAPIはいくつかある。プラットフォームに依存しない主なAPIの例を挙げる。




  • 無名パイプ(英語版)と名前付きパイプ


  • Common Object Request Broker Architecture (CORBA)


  • Freedesktop.orgのD-Bus


  • Distributed Computing Environment (DCE)

  • メッセージバス (Mbus) - RFC 3259 にて規定


  • MCAPI (Multicore Communications API)


  • Lightweight Communications and Marshalling (LCM)

  • ONC RPC

  • UNIXドメインソケット


  • XML: XML-RPC や SOAP


  • JSON: JSON-RPC

  • Thrift

  • TIPC (TIPC


  • ZeroCの Internet Communications Engine (ICE)


以下は、プラットフォーム固有またはプログラミング言語固有のAPIの例である。




  • アップルの Apple event(従来は Interapplication Communications、IAC と呼ばれていた)


  • Eneaの LINX - Linux向け(オープンソース)と Enea OSE で動作するバージョンがある。


  • CMUによるIPC実装[2]


  • Javaの Remote Method Invocation (RMI)


  • KDEの Desktop Communications Protocol (DCOP)


  • Libt2n - Linux上のC++でのみ動作。複雑なオブジェクトや例外を扱える。


  • Machカーネルの Mach ポート


  • マイクロソフトの ActiveX、Component Object Model (COM)、Microsoft Transaction Server (COM+)、Distributed Component Object Model (DCOM)、動的データ交換 (DDE)、Object Linking and Embedding (OLE)、匿名パイプ(英語版)、名前付きパイプ、Local Procedure Call(英語版)MailSlot(英語版)メッセージループ(英語版)MSRPC(英語版)、.NET Remoting、Windows Communication Foundation (WCF)


  • ノベルの SPX


  • PHPのセッション


  • POSIX: mmap、メッセージキュー、セマフォ、共有メモリ


  • RISC OSのメッセージ


  • Solaris Doors


  • System V: メッセージキュー、セマフォ、共有メモリ

  • Distributed Ruby


  • DIPC (Distributed Inter-Process Communication) - Linux上で System V 系IPCをネットワークにまで拡張する仕組み


  • OpenBinder - BeOSが起源で、最近ではAndroidで使われている。


  • Solace Systems の IPC Shared Memory Messaging[3]


  • QNXのPPS (Persistant Publish/Subscribe) サービス


  • SIMPL (Synchronous Interprocess Messaging Project for Linux) - QNX風IPCをLinuxに実装するプロジェクト



脚注





  1. ^ Jochen Liedtke. On µ-Kernel Construction, Proc. 15th ACM Symposium on Operating System Principles (SOSP), December 1995


  2. ^ “Inter Process Communication (IPC)”. CMU. 2012年10月4日閲覧。


  3. ^ IPC Shared Memory Messaging




参考文献




  • Stevens, Richard. UNIX Network Programming, Volume 2, Second Edition: Interprocess Communications. Prentice Hall, 1999. ISBN 0-13-081081-9

  • U. Ramachandran, M. Solomon, M. Vernon Hardware support for interprocess communication Proceedings of the 14th annual international symposium on Computer architecture. Pittsburgh, Pennsylvania, United States. Pages: 178 - 188. Year of Publication: 1987 ISBN 0-8186-0776-9

  • Crovella, M. Bianchini, R. LeBlanc, T. Markatos, E. Wisniewski, R. Using communication-to-computation ratio in parallel program designand performance prediction 1–4 December 1992. pp. 238–245 ISBN 0-8186-3200-3



関連項目




  • Communicating Sequential Processes (CSP)


  • Data Distribution Service (DDS)

  • マイクロカーネル



外部リンク




  • Linux ipc(5) man page - System V IPC の解説

  • Windows IPC

  • Beej's Guide to Unix IPC


  • Unix Network Programming (Vol 2: Interprocess Communications) by W. Richard Stevens




Popular posts from this blog

サソリ

広島県道265号伴広島線

Setup Asymptote in Texstudio