version 1.7, 2000/09/09 16:32:26 |
version 1.12, 2020/03/14 01:21:56 |
|
|
%% $OpenXM: OpenXM/doc/OpenXM-specs/communication-model.tex,v 1.6 2000/01/24 02:48:24 noro Exp $ |
%% $OpenXM: OpenXM/doc/OpenXM-specs/communication-model.tex,v 1.11 2016/08/28 02:43:13 takayama Exp $ |
//&jp \section{ OpenXM の通信モデル} |
//&jp \section{ OpenXM 篆<≪} |
//&eg \section{ Communication model of OpenXM} |
//&eg \section{ Communication model of OpenXM} |
|
|
/*&jp |
/*&jp |
われわれは, 数学プロセスがメッセージを |
, 医祉鴻<祉若吾 |
交換しながら計算が進行していくというモデルを想定して設計をすすめている. |
篋ゆ荐膊画≪喝荐荐. |
各プロセスはスタックマシンであり, これを OX スタックマシンとよぶ. |
祉鴻鴻帥激潟с, OX 鴻帥激潟. |
数学プロセスの間の通信路の確保の仕方としては以下のように |
医祉鴻篆∴君腆坂篁鴻篁ヤ |
いろいろな実現方法を想定している. |
絎憝号喝. |
\begin{enumerate} |
\begin{enumerate} |
\item ファイルを介して通信する. |
\item <ゃ篁篆<. |
\item Library として直接リンクして通信する. |
\item Library 贋・潟篆<. |
\item TCP/IP ソケットの利用. |
\item TCP/IP 純宴. |
\item Remote Procedure call の利用. |
\item Remote Procedure call . |
\item JAVA RMI. |
\item JAVA RMI. |
\item マルチスレッドの利用. |
\item 鴻. |
\item PVM ライブラリの利用. |
\item PVM ゃ. |
\item MPI ライブラリの利用. |
\item MPI ゃ. |
\end{enumerate} |
\end{enumerate} |
|
|
通信とはプロセス間のメッセージのやりとりである. |
篆<祉拷<祉若吾с. |
メッセージは論理的に次のような構造をもつ: |
<祉若吾茫罨<罕: |
*/ |
*/ |
/*&eg |
/*&eg |
In our model of computation, mathematical processes proceed |
In our model of computation, mathematical processes proceed |
Line 53 A message has the following structure: |
|
Line 53 A message has the following structure: |
|
\end{center} |
\end{center} |
*/ |
*/ |
/*&jp |
/*&jp |
このメッセージを, OX message (OpenXM message object) とよぶ. |
<祉若吾, OX message (OpenXM message object) . |
OX Message はトップレベルのメッセージ object であり, |
OX Message <祉若 object с, |
仕様書では, さまざまなグループに属する object が登場する. |
篁罕吾с, 障障違若絮 object 糸眼. |
グループ名は, たとえば, OX Message/TCPIP/Primitive などと書く. |
違若, , OX Message/TCPIP/Primitive 吾. |
{\tt message\_body} の部分の仕様は, OX Message |
{\tt message\_body} 篁罕, OX Message |
の上位に位置する部分であり, SMobject または CMObject がくる. |
筝篏篏臀с, SMobject 障 CMObject . |
これらの object はタグをもち, そのタグ定数は {\tt SM\_} または |
object 帥違, 帥医違 {\tt SM\_} 障 |
{\tt CMO\_} ではじまる. |
{\tt CMO\_} с障. |
SMobject は, スタックマシンコマンドメッセージ object であり, |
SMobject , 鴻帥激潟潟潟<祉若 object с, |
やはり, グループ分けされている. |
, 違若. |
各グループ名は, |
違若, |
SMobject/Primitive, SMobject/Basic などと書く. |
SMobject/Primitive, SMobject/Basic 吾. |
SMobject の構造は |
SMobject 罕 |
サーバスタックマシンの節で詳しく説明する. |
泣若鴻帥激潟膀ц潟顄. |
CMObject についてはすでに Primitive の CMObject の説明をしたが, |
CMObject ゃс Primitive CMObject 茯, |
あとで CMObject レベル 1の説明をする. |
CMObject 1茯. |
OX Message の |
OX Message |
{\tt ox message\_tag} の定数は {\tt OX\_} で始まる. |
{\tt ox message\_tag} 絎違 {\tt OX\_} у障. |
*/ |
*/ |
/*&eg |
/*&eg |
We call it an OX message (OpenXM message object). |
We call it an OX message (OpenXM message object). |
Line 89 The details of SMobjects will be explained in Section |
|
Line 89 The details of SMobjects will be explained in Section |
|
We have already explained the Primitive CMObjects. |
We have already explained the Primitive CMObjects. |
We will describe the Basic CMObjects in Section \ref{sec:basic1}. |
We will describe the Basic CMObjects in Section \ref{sec:basic1}. |
*/ |
*/ |
//&jp \subsection{ OX Message の 表現方法 } |
//&jp \subsection{ OX Message 茵憝号 } |
//&eg \subsection{ OX Messages } |
//&eg \subsection{ OX Messages } |
|
|
/*&jp |
/*&jp |
OpenXM で各プロセスは |
OpenXM у祉鴻 |
\begin{center} |
\begin{center} |
(OXexpression を理解するスタックマシン) $+$ (xxx 言語で動くエンジン) |
(OXexpression 茹c鴻帥激) $+$ (xxx 荐茯у潟吾) |
\end{center} |
\end{center} |
なるハイブリッド構成である. |
ゃ罕с. |
このプロセスを, OX スタックマシンと呼ぶ. |
祉鴻, OX 鴻帥激潟若. |
ここでは, OX スタックマシンとやりとりするメッセージである, |
с, OX 鴻帥激潟<祉若吾с, |
OX Message を表現するための OXexpression, および, |
OX Message 茵憗 OXexpression, , |
スタックマシンの operator に対応する, SMobject を表現するための SMexpression |
鴻帥激潟 operator 絲上, SMobject 茵憗 SMexpression |
を定義しよう. |
絎臂. |
OX Message を スタックマシンコマンド, |
OX Message 鴻帥激潟潟潟, |
SMobject を スタックマシンオペレータともよぶ. |
SMobject 鴻帥激潟若帥. |
*/ |
*/ |
|
|
/*&eg |
/*&eg |
Line 116 Here we introduce OXexpression and SMexpression |
|
Line 116 Here we introduce OXexpression and SMexpression |
|
to express OX messages and SM objects respectively. |
to express OX messages and SM objects respectively. |
*/ |
*/ |
|
|
|
//&jp \subsubsection{ OX <祉若吾茵憝 (Lisp 蘂) } |
|
//&eg \subsubsection{ Expressions of OX messages (Lisp like) } |
/*&C |
/*&C |
\begin{eqnarray*} |
\begin{eqnarray*} |
\mbox{OXexpression} |
\mbox{OXexpression} |
Line 131 to express OX messages and SM objects respectively. |
|
Line 133 to express OX messages and SM objects respectively. |
|
\end{eqnarray*} |
\end{eqnarray*} |
*/ |
*/ |
/*&jp |
/*&jp |
expression の各要素を区切るために {\tt ,} (コンマ) を用いてもよい. |
expression 荀膣阪 {\tt ,} (潟潟) . |
{\tt OX\_tag} は {\tt OX\_} で始まる定数である. |
{\tt OX\_tag} {\tt OX\_} у障絎違с. |
{\tt SM\_tag} は {\tt SM\_} で始まるスタックマシンオペレータを識別する定数である. |
{\tt SM\_tag} {\tt SM\_} у障鴻帥激潟若帥茘ャ絎違с. |
発信元 AAA, 受信先 BBB を書く必要があるときは, |
坂拭 AAA, 篆≦ BBB 吾鏆荀, |
From AAA, To BBB, を OXexpression の前に書く. |
From AAA, To BBB, OXexpression 吾. |
必要なければ省略する. |
綽荀亥ャ. |
|
|
たとえば, あとで説明する, CMO string ``Hello'' を スタックにプッシュする |
, ц, CMO string ``Hello'' 鴻帥激ャ |
表現は次のように書く: |
茵憗罨<吾: |
*/ |
*/ |
|
|
/*&eg |
/*&eg |
Line 166 a local function ``hoge''. |
|
Line 168 a local function ``hoge''. |
|
|
|
/*&C |
/*&C |
\begin{center} |
\begin{center} |
(OX\_DATA, (CMO\_STRING, 5, "hoge")) |
(OX\_DATA, (CMO\_STRING, 4, "hoge")) |
\end{center} |
\end{center} |
\begin{center} |
\begin{center} |
(OX\_COMMAND, SM\_executeStringByLocalParser) |
(OX\_COMMAND, SM\_executeStringByLocalParser) |
Line 174 a local function ``hoge''. |
|
Line 176 a local function ``hoge''. |
|
*/ |
*/ |
|
|
/*&jp |
/*&jp |
標準エンコード法では, それぞれのタグは 32 bit (4 bytes) の |
罔羣潟潟若羈с, 帥違 32 bit (4 bytes) |
ネットワークバイトオーダでの整数として表現される. |
若ゃ若с贋違茵憗. |
*/ |
*/ |
/*&eg |
/*&eg |
In our standard encoding method, each tag is expressed as |
In our standard encoding method, each tag is expressed as |
Line 186 a 32 bit (4 bytes) integer with the network byte order |
|
Line 188 a 32 bit (4 bytes) integer with the network byte order |
|
|
|
*/ |
*/ |
|
|
|
//&jp \subsubsection{ OX <祉若吾茵 (XML) } |
|
//&eg \subsubsection{ Expression of OX messages (XML) } |
|
|
/*&jp |
/*&jp |
OX メッセージは XML で表現することも可能である. 次に例を示す. |
OX <祉若吾 XML ц;憗純с. 罨<箴腓冴. |
*/ |
*/ |
/*&eg |
/*&eg |
OX messages can be expressed by XML. The following is an example. |
OX messages can be expressed by XML. The following is an example. |
Line 211 OX messages can be expressed by XML. The following is |
|
Line 216 OX messages can be expressed by XML. The following is |
|
\end{verbatim} |
\end{verbatim} |
*/ |
*/ |
|
|
//&jp \subsection{OXexpression の 標準 encoding と TCP/IP ソケットによる実装法} |
//&jp \subsection{OXexpression 罔羣 encoding TCP/IP 純宴絎茖羈} |
//&eg \subsection{Standard encoding of OXexpressions and an implementation by TCP/IP sockets} |
//&eg \subsection{Standard encoding of OXexpressions and an implementation by TCP/IP sockets} |
/*&jp |
/*&jp |
通信の実現方法は通信路のとりかたによりかわるが, |
篆<絎憝号篆∴君, |
論理構造は統一的にあつかわないといけない. |
茫罕腟延ゃ. |
OXexpression はその論理構造を記述している. |
OXexpression 茫罕荐菴違. |
|
|
ここでは OXexpression の標準 encoding の概略を説明する. |
с OXexpression 罔羣 encoding 网ャ茯. |
この encoding 法はTCP/IP ソケット用の encoding 法として |
encoding 羈TCP/IP 純宴 encoding 羈 |
現在存在しているサーバに使用されている. |
憜絖泣若篏睡. |
さらにOX スタックマシンの計算状態を制御するための, コントロールメッセージに |
OX 鴻帥激潟荐膊倶九勝, 潟潟若<祉若吾 |
ついても説明する. |
ゃ茯. |
|
|
|
|
{\tt destination}, {\tt origin} の部分は, ソケットによる |
{\tt destination}, {\tt origin} , 純宴 |
peer to peer の接続なので省略する. |
peer to peer ・膓хャ. |
{\tt extension} フィールドは |
{\tt extension} c若 |
{\tt message\_tag} フィールドの次にくる. |
{\tt message\_tag} c若罨<. |
{\tt extension} フィールドは OX パケットのシリアル番号がはいる. |
{\tt extension} c若 OX 宴激≪垩. |
シリアル番号は {\tt int32} である. |
激≪垩 {\tt int32} с. |
この番号は, サーバがエラーを起こした場合, エラーをおこした, |
垩, 泣若若莎激翫, 若, |
OX パケットの番号を戻すのに主に利用される. |
OX 宴垩祉筝祉. |
以下 {\tt extension} フィールドは, {\tt message\_tag} の |
篁ヤ {\tt extension} c若, {\tt message\_tag} |
に含まれると理解し {\tt extension} フィールドは省略する. |
障茹c {\tt extension} c若ャ. |
したがってパケットは |
c宴 |
次のように記述する |
罨<荐菴違 |
*/ |
*/ |
|
|
/*&eg |
/*&eg |
Line 266 Thus OX messages are represented as follows. |
|
Line 271 Thus OX messages are represented as follows. |
|
\end{tabular} |
\end{tabular} |
\end{center} |
\end{center} |
*/ |
*/ |
//&jp \noindent が, もっとこまかく見ると, |
//&jp \noindent , c障頳, |
//&eg \noindent More precisely it has the following representation. |
//&eg \noindent More precisely it has the following representation. |
/*&C |
/*&C |
\begin{center} |
\begin{center} |
Line 279 Thus OX messages are represented as follows. |
|
Line 284 Thus OX messages are represented as follows. |
|
*/ |
*/ |
/*&jp |
/*&jp |
\noindent |
\noindent |
となっている. |
c. |
|
|
グループ OX Message/TCPIP/Primitive の |
違若 OX Message/TCPIP/Primitive |
{\tt ox message\_tag} としては次のものが用意されている. |
{\tt ox message\_tag} 罨<. |
*/ |
*/ |
//&eg \noindent As {\tt ox message\_tag} the following are provided. |
//&eg \noindent As {\tt ox message\_tag} the following are provided. |
|
|
Line 298 Thus OX messages are represented as follows. |
|
Line 303 Thus OX messages are represented as follows. |
|
#define OX_DATA_MP 525 |
#define OX_DATA_MP 525 |
|
|
#define OX_SYNC_BALL 515 |
#define OX_SYNC_BALL 515 |
|
#define OX_NOTIFY 516 |
\end{verbatim} |
\end{verbatim} |
*/ |
*/ |
|
|
/*&jp |
/*&jp |
通信路は 2 つ用意する. |
篆∴君 2 ょ. |
1番目の通信路は |
1篆∴君 |
\verb+ OX_COMMAND + |
\verb+ OX_COMMAND + |
および |
|
\verb+ OX_DATA + |
\verb+ OX_DATA + |
がながれる. |
. |
2番目の通信路 ({\tt control}と呼ぶ) には, |
2篆∴君 ({\tt control}若) , |
\verb+ OX_COMMAND + およびそれに続くコントロールコマンド |
\verb+ OX_COMMAND + 潟膓潟潟若潟潟 |
\verb+ SM_control_* + |
\verb+ SM_control_* + |
またはコントロール関係のデータ, つまり header |
障潟潟若≫若, ゃ障 header |
\verb+ OX_DATA + ではじまりそれに続く CMO データ |
\verb+ OX_DATA + с障膓 CMO 若 |
がながれる. |
. |
これらをコントロールメッセージおよびコントロールメッセージの結果 |
潟潟若<祉若吾潟潟潟若<祉若吾腟 |
メッセージと呼ぶ. |
<祉若吾若. |
サンプルサーバでは, この 2 つの通信路を, 2 つのポートを用いて |
泣潟泣若с, 2 ゃ篆∴君, 2 ゃ若 |
実現している. |
絎憗. |
|
|
|
|
\verb+ OX_COMMAND + メッセージは次の形のパケットで表現される: \\ |
\verb+ OX_COMMAND + <祉若吾罨<綵≪宴ц;憗: \\ |
*/ |
*/ |
/*&eg |
/*&eg |
Two streams are provided for communication between a client and a server. |
Two streams are provided for communication between a client and a server. |
Line 344 The stack machine command message has the following fo |
|
Line 350 The stack machine command message has the following fo |
|
\\ |
\\ |
*/ |
*/ |
|
|
//&jp \verb+ OX_DATA + メッセージは次の形のパケットで表現される: \\ |
//&jp \verb+ OX_DATA + <祉若吾罨<綵≪宴ц;憗: \\ |
//&eg CMO data message has the following form:\\ |
//&eg CMO data message has the following form:\\ |
/*&C |
/*&C |
\begin{tabular}{|c|c|} |
\begin{tabular}{|c|c|} |
Line 355 The stack machine command message has the following fo |
|
Line 361 The stack machine command message has the following fo |
|
({\tt OX\_DATA}, {\sl CMObject} data) |
({\tt OX\_DATA}, {\sl CMObject} data) |
\\ |
\\ |
*/ |
*/ |
//&jp コントロールメッセージは次の形のパケットで表現される: \\ |
//&jp 潟潟若<祉若吾罨<綵≪宴ц;憗: \\ |
//&eg The control message has the following form:\\ |
//&eg The control message has the following form:\\ |
/*&C |
/*&C |
\begin{tabular}{|c|c|} |
\begin{tabular}{|c|c|} |
Line 366 The stack machine command message has the following fo |
|
Line 372 The stack machine command message has the following fo |
|
\\ |
\\ |
*/ |
*/ |
/*&jp |
/*&jp |
コントロールメッセージは, 計算を中断したい, debug 用の スレッドを起動する, |
潟潟若<祉若吾, 荐膊筝, debug 鴻莎桁, |
debug モードを抜けたい, などの用途に利用する. |
debug ≪若, . |
*/ |
*/ |
/*&eg |
/*&eg |
The control message is used to interrupt a computation, to invoke |
The control message is used to interrupt a computation, to invoke |
debugging threads, or to exit form the debugging mode. |
debugging threads, or to exit form the debugging mode. |
*/ |
*/ |
|
|
//&jp コントロールメッセージの結果メッセージは次の形のパケットで表現される: \\ |
//&jp 潟潟若<祉若吾腟<祉若吾罨<綵≪宴ц;憗: \\ |
//&eg The result of a control message has the following form:\\ |
//&eg The result of a control message has the following form:\\ |
/*&C |
/*&C |
\begin{tabular}{|c|c|l|} |
\begin{tabular}{|c|c|l|} |
Line 388 debugging threads, or to exit form the debugging mode. |
|
Line 394 debugging threads, or to exit form the debugging mode. |
|
|
|
/*&jp |
/*&jp |
{\tt int32 function\_id} |
{\tt int32 function\_id} |
の部分に, サーバスタックマシン の operator に対応する番号がはいる. |
, 泣若鴻帥激 operator 絲上垩. |
グループ SMobject/Primitive および SMobject/Basic に属する |
違若 SMobject/Primitive SMobject/Basic 絮 |
タグとして以下のものがある. |
帥違篁ヤ. |
*/ |
*/ |
/*&eg |
/*&eg |
{\tt int32 function\_id} is the value of a stack machine command. |
{\tt int32 function\_id} is the value of a stack machine command. |
Line 418 values are as follows. |
|
Line 424 values are as follows. |
|
#define SM_getsp 275 |
#define SM_getsp 275 |
#define SM_dupErrors 276 |
#define SM_dupErrors 276 |
|
|
|
#define SM_nop 300 /* do nothing */ |
|
|
#define SM_control_kill 1024 |
#define SM_control_kill 1024 |
#define SM_control_reset_connection 1030 |
#define SM_control_reset_connection 1030 |
\end{verbatim} |
\end{verbatim} |
*/ |
*/ |
|
|
//&jp \noindent たとえば, |
//&jp \noindent , |
//&eg \noindent For example |
//&eg \noindent For example |
/*&C |
/*&C |
\begin{center} |
\begin{center} |
(OX\_COMMAND, SM\_pops) |
(OX\_COMMAND, SM\_pops) |
\end{center} |
\end{center} |
*/ |
*/ |
//&jp \noindent は |
//&jp \noindent |
//&eg \noindent is encoded as follows. |
//&eg \noindent is encoded as follows. |
/*&C |
/*&C |
\begin{center} |
\begin{center} |
Line 442 values are as follows. |
|
Line 449 values are as follows. |
|
\end{tabular} |
\end{tabular} |
\end{center} |
\end{center} |
*/ |
*/ |
//&jp とエンコードされる. |
//&jp 潟潟若. |
|
|
/*&jp |
/*&jp |
operator の詳細は次の節で説明する. |
operator 荅括完罨<膀ц. |
これらの定数の名前はインプリメントのとき短縮形で表現してもよい. |
絎違ゃ潟<潟膰綵≪ц;憗. |
*/ |
*/ |
/*&eg |
/*&eg |
The details of the operators are described in Section \ref{sec:stackmachine}. |
The details of the operators are described in Section \ref{sec:stackmachine}. |