JP7580284B2 - Inter-process communication device, inter-process communication method, and inter-process communication program - Google Patents
Inter-process communication device, inter-process communication method, and inter-process communication program Download PDFInfo
- Publication number
- JP7580284B2 JP7580284B2 JP2021011583A JP2021011583A JP7580284B2 JP 7580284 B2 JP7580284 B2 JP 7580284B2 JP 2021011583 A JP2021011583 A JP 2021011583A JP 2021011583 A JP2021011583 A JP 2021011583A JP 7580284 B2 JP7580284 B2 JP 7580284B2
- Authority
- JP
- Japan
- Prior art keywords
- topic
- communication
- destination
- directory
- receiving
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims description 277
- 238000004891 communication Methods 0.000 title claims description 220
- 230000002159 abnormal effect Effects 0.000 claims 4
- FFBHFFJDDLITSX-UHFFFAOYSA-N benzyl N-[2-hydroxy-4-(3-oxomorpholin-4-yl)phenyl]carbamate Chemical compound OC1=C(NC(=O)OCC2=CC=CC=C2)C=CC(=C1)N1CCOCC1=O FFBHFFJDDLITSX-UHFFFAOYSA-N 0.000 description 17
- 238000010586 diagram Methods 0.000 description 9
- 230000005540 biological transmission Effects 0.000 description 4
- 230000004044 response Effects 0.000 description 4
- 230000006870 function Effects 0.000 description 3
- 230000000694 effects Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 230000005856 abnormality Effects 0.000 description 1
- 238000013475 authorization Methods 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 238000007796 conventional method Methods 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
Images
Description
この発明は、プロセス間で通信を行うプロセス間通信装置、プロセス間通信方法及びプロセス間通信プログラムに関する。 This invention relates to an inter-process communication device, an inter-process communication method, and an inter-process communication program for communicating between processes.
近年、プロセス間通信において、例えば図4に示すように、Pub-Sub通信(出版-購読型通信)と呼ばれる通信技術が利用されている。このPub-Sub通信は、送信側プロセス(出版者)101bが特定の受信側プロセス(購読者)101aを特定せずにメッセージを送る通信である。すなわち、Pub-Sub通信は、受信側プロセス101aと送信側プロセス101bとをトピック102という仲介者を介して結び付けることにより、受信側プロセス101aと送信側プロセス101bとを直接結合させない(通信相手を直接指定しない)、動的なネットワーク(多対多通信)の構成を可能とする技術である。図4では、3つの受信側プロセス101a-1~101a-3と2つの送信側プロセス101b-1,101b-2との間で通信を行う場合を示している。また、トピック102としては、送受信するメッセージのクラス、例えばトピック名と呼ばれる文字列が挙げられる。
In recent years, a communication technology called Pub-Sub communication (publish-subscribe type communication) is used in inter-process communication, as shown in FIG. 4. This Pub-Sub communication is a communication in which a sending process (publisher) 101b sends a message without specifying a specific receiving process (subscriber) 101a. In other words, Pub-Sub communication is a technology that enables the configuration of a dynamic network (many-to-many communication) in which the
このPub-Sub通信の実現方法として、ブローカーと呼ばれる仲介プログラム(通信制御プロセス)を利用する方法(例えば特許文献1参照)と、分散型と呼ばれるブローカーを利用しない方法(例えば特許文献2参照)とが知られている。 Known methods for implementing this pub-sub communication include a method that uses an intermediary program (communication control process) called a broker (see, for example, Patent Document 1), and a method that does not use a broker, called a distributed type (see, for example, Patent Document 2).
まず、ブローカーを利用する方法について、図5を参照しながら説明する。
ブローカー103は通信を行うプログラムとは独立して動作するプログラムであり、通信利用プロセス101(受信側プロセス101a及び送信側プロセス101b)はブローカー103を介してデータの送受信を行う。
具体的には、まず、受信側プロセス101aは、ブローカー103に受信対象であるトピック102を登録する。そして、送信側プロセス101bは、トピック102を指定したデータをブローカー103に送信する。そして、ブローカー103は、データを受信すると、当該データに属するトピック102に応じ、そのトピック102の購読を要求する全ての受信側プロセス101aに対して、当該データを転送することで、Pub-Sub通信を実現する。すなわち、ブローカー103がデータの中継を行うことでPub-Sub通信を行う。
First, a method of using a broker will be described with reference to FIG.
The
Specifically, first, the
次に、分散型について、図6を参照しながら説明する。
この分散型では、全ての通信利用プロセス101が定期的に送信及び受信するトピック102に関する情報等をお互いに通知し合い、当該情報を更新することにより、トピック102毎に必要なメッセージの送受信を実現する。
具体的には、まず、ディスカバリー通信等と呼ばれるバックグラウンド通信を用いて、通信利用プロセス101同士で定期的に送信及び受信を行うトピック102に関する情報を交換しておく。そして、送信側プロセス101bがデータを送信する際に、バックグラウンド通信で収集された、送信するトピック102を受信したい受信側プロセス101a全てに同じデータを送信する、という形でPub-Sub通信を実現する。図6に示す太線の矢印は受信側プロセス101a-1によるバックグラウンド通信を示している。
Next, the distributed type will be described with reference to FIG.
In this distributed system, all communication utilization processes 101 periodically notify each other of information related to the
Specifically, first, communication using processes 101 exchange information about the
しかしながら、ブローカーを利用する方法では、ブローカーが異常により停止すると、全ての通信ができなくなる。また、大量の送信側プロセス及び受信側プロセスが存在する場合、ブローカーのプログラムの負荷が高くなり、通信のボトルネックとなる可能性もある。 However, when using a broker, if the broker stops due to an abnormality, all communication will be impossible. Also, if there are a large number of sending and receiving processes, the load on the broker program will increase, and this may cause a bottleneck in communications.
また、分散型では、Pub-Sub通信は動的なネットワークであるため、トピックの送信及び受信を行うプログラムが起動及び停止された場合に備えて、高頻度で情報交換を行う必要があり、送信側プロセス及び受信側プロセスの数が増えるにしたがって、多量のバックグラウンド通信が発生する。このバックグラウンド通信は、メッセージ以外の通信であるため、本来送受信したいデータの通信を妨害する(待機させる)可能性がある。 In addition, in a distributed system, pub-sub communication is a dynamic network, so information needs to be exchanged frequently in case the programs that send and receive topics are started and stopped, and as the number of sending and receiving processes increases, a large amount of background communication occurs. Since this background communication is communication other than messages, there is a possibility that it may interfere with (put on hold) the communication of data that is actually to be sent and received.
この発明は、上記のような課題を解決するためになされたもので、従来に対し、バックグラウンド通信を低減可能であり且つデータの中継が不要なプロセス間通信装置を提供することを目的としている。 This invention was made to solve the above problems, and aims to provide an inter-process communication device that can reduce background communication compared to conventional devices and does not require data relaying.
この発明に係るプロセス間通信装置は、通信用ディレクトリ内にトピック毎に設けられたトピックディレクトリのうち、受信対象であるトピックに対応するトピックディレクトリ内に、自身の宛先を示す宛先ファイルを生成する受信側プロセスと、トピックディレクトリのうち、送信対象であるトピックに対応するトピックディレクトリ内に生成された宛先ファイルから宛先を特定し、当該宛先にデータを送信する送信側プロセスとを備えたことを特徴とする。 The inter-process communication device according to the present invention is characterized by comprising a receiving process that generates a destination file indicating its own destination in a topic directory corresponding to a topic to be received from among topic directories provided for each topic in a communication directory, and a sending process that identifies a destination from the destination file generated in the topic directory corresponding to a topic to be sent from among the topic directories, and sends data to the destination.
この発明によれば、上記のように構成したので、従来に対し、バックグラウンド通信を低減可能であり且つデータの中継が不要となる。 With the above-mentioned configuration, this invention makes it possible to reduce background communication compared to the conventional method and eliminates the need for data relaying.
以下、この発明の実施の形態について図面を参照しながら詳細に説明する。
実施の形態1.
図1は実施の形態1に係るプロセス間通信装置の構成例及び動作例を示す図である。
実施の形態1に係るプロセス間通信装置では、図1に示すように、1つ以上の受信側プロセス(受信側プログラム)1a及び1つ以上の送信側プロセス(送信側プログラム)1bを備えている。図1では、3つの受信側プロセス1a-1~1a-3及び3つの送信側プロセス1b-1~1b-3が示されている。また以下では、受信側プロセス1a及び送信側プロセス1bをまとめて通信利用プロセス1と称す場合もある。
Hereinafter, an embodiment of the present invention will be described in detail with reference to the drawings.
FIG. 1 is a diagram showing an example of the configuration and operation of an inter-process communication device according to the first embodiment.
The inter-process communication device according to the first embodiment includes one or more receiving processes (receiving programs) 1a and one or more sending processes (sending programs) 1b, as shown in Fig. 1. Three
なお、プロセス間通信装置は、メモリ等に記憶されたプログラムを実行するCPU(Central Processing Unit)等により実現されるコンピュータである。 The inter-process communication device is a computer realized by a CPU (Central Processing Unit) that executes programs stored in a memory, etc.
プロセス間通信装置では、通信用ディレクトリ(通信ワーキングディレクトリ)11が用意されている。通信用ディレクトリ11は、通信用に使用するディレクトリ或いはフォルダ等である。
The inter-process communication device provides a communication directory (communication working directory) 11. The
また、通信用ディレクトリ11内には、トピック毎に、トピックディレクトリ12が用意されている。トピックディレクトリ12は、使用するトピック名等、トピックが区別できる名称のディレクトリである。
In addition, a topic directory 12 is prepared for each topic within the
図1では、通信用ディレクトリ11内に、2つのトピックディレクトリ12-1,12-2が用意されている場合を示している。なお、トピックディレクトリ12-1は、第1のトピックに対応するトピックディレクトリである。また、トピックディレクトリ12-2は、第2のトピックに対応するトピックディレクトリである。
In FIG. 1, two topic directories 12-1 and 12-2 are provided in the
なお、トピックは、例えば名前空間等と呼ばれる接頭句がつけられ、階層を持った状態でクラス分けされる場合がある。このような場合は、ディレクトリ構造を階層化することで対応可能である。 Note that topics may be given a prefix called a namespace, for example, and may be classified in a hierarchical manner. In such cases, it is possible to deal with this by creating a hierarchical directory structure.
また、トピックディレクトリ12は、通信利用プロセス1(受信側プロセス1a又は送信側プロセス1b)が必要に応じて生成するように構成されていてもよい。
なお、トピックディレクトリ12が生成される場所は,受信側プロセス1aと送信側プロセス1bとで同じ場所を指していればよい。そのため、例えば、オペレーティングシステム(Windows(登録商標)又はLinux(登録商標)等)が自動的に作成する既存ディレクトリをプログラムに指定してもよい。
The topic directory 12 may be configured so that the communication using process 1 (the
The location where the topic directory 12 is generated needs only to be the same for the
受信側プロセス1aは、自身のプログラムが起動した際に、通信用ディレクトリ11内に設けられたトピックディレクトリ12のうち、受信対象であるトピックに対応するトピックディレクトリ12内に、宛先ファイル13を定められた形式で生成する。宛先ファイル13は、自身の宛先(通信路)を示すファイルである。
When the
受信側プロセス1aは、宛先について、ソケット通信を利用する場合、宛先ファイル13内にIPアドレス及びポート番号を記述してもよいし、宛先ファイル13の名称自体をIPアドレス及びポート番号を表す名称にしてもよい。また、受信側プロセス1aは、UNIX(登録商標)システムで名前付きパイプ通信又はUNIXドメインソケット通信を利用する場合、通信路となる宛先ファイル13を直接生成してもよい。すなわち、受信側プロセス1aは、使用する通信形態に合う形で宛先ファイル13を生成すればよい。
When the
なお、1つのトピックに対して複数の受信側プロセス1aが受信を行う可能性がある。そのため、プロセス間通信装置では、宛先ファイル13の名称が重複しないように取り決めを行っておく必要がある。
Note that
図1では、第1のトピックに対して受信側プロセス1a-1,1a-2が受信を行い、第2のトピックに対して受信側プロセス1a-3が受信を行う場合を示している。すなわち、図1では、トピックディレクトリ12-1内に、受信側プロセス1a-1の宛先を示す宛先ファイル13-1及び受信側プロセス1a-2の宛先を示す宛先ファイル13-2が生成されている。また図1では、トピックディレクトリ12-2内に、受信側プロセス1a-3の宛先を示す宛先ファイル13-3が生成されている。
Figure 1 shows a case where receiving
送信側プロセス1bは、トピックを送信(配信)する際に、まず、通信用ディレクトリ11内に設けられたトピックディレクトリ12のうち、送信対象であるトピックに対応するトピックディレクトリ12内に生成された宛先ファイル13(のリスト)から、全ての受信側プロセス1aの宛先を特定する。そして、送信側プロセス1bは、特定した全ての宛先に、メッセージ(データ)を送信する。
When the
図1では、送信側プロセス1b-1及び送信側プロセス1b-2が第1のトピックを送信対象とし、送信側プロセス1b-3が第2のトピックを送信対象とした場合を示している。
この場合、送信側プロセス1b-1は、第1のトピックに対応するトピックディレクトリ12-1内の宛先ファイル13-1,13-2から、受信側プロセス1a-1,1a-2の宛先を特定する。そして、送信側プロセス1b-1は、特定した宛先にメッセージ(データ)を送信する。これにより、受信側プロセス1a-1,1a-2は送信側プロセス1b-1からメッセージを受信できる。
同様に、送信側プロセス1b-2は、第1のトピックに対応するトピックディレクトリ12-1内の宛先ファイル13-1,13-2から、受信側プロセス1a-1,1a-2の宛先を特定する。そして、送信側プロセス1b-2は、特定した宛先にメッセージ(データ)を送信する。これにより、受信側プロセス1a-1,1a-2は送信側プロセス1b-2からメッセージを受信できる。
また、送信側プロセス1b-3は、第2のトピックに対応するトピックディレクトリ12-2内の宛先ファイル13-3から、受信側プロセス1a-3の宛先を特定する。そして、送信側プロセス1b-3は、特定した宛先にメッセージ(データ)を送信する。これにより、受信側プロセス1a-3は送信側プロセス1b-3からメッセージを受信できる。
FIG. 1 shows a case where the
In this case, the
Similarly, the sending
The sending
なお、受信側プロセス1aは、自身のプログラムが停止する際に、トピックディレクトリ12内に生成した宛先ファイル13を削除する。これにより、動作していない受信側プロセス1aが送信側プロセス1bに通信先とみなされることがなくなる。したがって、プロセス間通信装置では、通信相手を特定せずに動的なネットワークを構成できるという、Pub-Sub通信の利点をそのまま保有することができる。
When the receiving
上記によれば、実施の形態1に係るプロセス間通信装置では、宛先ファイルシステムを利用し、トピックを受信したい受信側プロセス1aの宛先を送信側プロセス1bが特定可能とする。これにより、このプロセス間通信装置では、通信利用プロセス1同士が必要とするトピックを通信し合うようなバックグラウンド通信は必要ない。
また、実施の形態1に係るプロセス間通信装置では、送信側プロセス1bは送信データを送信する受信側プロセス1aの宛先を特定可能であり、通信は送信側プロセス1bと受信側プロセス1aが直接行う。そのため、このプロセス間通信装置では、ブローカーのような仲介プログラムを必要とせずにPub-Sub通信を行うことが可能である。すなわち、このプロセス間通信装置では、ブローカーの停止による通信不能状態は発生しない。
According to the above, the inter-process communication device according to the first embodiment uses a destination file system to enable a sending
Furthermore, in the inter-process communication device according to the first embodiment, the sending
以上のように、この実施の形態1によれば、プロセス間通信装置は、通信用ディレクトリ11内にトピック毎に設けられたトピックディレクトリ12のうち、受信対象であるトピックに対応するトピックディレクトリ12内に、自身の宛先を示す宛先ファイル13を生成する受信側プロセス1aと、トピックディレクトリ12のうち、送信対象であるトピックに対応するトピックディレクトリ12内に生成された宛先ファイル13から宛先を特定し、当該宛先にデータを送信する送信側プロセス1bとを備えた。これにより、実施の形態1に係るプロセス間通信装置は、従来に対し、バックグラウンド通信を低減可能であり且つデータの中継が不要となる。
As described above, according to this
すなわち、実施の形態1に係るプロセス間通信装置では、頻繁なバックグラウンド通信の必要がなく、データの中継が必要ないPub-Sub通信システムを実現可能である。また、このプロセス間通信装置では、通信利用プロセス1の数が増えてもCPUの負荷が小さく、特定のプログラム動作に依存しない動作が可能なPub-Sub通信システムを実現可能である。
また、実施の形態1に係るプロセス間通信装置では、Pub-Sub通信に限らず、送信相手を特定しない動的なネットワークを構成する通信システムに対して適用可能であり、上記と同様の効果が得られる。
That is, the inter-process communication device according to the first embodiment can realize a pub-sub communication system that does not require frequent background communication and does not require data relay. Also, this inter-process communication device can realize a pub-sub communication system that has a small CPU load even if the number of communication-using
Furthermore, the inter-process communication device according to the first embodiment is applicable not only to pub-sub communication but also to communication systems that configure dynamic networks that do not specify a transmission partner, and the same effects as those described above can be obtained.
実施の形態2.
図2は実施の形態2に係るプロセス間通信装置の構成例及び動作例を示す図である。この図2に示す実施の形態2に係るプロセス間通信装置は、図1に示す実施の形態1に係るプロセス間通信装置に対し、通信管理プロセス2が追加されている。図2に示す実施の形態2に係るプロセス間通信装置におけるその他の構成は、図1に示す実施の形態1に係るプロセス間通信装置と同様であり、同一の符号を付して異なる部分についてのみ説明を行う。なお、図2では、通信用ディレクトリ11の図示を省略している。
Fig. 2 is a diagram showing an example of the configuration and operation of an inter-process communication device according to
通信管理プロセス2は、プロセス間の通信を管理する。この通信管理プロセス2は、通信利用プロセス1とは別のプログラムとして起動され、動作する。
The
この通信管理プロセス2は、通信利用プロセス1からトピック及び当該トピックに対応するデータ構造が通知された場合、当該トピックが既に他の通信利用プロセス1で利用されているかを判定する。そして、通信管理プロセス2は、通知されたトピックが既に他の通信利用プロセス1で利用されていると判定した場合、当該既に他の通信利用プロセス1で利用されているトピックに対応するデータ構造と、上記通知されたデータ構造とが一致するかを判定する。そして、通信管理プロセス2は、データ構造が一致すると判定した場合、通知元である通信利用プロセス1に通信許可を通知する。一方、通信管理プロセス2は、データ構造が一致していないと判定した場合、通知元である通信利用プロセス1に通信拒否を通知する。
When this
通信管理プロセス2による上記通知方法としては、通信を使用してもよいし、共有メモリ又はファイル共有等の特定の場所にアクセスするような形態をとってもよい。
The notification method by the
なお、通信用ディレクトリ11は、通信管理プロセス2が生成するように構成されていてもよい。
The
実施の形態2における受信側プロセス1aは、自身のプログラムが起動した際、受信対象であるトピック及び当該トピックに対応するデータ構造を通信管理プロセス2に通知する(トピック使用通知)。
なお、受信側プロセス1aによる上記通知方法としては、通信を使用してもよいし、共有メモリ又はファイル共有等の特定の場所にアクセスするような形態をとってもよい。
When the receiving
The notification method by the receiving
そして、受信側プロセス1aは、通信管理プロセス2から通信許可が通知された場合、トピックディレクトリ12のうちの受信対象であるトピックに対応するトピックディレクトリ12内に宛先ファイル13を定められた形式で生成する。
一方、受信側プロセス1aは、通信管理プロセス2から通信拒否が通知された場合、通信を行わないようにする。すなわち、この場合、受信側プロセス1aは、トピックディレクトリ12のうちの受信対象であるトピックに対応するトピックディレクトリ12内に宛先ファイル13を生成しない。
When the receiving
On the other hand, the receiving
また、実施の形態2における送信側プロセス1bは、自身のプログラムが起動した際、送信対象であるトピック及び当該トピックに対応するデータ構造を通信管理プロセス2に通知する(トピック使用通知)。
なお、送信側プロセス1bによる上記通知方法としては、通信を使用してもよいし、共有メモリ又はファイル共有等の特定の場所にアクセスするような形態をとってもよい。
Furthermore, when the sending
The method of notification by the sending
そして、送信側プロセス1bは、通信管理プロセス2から通信許可が通知された場合、トピックを送信(配信)する際に、まず、トピックディレクトリ12のうちの送信対象であるトピックに対応するトピックディレクトリ12内に生成された宛先ファイル13(のリスト)から、全ての受信側プロセス1aの宛先を特定する。そして、送信側プロセス1bは、特定した全ての宛先に対し、メッセージ(データ)を送信する。
一方、送信側プロセス1bは、通信管理プロセス2から通信拒否が通知された場合、通信を行わないようにする。
Then, when the sending
On the other hand, when the sending
図2の例では、送信側プロセス1b-1が通信管理プロセス2に通知したトピック及びデータ構造に対し(符号201aに示す通知)、受信側プロセス1a-1が同じトピック及びデータ構造を通信管理プロセス2に通知し(符号201aに示す通知)、受信側プロセス1a-2が異なるトピック及びデータ構造を通信管理プロセス2に通知した場合を示している(符号201bに示す通知)。
この場合、通信管理プロセス2は、送信側プロセス1b-1及び受信側プロセス1a-1に対して通信許可を通知し(符号202aに示す通知)、受信側プロセス1a-2に対して通信拒否を通知する(符号202bに示す通知)。
これにより、受信側プロセス1a-1は、トピックディレクトリ12-1内に宛先ファイル13-1を定められた形式で生成し、送信側プロセス1b-1との間での通信を行う。一方、受信側プロセス1a-2は、通信を行わないようにする。
The example in Figure 2 shows a case in which, in response to a topic and data structure notified by a sending
In this case, the
As a result, the receiving
上記によれば、通信を管理するプログラム(通信管理プロセス2)を利用することで、通信に利用されるトピックのデータ構造を一致させ、トピック毎に想定されているデータ構造と異なるデータ構造を持つ通信データの送受信を防ぐことができる。これにより、通信ミスが防がれることから、無駄な通信がなくなり、通信量及びCPUの負荷の低減が期待できる。 As described above, by using a program that manages communications (communication management process 2), the data structures of the topics used in the communications can be made consistent, and communication data with a data structure different from the data structure expected for each topic can be prevented from being sent or received. This prevents communication errors, eliminates unnecessary communications, and is expected to reduce communication volume and CPU load.
なお上記では、説明をわかりやすくするためにデータ構造のみを用いて説明した。しかしながら、通信利用プロセス1から通信管理プロセス2に通知される情報は、データ構造のみに限らず、Pub-Sub通信の管理に必要なものを含んでいてもよい。
In the above, only data structures have been used for ease of understanding. However, the information notified from the
また、通信管理プロセス2からの通知に、通信利用プロセス1に対する通信管理に必要な情報を含めてもよい。例えば、宛先ファイルシステムを使用する方法では、宛先ファイル13の名称が重複して宛先ファイル13が上書きされて通信ができなくなる可能性がある。しかしながら、通信管理プロセス2を利用することで解決することができる。
すなわち、受信側プロセス1aからトピック使用通知を受けた際に、許可応答を行う場合には、通信管理プロセス2は、既存の受信側プロセス1aが生成した宛先ファイル13の名称と重複しない名称を通知する。そして、受信側プロセス1aは、通信管理プロセス2から通知された名称で宛先ファイル13を生成する。また、拒否応答を行う場合には、通信管理プロセス2は、宛先ファイル13の名称を通知しないようにして、受信側プロセス1aに宛先ファイル13を作ることができないようにすることで、許可されていない通信を行わせないようにすることができる。
Furthermore, the notification from the
That is, when a permission response is made upon receiving a topic usage notification from the receiving
また、トピックディレクトリ12を通信管理プロセス2に生成させるようにし、トピックディレクトリ名を通信管理プロセス2が何らかの変換を施した状態で生成するようにして、トピック使用通知を受信した際の許可応答として、変換済みのトピックディレクトリ名を通知してもよい。これによっても、許可されていない通信を行わせないようにすることもできる。
Alternatively, the topic directory 12 may be generated by the
実施の形態3.
実施の形態1,2では、宛先ファイルシステムを利用して、受信側プロセス1aの宛先を示す宛先ファイル13を用意するようにしている。
一方、この宛先ファイル13をトピックディレクトリ12に設置した状態で、受信側プロセス1aが異常終了した場合、宛先ファイル13は削除されずに残り続けてしまう。この場合、送信側プロセス1bはデータを送信する際に、異常終了した受信側プロセス1aにもデータを送ろうとすることになる。そこで、これを回避する手法について説明する。
In the first and second embodiments, the destination file system is used to prepare the destination file 13 indicating the destination of the receiving
On the other hand, if the
図3は実施の形態3に係るプロセス間通信装置の構成例及び動作例を示す図である。図3に示す実施の形態3に係るプロセス間通信装置は、図1に示す実施の形態1に係るプロセス間通信装置に対して通信管理プロセス2を追加している。図3に示す実施の形態3に係るプロセス間通信装置におけるその他の構成は図1に示す実施の形態1に係るプロセス間通信装置と同様であり、同一の符号を付し、異なる部分についてのみ説明を行う。なお、図3では、通信用ディレクトリ11の図示を省略している。
Figure 3 is a diagram showing an example of the configuration and operation of an inter-process communication device according to
通信管理プロセス2は、プロセス間の通信を管理する。通信管理プロセス2は、通信利用プロセス1とは別プログラムとして動作し、通信利用プロセス1の生存状態を監視する。
すなわち、通信管理プロセス2は、通信利用プロセス1から通知されたプロセス情報を保持し、定期的にオペレーティングシステムの機能を用いて通信利用プロセス1の動作状態を確認する。
The
That is, the
そして、通信管理プロセス2は、通信利用プロセス1が異常終了したと判定した場合、当該通信利用プロセス1が受信側プロセス1aであれば、その受信側プロセス1aが使用していた宛先ファイル13を削除する。これにより、通信管理プロセス2は、送信側プロセス1bに異常終了した受信側プロセス1aを宛先として認識させないようにすることができる。
When the
実施の形態3における受信側プロセス1aは、自身のプログラムが起動した際に、自身のプロセス情報(例えばUNIX系のオペレーティングシステムであれば、プロセスID等)を通信管理プロセス2に通知する。またこの際、受信側プロセス1aは、使用する宛先ファイル13の宛先ファイル名も通信管理プロセス2に通知する。
その後、受信側プロセス1aは、定期的に、自身のプロセス情報を通信管理プロセス2に通知する。
また、受信側プロセス1aは、自身のプログラムが正常に停止する際に、自身のプロセス情報及び通信停止を通信管理プロセス2に通知する。またこの際、受信側プロセス1aは、宛先ファイル13を削除してからプログラムを終了する。
When the receiving
Thereafter, the receiving
Furthermore, when the receiving
また、実施の形態3における送信側プロセス1bは、自身のプログラムが起動した際に、自身のプロセス情報(例えばUNIX系のオペレーティングシステムであれば、プロセスID等)を通信管理プロセス2に通知する。
その後、送信側プロセス1bは、定期的に、自身のプロセス情報を通信管理プロセス2に通知する。
また、送信側プロセス1bは、自身のプログラムが正常に停止する際に、通信管理プロセス2にプロセス情報及び通信停止を通知する。
Furthermore, the transmitting
Thereafter, the sending
Furthermore, when the
図3では、通信管理プロセス2が、通信利用プロセス1-1,1-2からプロセス情報の通知を受けることで、通信利用プロセス1-1,1-2の生存状態を監視している。この場合において、通信利用プロセス1-2が異常終了した場合、通信管理プロセス2は、受信側プロセス1a-2の宛先を示す宛先ファイル13-2を削除する。
In FIG. 3, the
上記によれば、このようにすることで、受信側プロセス1aが異常終了した場合にも、無駄な通信動作を発生させないようにすることができる。これにより、通信量の低減が期待できる。
As described above, by doing this, it is possible to prevent unnecessary communication operations from occurring even if the
また、通信管理プロセス2は、受信側プロセス1aから起動時のプロセス情報が通知された際、当該受信側プロセス1aが生成する宛先ファイル名を当該受信側プロセス1aに通知するようにしてもよい。この場合、受信側プロセス1aは、宛先ファイル名を通信管理プロセス2に通知する必要はなくなる。
In addition, when the
なお上記では、実施の形態1に係るプロセス間通信装置に上記機能を追加した場合を示した。しかしながら、これに限らず、実施の形態2に係るプロセス間通信装置に上記機能を追加してもよく、上記と同様の効果が得られる。 In the above, the case where the above function is added to the inter-process communication device according to the first embodiment is shown. However, this is not limited to the above case, and the above function may be added to the inter-process communication device according to the second embodiment, and the same effect as above can be obtained.
なお、本願発明はその発明の範囲内において、各実施の形態の自由な組合わせ、或いは各実施の形態の任意の構成要素の変形、若しくは各実施の形態において任意の構成要素の省略が可能である。 In addition, within the scope of the present invention, it is possible to freely combine the various embodiments, modify any of the components of each embodiment, or omit any of the components of each embodiment.
1 通信利用プロセス
1a 受信側プロセス
1b 送信側プロセス
2 通信管理プロセス
11 通信用ディレクトリ
12 トピックディレクトリ
13 宛先ファイル
1
Claims (6)
前記トピックディレクトリのうち、送信対象であるトピックに対応したトピックディレクトリ内に生成された宛先ファイルから宛先を特定し、当該宛先にデータを送信する送信側プロセスと
を備えたプロセス間通信装置。 a receiving process that generates a destination file indicating its own destination in a topic directory corresponding to a topic to be received, among topic directories provided for each topic in a communication directory;
a sending process that identifies a destination from a destination file created in a topic directory corresponding to a topic to be sent among the topic directories, and sends data to the destination.
ことを特徴とする請求項1記載のプロセス間通信装置。 2. The inter-process communication device according to claim 1, further comprising a communication management process that detects an abnormal termination based on process information notified from the receiving process and the sending process, and if the process that detected the abnormal termination is the receiving process, deletes a destination file indicating the destination of the receiving process.
前記受信側プロセスは、前記通信管理プロセスに受信対象であるトピック及び当該トピックに対応するデータ構造を通知し、当該通信管理プロセスから通信許可が通知された場合、トピックディレクトリ内に宛先ファイルを生成し、
前記送信側プロセスは、前記通信管理プロセスに送信対象であるトピック及び当該トピックに対応するデータ構造を通知し、当該通信管理プロセスから通信許可が通知された場合、トピックディレクトリ内に生成された宛先ファイルから宛先を特定し、当該宛先にデータを送信する
ことを特徴とする請求項1記載のプロセス間通信装置。 a communication management process that, when a topic and a data structure corresponding to the topic are notified and it is determined that the data structure matches a data structure corresponding to the topic used in a process other than the process that is the notification source, notifies the notification source of communication permission;
The receiving process notifies the communication management process of a topic to be received and a data structure corresponding to the topic, and when communication permission is received from the communication management process, creates a destination file in a topic directory;
2. The inter-process communication device according to claim 1, wherein the sending process notifies the communication management process of the topic to be transmitted and the data structure corresponding to the topic, and when the communication management process notifies the sending process of permission to communicate, identifies a destination from a destination file generated in a topic directory and transmits data to the destination.
ことを特徴とする請求項3記載のプロセス間通信装置。 4. The inter-process communication device according to claim 3, wherein the communication management process detects an abnormal termination based on process information notified from the receiving process and the sending process, and if the process that detected the abnormal termination is the receiving process, deletes a destination file indicating the destination of the receiving process.
送信側プロセスが、前記トピックディレクトリのうち、送信対象であるトピックに対応したトピックディレクトリ内に生成された宛先ファイルから宛先を特定し、当該宛先にデータを送信するステップと
を有するプロセス間通信方法。 A receiving process generates a destination file indicating its own destination in a topic directory corresponding to a topic to be received, among topic directories provided for each topic in a communication directory;
a sending process identifying a destination from a destination file created in a topic directory corresponding to the topic to be sent from among said topic directories, and sending data to the destination.
送信側プロセスが、前記トピックディレクトリのうち、送信対象であるトピックに対応したトピックディレクトリ内に生成された宛先ファイルから宛先を特定し、当該宛先にデータを送信するステップと
をコンピュータに実行させるためのプロセス間通信プログラム。 A receiving process generates a destination file indicating its own destination in a topic directory corresponding to a topic to be received, among topic directories provided for each topic in a communication directory;
a sending process identifying a destination from a destination file created in a topic directory corresponding to the topic to be sent among the topic directories, and sending data to the destination.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2021011583A JP7580284B2 (en) | 2021-01-28 | Inter-process communication device, inter-process communication method, and inter-process communication program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2021011583A JP7580284B2 (en) | 2021-01-28 | Inter-process communication device, inter-process communication method, and inter-process communication program |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2022115124A JP2022115124A (en) | 2022-08-09 |
JP7580284B2 true JP7580284B2 (en) | 2024-11-11 |
Family
ID=
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2015230603A (en) | 2014-06-05 | 2015-12-21 | 東芝テック株式会社 | Information processing device and information processing program |
WO2018190015A1 (en) | 2017-04-12 | 2018-10-18 | ソニー株式会社 | Information processing device, information processing method, and computer program |
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2015230603A (en) | 2014-06-05 | 2015-12-21 | 東芝テック株式会社 | Information processing device and information processing program |
WO2018190015A1 (en) | 2017-04-12 | 2018-10-18 | ソニー株式会社 | Information processing device, information processing method, and computer program |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP4503225B2 (en) | Virtual network with adaptive dispatcher | |
US6891837B1 (en) | Virtual endpoint | |
US7529823B2 (en) | Notifications for shared resources | |
US8010973B2 (en) | Class loader for managing a network | |
JP4661774B2 (en) | Relay server | |
JP2005316993A (en) | System and method for sharing object between computers over network | |
CN103562882A (en) | System and method for providing a messaging application program interface | |
JP2004519024A (en) | System and method for managing a cluster containing multiple nodes | |
CN112202615B (en) | Multi-CNI cooperative work system and method | |
WO2009097776A1 (en) | System, device and method for achieving service upgrade | |
BR112014014592B1 (en) | MESSAGE EXCHANGE PROCESS BETWEEN CLIENT TASKS OF THE SAME SOFTWARE BUS | |
US6119173A (en) | System and method for communications and process management in a distributed telecommunications switch | |
US20040199647A1 (en) | Method and system for preventing unauthorized action in an application and network management software environment | |
JP2005531856A (en) | Windows Management Measurement Synchronization Repository Provider | |
KR20040074922A (en) | Software development environment | |
CN113645251B (en) | Data transmission method and device suitable for cross-regional service | |
JP7580284B2 (en) | Inter-process communication device, inter-process communication method, and inter-process communication program | |
KR20100112066A (en) | Method and system for restricting the execution of open services gateway initiative life cycle commands | |
JP2022115124A (en) | Communication device between processes, communication method between processes, and communication program between processes | |
KR20080058409A (en) | Endpoint transparent independent messaging scheme system and method | |
US7428589B2 (en) | Network system, network control method, and signal sender/receiver | |
Retz | Operating system design considerations for the packet-switching environment | |
US20240320048A1 (en) | Information processing method and an apparatus | |
CN115208739B (en) | Cross-multi-network-area docking method and method for docking one-way network areas in safe operation and maintenance areas | |
CN114945023B (en) | Network connection multiplexing method, device, equipment and medium |