version 1.1, 2000/01/20 08:52:46 |
version 1.8, 2000/09/09 21:59:13 |
|
|
%% $OpenXM$ |
%% $OpenXM: OpenXM/doc/OpenXM-specs/communication-model.tex,v 1.7 2000/09/09 16:32:26 takayama Exp $ |
//&jp \section{ Open XM の通信モデル} |
//&jp \section{ OpenXM の通信モデル} |
//&eg \section{ Communication model of Open XM} (This part has not yet been translated) |
//&eg \section{ Communication model of OpenXM} |
|
|
/*&jp |
/*&jp |
われわれは, 数学プロセスがメッセージを |
われわれは, 数学プロセスがメッセージを |
|
|
\item Library として直接リンクして通信する. |
\item Library として直接リンクして通信する. |
\item TCP/IP ソケットの利用. |
\item TCP/IP ソケットの利用. |
\item Remote Procedure call の利用. |
\item Remote Procedure call の利用. |
|
\item JAVA RMI. |
\item マルチスレッドの利用. |
\item マルチスレッドの利用. |
\item PVM ライブラリの利用. |
\item PVM ライブラリの利用. |
\item MPI ライブラリの利用. |
\item MPI ライブラリの利用. |
|
|
メッセージは論理的に次のような構造をもつ: |
メッセージは論理的に次のような構造をもつ: |
*/ |
*/ |
/*&eg |
/*&eg |
In our model of comutation, mathematical processes proceed |
In our model of computation, mathematical processes proceed |
a computation by exchanging messages. Each process is a stack machine, |
a computation by exchanging messages. Each process is a stack machine, |
which is called an OX stack machine. |
which is called an OX stack machine. |
The following method are possible to realize communications between |
The following methods are possible to realize communications between |
mathematical processes. |
mathematical processes. |
\begin{enumerate} |
\begin{enumerate} |
\item Communication by files. |
\item Communication by files. |
\item Linking as a subroutine library. |
\item Linking as a subroutine library. |
\item TCP/IP streams. |
\item TCP/IP streams. |
\item Remote Procedure call. |
\item Remote Procedure call. |
\item Muitithread. |
\item JAVA RMI. |
|
\item Multi-thread. |
\item PVM library. |
\item PVM library. |
\item MPI library. |
\item MPI library. |
\end{enumerate} |
\end{enumerate} |
|
|
In OpenXM Communication is exechange of messages between processes. |
In OpenXM communication means exchange of messages between processes. |
A message has the following structure: |
A message has the following structure: |
*/ |
*/ |
/*&C |
/*&C |
Line 51 A message has the following structure: |
|
Line 53 A message has the following structure: |
|
\end{center} |
\end{center} |
*/ |
*/ |
/*&jp |
/*&jp |
このメッセージを, OX Message (Open XM message object) とよぶ. |
このメッセージを, OX message (OpenXM message object) とよぶ. |
OX Message はトップレベルのメッセージ object であり, |
OX Message はトップレベルのメッセージ object であり, |
仕様書では, さまざまなグループに属する object が登場する. |
仕様書では, さまざまなグループに属する object が登場する. |
グループ名は, たとえば, OX Message/TCPIP/Basic0 などと書く. |
グループ名は, たとえば, OX Message/TCPIP/Primitive などと書く. |
{\tt message\_body} の部分の仕様は, OX Message |
{\tt message\_body} の部分の仕様は, OX Message |
の上位に位置する部分であり, SMobject または CMObject がくる. |
の上位に位置する部分であり, SMobject または CMObject がくる. |
これらの object はタグをもち, そのタグ定数は {\tt SM\_} または |
これらの object はタグをもち, そのタグ定数は {\tt SM\_} または |
Line 62 OX Message はトップレベルのメッセージ object であり, |
|
Line 64 OX Message はトップレベルのメッセージ object であり, |
|
SMobject は, スタックマシンコマンドメッセージ object であり, |
SMobject は, スタックマシンコマンドメッセージ object であり, |
やはり, グループ分けされている. |
やはり, グループ分けされている. |
各グループ名は, |
各グループ名は, |
SMobject/Basic0, SMobject/Basic1 などと書く. |
SMobject/Primitive, SMobject/Basic などと書く. |
SMobject の構造は |
SMobject の構造は |
サーバスタックマシンの節で詳しく説明する. |
サーバスタックマシンの節で詳しく説明する. |
CMObject についてはすでに Basic0 の CMObject の説明をしたが, |
CMObject についてはすでに Primitive の CMObject の説明をしたが, |
あとで CMObject レベル 1の説明をする. |
あとで CMObject レベル 1の説明をする. |
OX Message の |
OX Message の |
{\tt ox message\_tag} の定数は {\tt OX\_} で始まる. |
{\tt ox message\_tag} の定数は {\tt OX\_} で始まる. |
|
|
このメッセージを, OX Message (Open XM message object) とよぶ. |
|
OX Message はトップレベルのメッセージ object であり, |
|
仕様書では, さまざまなグループに属する object が登場する. |
|
グループ名は, たとえば, OX Message/TCPIP/Basic0 などと書く. |
|
{\tt message\_body} の部分の仕様は, OX Message |
|
の上位に位置する部分であり, SMobject または CMObject がくる. |
|
これらの object はタグをもち, そのタグ定数は {\tt SM\_} または |
|
{\tt CMO\_} ではじまる. |
|
SMobject は, スタックマシンコマンドメッセージ object であり, |
|
やはり, グループ分けされている. |
|
各グループ名は, |
|
SMobject/Basic0, SMobject/Basic1 などと書く. |
|
SMobject の構造は |
|
サーバスタックマシンの節で詳しく説明する. |
|
CMObject についてはすでに Basic0 の CMObject の説明をしたが, |
|
あとで CMObject レベル 1の説明をする. |
|
OX Message の |
|
{\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). |
OX Message is the top level message object. |
OX message is the top level message object. |
The OX messages are classified into three types: DATA, COMMAND, |
The OX messages are classified into three types: DATA, COMMAND, |
and SPECIAL. They are distinguished by {\tt ox message\_tag}. |
and SPECIAL. They are distinguished by {\tt ox message\_tag}. |
{\tt message\_body} depends on the {\tt ox message\_tag}. |
|
The name of an ox message tag begins with {\tt OX\_}. |
The name of an ox message tag begins with {\tt OX\_}. |
The following table shows the correspondence between |
Typical OX message tags are {\tt OX\_COMMAND} followed by |
an OX message tag and a message body. |
SMobject and {\tt OX\_DATA} followed by CMObject. |
|
|
\begin{center} |
|
\begin{tabular}{|c||c|c|} \hline |
|
ox message tag & message body & category \\ \hline |
|
{\tt OX\_DATA} & CMOobject & DATA \\ \hline |
|
{\tt OX\_COMMAND} & SMobject & COMMAND \\ \hline |
|
{\tt OX\_DATA\_OPENMATH\_XML} & OpenMath data & DATA \\ \hline |
|
\end{tabular} |
|
\end{center} |
|
|
|
Each message object also has its tag. For SMobject, the name |
Each message object also has its tag. For SMobject, the name |
of a tag begins with {\tt SM\_}. For CMOobject, the name of |
of a tag begins with {\tt SM\_}. For CMObject, the name of |
a tag begins with {\tt CMO\_}. |
a tag begins with {\tt CMO\_}. |
An SMobject represents a stack machine command and categorized |
An SMobject represents a stack machine command and categorized |
into several groups such as SMobject/Basic0, SMobject/Basic1. |
into several groups such as SMobject/Primitive, SMobject/Basic. |
The details of SMobjects will be explained in Section \ref{sec:stackmachine}. |
The details of SMobjects will be explained in Section \ref{sec:stackmachine}. |
We have already explained the Basic0 CMOobjects. |
We have already explained the Primitive CMObjects. |
We will describe the Basic1 CMOobjects later. |
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 |
Open XM で各プロセスは |
OpenXM で各プロセスは |
\begin{center} |
\begin{center} |
(OXexpression を理解するスタックマシン) $+$ (xxx 言語で動くエンジン) |
(OXexpression を理解するスタックマシン) $+$ (xxx 言語で動くエンジン) |
\end{center} |
\end{center} |
Line 135 OX Message を スタックマシンコマンド, |
|
Line 107 OX Message を スタックマシンコマンド, |
|
SMobject を スタックマシンオペレータともよぶ. |
SMobject を スタックマシンオペレータともよぶ. |
*/ |
*/ |
|
|
|
/*&eg |
|
In OpenXM, each process may have a hybrid interface; |
|
it may accept and execute not only stack machine commands, |
|
but also its original command sequences. |
|
We call such a process an OX stack machine. |
|
Here we introduce OXexpression and SMexpression |
|
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 160 From AAA, To BBB, を OXexpression の前に書く. |
|
Line 143 From AAA, To BBB, を OXexpression の前に書く. |
|
たとえば, あとで説明する, CMO string ``Hello'' を スタックにプッシュする |
たとえば, あとで説明する, CMO string ``Hello'' を スタックにプッシュする |
表現は次のように書く: |
表現は次のように書く: |
*/ |
*/ |
|
|
|
/*&eg |
|
A comma `{\tt ,}' may be used to separate elements in an expression. |
|
{\tt OX\_tag} is a constant which denotes an OX message tag. |
|
{\tt SM\_tag} is a constant which denotes an SM command tag. |
|
If a sender AAA or a receiver BBB has to be specified, |
|
'From AAA' or 'To BBB' is written before the OXexpression. |
|
|
|
For example the following expression means a request to |
|
push a CMO string ``Hello''. |
|
*/ |
/*&C |
/*&C |
\begin{center} |
\begin{center} |
(OX\_DATA, (CMO\_STRING, 5, "Hello")) |
(OX\_DATA, (CMO\_STRING, 5, "Hello")) |
Line 167 From AAA, To BBB, を OXexpression の前に書く. |
|
Line 161 From AAA, To BBB, を OXexpression の前に書く. |
|
*/ |
*/ |
|
|
|
|
/*&jp |
/*&eg |
あとで説明するように, local 関数 ``hoge'' を実行する スタックマシンコマンドは |
The following expression means a request to execute |
次のように表現する: |
a local function ``hoge''. |
*/ |
*/ |
|
|
/*&C |
/*&C |
Line 182 From AAA, To BBB, を OXexpression の前に書く. |
|
Line 176 From AAA, To BBB, を OXexpression の前に書く. |
|
*/ |
*/ |
|
|
/*&jp |
/*&jp |
標準 encoding 法では, 各 タグを ネットワークバイトオーダーの |
標準エンコード法では, それぞれのタグは 32 bit (4 bytes) の |
32 bit integer で表現する. |
ネットワークバイトオーダでの整数として表現される. |
*/ |
*/ |
|
/*&eg |
|
In our standard encoding method, each tag is expressed as |
|
a 32 bit (4 bytes) integer with the network byte order. |
|
*/ |
|
|
|
/*&C |
|
|
|
*/ |
|
|
|
//&jp \subsubsection{ OX メッセージの表現 (XML) } |
|
//&eg \subsubsection{ Expression of OX messages (XML) } |
|
|
|
/*&jp |
|
OX メッセージは XML で表現することも可能である. 次に例を示す. |
|
*/ |
|
/*&eg |
|
OX messages can be expressed by XML. The following is an example. |
|
*/ |
|
/*&C |
|
\begin{verbatim} |
|
<ox> |
|
<ox_data> |
|
<ox_serial> <int32> 0 </int32> </ox_serial> |
|
<cmo> <cmo_string> |
|
<int32 for="length"> 5 </int32> |
|
<string> "Hello" </string> |
|
</cmo_string> |
|
</cmo> |
|
</ox_data> |
|
<ox_command> |
|
<ox_serial> <int32> 1 </int32> </ox_serial> |
|
<sm_popCMO/> |
|
</ox_command> |
|
</ox> |
|
\end{verbatim} |
|
*/ |
|
|
//&jp \subsection{OXexpression の 標準 encoding と TCP/IP ソケットによる実装法} |
//&jp \subsection{OXexpression の 標準 encoding と TCP/IP ソケットによる実装法} |
//*eg \subsection{Standard enconding of OXexpressions and an implementation by TCP/IP sockets} |
//&eg \subsection{Standard encoding of OXexpressions and an implementation by TCP/IP sockets} |
/*&jp |
/*&jp |
通信の実現方法は通信路のとりかたによりかわるが, |
通信の実現方法は通信路のとりかたによりかわるが, |
論理構造は統一的にあつかわないといけない. |
論理構造は統一的にあつかわないといけない. |
Line 213 OX パケットの番号を戻すのに主に利用される. |
|
Line 243 OX パケットの番号を戻すのに主に利用される. |
|
したがってパケットは |
したがってパケットは |
次のように記述する |
次のように記述する |
*/ |
*/ |
|
|
|
/*&eg |
|
The logical structure of OX messages are independent of implementations |
|
of communication. The OXexpression represents the logical structure. |
|
Here we explain an outline of the standard encoding scheme of OXexpression. |
|
This encoding scheme is used to implement OpenXM protocols on TCP/IP sockets. |
|
In addition, we also explain the control messages to control stack machines. |
|
|
|
As the socket connection is peer to peer, {\tt destination} and {\tt origin} |
|
are omitted. |
|
The {\tt extension} field is placed after the {\tt message\_tag} field. |
|
The {\tt extension} field consists of the serial number for OX message, |
|
which is {\tt int32}. |
|
The serial number is used to identify an OX message which caused |
|
an error on a server. |
|
In the following we regard the {\tt extension} as a component of |
|
the {\tt message\_tag} field and omit the {\tt extension} field. |
|
Thus OX messages are represented as follows. |
|
*/ |
/*&C |
/*&C |
\begin{center} |
\begin{center} |
\begin{tabular}{|c|c|} |
\begin{tabular}{|c|c|} |
Line 222 OX パケットの番号を戻すのに主に利用される. |
|
Line 271 OX パケットの番号を戻すのに主に利用される. |
|
\end{tabular} |
\end{tabular} |
\end{center} |
\end{center} |
*/ |
*/ |
//&jp が, もっとこまかく見ると, |
//&jp \noindent が, もっとこまかく見ると, |
|
//&eg \noindent More precisely it has the following representation. |
/*&C |
/*&C |
\begin{center} |
\begin{center} |
\begin{tabular}{|c|c|} |
\begin{tabular}{|c|c|} |
\hline |
\hline |
{\tt ox message\_tag}, \ {\tt packet number}&{\tt message\_body} \\ |
{\tt ox message\_tag}, \ {\tt serial number}&{\tt message\_body} \\ |
\hline |
\hline |
\end{tabular} |
\end{tabular} |
\end{center} |
\end{center} |
*/ |
*/ |
/*&jp |
/*&jp |
|
\noindent |
となっている. |
となっている. |
|
|
グループ OX Message/TCPIP/Basic0 の |
グループ OX Message/TCPIP/Primitive の |
{\tt ox message\_tag} としては次のものが用意されている. |
{\tt ox message\_tag} としては次のものが用意されている. |
*/ |
*/ |
|
//&eg \noindent As {\tt ox message\_tag} the following are provided. |
|
|
/*&C |
/*&C |
@plugin/oxMessageTag.h |
@plugin/oxMessageTag.h |
Line 273 OX パケットの番号を戻すのに主に利用される. |
|
Line 325 OX パケットの番号を戻すのに主に利用される. |
|
実現している. |
実現している. |
|
|
|
|
\verb+ OX_COMMAND + メッセージは次の形のパケット: \\ |
\verb+ OX_COMMAND + メッセージは次の形のパケットで表現される: \\ |
*/ |
*/ |
|
/*&eg |
|
Two streams are provided for communication between a client and a server. |
|
One is the stream to exchange data and to send stack machine commands. |
|
The other is the stream to control stack machines. |
|
Messages on the latter stream are called control messages and |
|
results of control messages. The sample server implements |
|
the above two streams by using two ports on TCP/IP. |
|
|
|
The stack machine command message has the following forms: \\ |
|
*/ |
/*&C |
/*&C |
|
\noindent |
\begin{tabular}{|c|c|} |
\begin{tabular}{|c|c|} |
\hline |
\hline |
{\tt OX\_COMMAND} & {\tt int32 function\_id} \\ \hline |
{\tt OX\_COMMAND} & {\tt int32 function\_id} \\ \hline |
Line 286 OX パケットの番号を戻すのに主に利用される. |
|
Line 349 OX パケットの番号を戻すのに主に利用される. |
|
\\ |
\\ |
*/ |
*/ |
|
|
//&jp \verb+ OX_DATA + メッセージは次の形のパケット: \\ |
//&jp \verb+ OX_DATA + メッセージは次の形のパケットで表現される: \\ |
|
//&eg CMO data message has the following form:\\ |
/*&C |
/*&C |
\begin{tabular}{|c|c|} |
\begin{tabular}{|c|c|} |
\hline |
\hline |
Line 296 OX パケットの番号を戻すのに主に利用される. |
|
Line 360 OX パケットの番号を戻すのに主に利用される. |
|
({\tt OX\_DATA}, {\sl CMObject} data) |
({\tt OX\_DATA}, {\sl CMObject} data) |
\\ |
\\ |
*/ |
*/ |
/*&jp |
//&jp コントロールメッセージは次の形のパケットで表現される: \\ |
データは CMO を用いて表現する. |
//&eg The control message has the following form:\\ |
|
|
コントロールメッセージは次の形のパケット: \\ |
|
*/ |
|
/*&C |
/*&C |
\begin{tabular}{|c|c|} |
\begin{tabular}{|c|c|} |
\hline |
\hline |
Line 312 OX パケットの番号を戻すのに主に利用される. |
|
Line 373 OX パケットの番号を戻すのに主に利用される. |
|
/*&jp |
/*&jp |
コントロールメッセージは, 計算を中断したい, debug 用の スレッドを起動する, |
コントロールメッセージは, 計算を中断したい, debug 用の スレッドを起動する, |
debug モードを抜けたい, などの用途に利用する. |
debug モードを抜けたい, などの用途に利用する. |
|
|
コントロールメッセージの結果メッセージは次の形のパケット: \\ |
|
*/ |
*/ |
|
/*&eg |
|
The control message is used to interrupt a computation, to invoke |
|
debugging threads, or to exit form the debugging mode. |
|
*/ |
|
|
|
//&jp コントロールメッセージの結果メッセージは次の形のパケットで表現される: \\ |
|
//&eg The result of a control message has the following form:\\ |
/*&C |
/*&C |
\begin{tabular}{|c|c|l|} |
\begin{tabular}{|c|c|l|} |
\hline |
\hline |
Line 328 debug モードを抜けたい, などの用途に利用する. |
|
Line 394 debug モードを抜けたい, などの用途に利用する. |
|
/*&jp |
/*&jp |
{\tt int32 function\_id} |
{\tt int32 function\_id} |
の部分に, サーバスタックマシン の operator に対応する番号がはいる. |
の部分に, サーバスタックマシン の operator に対応する番号がはいる. |
グループ SMobject/Basic0 および SMobject/Basic1 に属する |
グループ SMobject/Primitive および SMobject/Basic に属する |
タグとして以下のものがある. |
タグとして以下のものがある. |
*/ |
*/ |
|
/*&eg |
|
{\tt int32 function\_id} is the value of a stack machine command. |
|
SM tags in SMobject/Primitive and SMobject/Basic and corresponding |
|
values are as follows. |
|
*/ |
/*&C |
/*&C |
@plugin/oxFunctionId.h |
@plugin/oxFunctionId.h |
\begin{verbatim} |
\begin{verbatim} |
Line 358 debug モードを抜けたい, などの用途に利用する. |
|
Line 429 debug モードを抜けたい, などの用途に利用する. |
|
\end{verbatim} |
\end{verbatim} |
*/ |
*/ |
|
|
//&jp たとえば, |
//&jp \noindent たとえば, |
/*C |
//&eg \noindent For example |
|
/*&C |
\begin{center} |
\begin{center} |
(OX\_COMMAND, SM\_pops) |
(OX\_COMMAND, SM\_pops) |
\end{center} |
\end{center} |
*/ |
*/ |
//&jp は |
//&jp \noindent は |
/*C |
//&eg \noindent is encoded as follows. |
|
/*&C |
\begin{center} |
\begin{center} |
\begin{tabular}{|c|c|} |
\begin{tabular}{|c|c|} |
\hline |
\hline |
Line 374 debug モードを抜けたい, などの用途に利用する. |
|
Line 447 debug モードを抜けたい, などの用途に利用する. |
|
\end{tabular} |
\end{tabular} |
\end{center} |
\end{center} |
*/ |
*/ |
/*&jp |
//&jp とエンコードされる. |
とエンコードされる. |
|
|
|
|
/*&jp |
operator の詳細は次の節で説明する. |
operator の詳細は次の節で説明する. |
これらの定数の名前はインプリメントのとき短縮形で表現してもよい. |
これらの定数の名前はインプリメントのとき短縮形で表現してもよい. |
|
*/ |
|
/*&eg |
|
The details of the operators are described in Section \ref{sec:stackmachine}. |
|
Names of these constants may be represented by abbreviated forms. |
*/ |
*/ |
|
|