- 追加された行はこの色です。
- 削除された行はこの色です。
「[[マイクロソフト系技術情報 Wiki>http://techinfoofmicrosofttech.osscons.jp/]]」は、「[[Open棟梁Project>https://github.com/OpenTouryoProject/]]」,「[[OSSコンソーシアム .NET開発基盤部会>https://www.osscons.jp/dotNetDevelopmentInfrastructure/]]」によって運営されています。
-[[戻る>その他、開発の色々]]
* 目次 [#ucb91276]
#contents
*概要 [#tf883ba7]
プロセス間通信について
プロセス間通信についてまとめた。
*詳細 [#d40d71c8]
**基本 [#w62e240d]
-共有メモリ、パイプ(名前付き/匿名)、UDP/TCPなどがある。
-共有メモリ、パイプ(名前付き/匿名)、[[TCP, UDP]]などがある。
-子プロセスとの通信なら匿名パイプを使用すると良い。
***共有メモリ [#z4db4fcf]
内部的には、ページングファイルに支持されたメモリマップド・ファイルを使用する。
-内部的には、ページングファイルに支持されたメモリマップド・ファイルを使用する。
-実装については、下記の「[[SharedMem.xaml.cs>#ga1c6605]]」を参照のこと。~
ただし、[[Touryo.Infrastructure.Public.Util.SharedMemory>https://github.com/OpenTouryoProject/OpenTouryo/blob/develop/root/programs/CS/Frameworks/Infrastructure/Public/Util/SharedMemory.cs]]に依存している。
***パイプ [#t693fdb4]
-名前付きパイプ
--名前付きパイプを使用して、プロセス間通信を行う場合、~
パイプ・オブジェクトの始点と終端を2プロセス間で持つ。
--このとき、パイプ・オブジェクトをIDのようなもので~
識別するのが、名前付きパイプになる。
--従って、名前付きパイプの場合、~
2プロセスがパイプ名を共有している必要がある。
--詳細については、下記の「[[NdPipe.xaml.cs>#ga1c6605]]」を参照のこと。
-匿名パイプ
--一方、匿名パイプは、名前が無いので、名前で共有できない。
--その代りに、親側から、子側に、ハンドラを複製して渡す。
--その代りに、親プロセス側から、子プロセス側に、ハンドラを複製して渡す。~
(従って、匿名パイプは、親子プロセス間通信での利用が一般的になる)
--このハンドラの複製に、
---Windows OSでは、DuplicateHandle関数を使用し、
---Unix系OSでは、fork関数を使用する。
--.NETでは、このハンドラの複製に、~
--参考
---[ C言語 ] プロセスの生成 ( fork ) と パイプによる~
プロセス間通信 ( pipe ) – 行け!偏差値40プログラマー~
http://hensa40.cutegirl.jp/archives/1032
---親プロセス・子プロセス間通信 - Qiita~
https://qiita.com/SoyaTakahashi/items/f28d0b5ef404afd339fa
---.NETでは、このハンドラの複製に、~
https://github.com/OpenTouryoProject/SampleProgram/blob/master/Other/PipesFamilyHouse/AnonymousPipe/Parent/Program.cs#L77~
HandleInheritability.Inheritableを使用している。~
これは、内部(Win32)的に、DuplicateHandle関数と思われる。
-参考
--[ C言語 ] プロセスの生成 ( fork ) と パイプによる~
プロセス間通信 ( pipe ) – 行け!偏差値40プログラマー~
http://hensa40.cutegirl.jp/archives/1032
***UDP [#g9cdf481]
コネクションレス型の通信
-コネクションレス型の通信
-実装については、下記の「[[UDP.xaml.cs>#ga1c6605]]」を参照のこと。
***TCP [#e54d5a5e]
コネクション型の通信
-コネクション型の通信
-実装については、下記の「[[TCP.xaml.cs>#ga1c6605]]」を参照のこと。
**その他 [#z2424263]
***[[RPC]] [#c07b83ee]
-DCE/RPC
--DCOM
--.NET Remoting
-Webサービス
--XML-RPC
--JSON-RPC
-WCF (Windows Communication Foundation)
***[[ウィンドウ・システム]] > [[ウィンドウ メッセージ]] [#dbcee084]
**POSIX [#dab098d8]
-UNIXドメインソケット
-POSIXメッセージキュー
*参考 [#v50a11dd]
**POSIX [#nf38bd9e]
***Wikipedia [#c52a2b27]
-Category:プロセス間通信~
https://ja.wikipedia.org/wiki/Category:%E3%83%97%E3%83%AD%E3%82%BB%E3%82%B9%E9%96%93%E9%80%9A%E4%BF%A1
--プロセス間通信~
https://ja.wikipedia.org/wiki/%E3%83%97%E3%83%AD%E3%82%BB%E3%82%B9%E9%96%93%E9%80%9A%E4%BF%A1
--共有メモリ~
https://ja.wikipedia.org/wiki/%E5%85%B1%E6%9C%89%E3%83%A1%E3%83%A2%E3%83%AA
--パイプ (コンピュータ)~
https://ja.wikipedia.org/wiki/%E3%83%91%E3%82%A4%E3%83%97_(%E3%82%B3%E3%83%B3%E3%83%94%E3%83%A5%E3%83%BC%E3%82%BF)
---名前付きパイプ~
https://ja.wikipedia.org/wiki/%E5%90%8D%E5%89%8D%E4%BB%98%E3%81%8D%E3%83%91%E3%82%A4%E3%83%97
--UNIXドメインソケット~
https://ja.wikipedia.org/wiki/UNIX%E3%83%89%E3%83%A1%E3%82%A4%E3%83%B3%E3%82%BD%E3%82%B1%E3%83%83%E3%83%88
--POSIX 1003.1b > Realtime (XSI Option) > _POSIX_MESSAGE_PASSING~
https://ja.wikipedia.org/wiki/POSIX_1003.1b#Realtime_(XSI_Option)
***その他 [#z6888bb3]
-プロセス間通信 - UnixClassWiki~
https://uc2.h2np.net/index.php/%E3%83%97%E3%83%AD%E3%82%BB%E3%82%B9%E9%96%93%E9%80%9A%E4%BF%A1
-プロセス間通信の比較 - ka2yanの日記~
http://d.hatena.ne.jp/ka2yan/20090327
**OpenTouryoProject/SampleProgram · GitHub [#offaeb4a]
-SampleProgram/Other/InterProcComm at master~
***InterProcComm at master [#ga1c6605]
https://github.com/OpenTouryoProject/SampleProgram/tree/master/Other/InterProcComm
--[[SharedMem.xaml.cs>https://github.com/OpenTouryoProject/SampleProgram/blob/master/Other/InterProcComm/SharedMem.xaml.cs]]
--[[NdPipe.xaml.cs>https://github.com/OpenTouryoProject/SampleProgram/blob/master/Other/InterProcComm/NdPipe.xaml.cs]]
--[[UDP.xaml.cs>https://github.com/OpenTouryoProject/SampleProgram/blob/master/Other/InterProcComm/UDP.xaml.cs]]
--[[TCP.xaml.cs>https://github.com/OpenTouryoProject/SampleProgram/blob/master/Other/InterProcComm/TCP.xaml.cs]]
-[[SharedMem.xaml.cs>https://github.com/OpenTouryoProject/SampleProgram/blob/master/Other/InterProcComm/SharedMem.xaml.cs]]
-[[NdPipe.xaml.cs>https://github.com/OpenTouryoProject/SampleProgram/blob/master/Other/InterProcComm/NdPipe.xaml.cs]]
-[[UDP.xaml.cs>https://github.com/OpenTouryoProject/SampleProgram/blob/master/Other/InterProcComm/UDP.xaml.cs]]
-[[TCP.xaml.cs>https://github.com/OpenTouryoProject/SampleProgram/blob/master/Other/InterProcComm/TCP.xaml.cs]]
-SampleProgram/Other/PipesFamilyHouse at master~
***PipesFamilyHouse at master [#vef413e1]
https://github.com/OpenTouryoProject/SampleProgram/tree/master/Other/PipesFamilyHouse
--AnonymousPipe(匿名パイプによる親子プロセス間通信)
--StdIOAndPipe(標準入出力による親子プロセス間通信)
-AnonymousPipe(匿名パイプによる親子プロセス間通信)
-StdIOAndPipe(標準入出力による親子プロセス間通信)
----
Tags: [[:プログラミング]], [[:その他、開発の色々]], [[:.NET開発]]