プロセス間通信(プロセスかんつうしん、IPC、)はコンピュータの動作において、複数プロセス(の複数スレッド)間でデータをやりとりする仕組み。通信プロセスは、同一コンピュータ内で帰結するローカル、ネットワーク接続された別のコンピュータと相互にリモート、などのほかに多様な観点で分類され、スレッド間の通信帯域幅とレイテンシや扱うデータの種類も多種多様である。メッセージパッシング、同期、共有メモリ、RPCなどのメカニズムやプリミティブがある。
プロセス間通信の目的と理由は 情報の共有 計算の高速化 モジュール性の向上 利便性
であり、「スレッド間通信」や「アプリケーション間通信」と呼ぶこともある。
IPCとアドレス空間のコンセプトの組合せは、アドレス空間分離の基盤であるJochen Liedtke. On µ-Kernel Construction, Proc. 15th ACM Symposium on Operating System Principles (SOSP), December 1995。
主な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、, 、QNX、その他 Binder Android
実装例 IPCとして使われているAPIはいくつかある。プラットフォームに依存しない主なAPIの例を挙げる。 と名前付きパイプ Common Object Request Broker Architecture (CORBA) Freedesktop.orgのD-Bus Distributed Computing Environment (DCE) メッセージバス (Mbus) - にて規定 MCAPI (Multicore Communications API) Lightweight Communications and Marshalling (LCM) ONC RPC UNIXドメインソケット XML: XML-RPC や SOAP JSON: JSON-RPC Thrift TIPC ZeroCの Internet Communications Engine (ICE)
以下は、プラットフォーム固有またはプログラミング言語固有のAPIの例である。 Appleの Apple event(従来は Interapplication Communications、IAC と呼ばれていた) Eneaの LINX - Linux向け(オープンソース)と Enea OSE で動作するバージョンがある。 CMUによるIPC実装 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)、、名前付きパイプ、、、、、.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 MessagingIPC Shared Memory Messaging QNXのPPS (Persistant Publish/Subscribe) サービス SIMPL (Synchronous Interprocess Messaging Project for Linux) - QNX風IPCをLinuxに実装するプロジェクト
脚注
参考文献 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