=================================================================== RCS file: /home/cvs/OpenXM/doc/OpenXM-specs/communication-model.tex,v retrieving revision 1.1 retrieving revision 1.6 diff -u -p -r1.1 -r1.6 --- OpenXM/doc/OpenXM-specs/communication-model.tex 2000/01/20 08:52:46 1.1 +++ OpenXM/doc/OpenXM-specs/communication-model.tex 2000/01/24 02:48:24 1.6 @@ -1,6 +1,6 @@ -%% $OpenXM$ -//&jp \section{ Open XM ¤ÎÄÌ¿®¥â¥Ç¥ë} -//&eg \section{ Communication model of Open XM} (This part has not yet been translated) +%% $OpenXM: OpenXM/doc/OpenXM-specs/communication-model.tex,v 1.5 2000/01/21 08:44:54 noro Exp $ +//&jp \section{ OpenXM ¤ÎÄÌ¿®¥â¥Ç¥ë} +//&eg \section{ Communication model of OpenXM} /*&jp ¤ï¤ì¤ï¤ì¤Ï, ¿ô³Ø¥×¥í¥»¥¹¤¬¥á¥Ã¥»¡¼¥¸¤ò @@ -22,22 +22,22 @@ ¥á¥Ã¥»¡¼¥¸¤ÏÏÀÍýŪ¤Ë¼¡¤Î¤è¤¦¤Ê¹½Â¤¤ò¤â¤Ä: */ /*&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, 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. \begin{enumerate} \item Communication by files. \item Linking as a subroutine library. \item TCP/IP streams. \item Remote Procedure call. -\item Muitithread. +\item Multi-thread. \item PVM library. \item MPI library. \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: */ /*&C @@ -51,10 +51,10 @@ A message has the following structure: \end{center} */ /*&jp -¤³¤Î¥á¥Ã¥»¡¼¥¸¤ò, OX Message (Open XM message object) ¤È¤è¤Ö. +¤³¤Î¥á¥Ã¥»¡¼¥¸¤ò, OX message (OpenXM message object) ¤È¤è¤Ö. OX Message ¤Ï¥È¥Ã¥×¥ì¥Ù¥ë¤Î¥á¥Ã¥»¡¼¥¸ object ¤Ç¤¢¤ê, »ÅÍͽñ¤Ç¤Ï, ¤µ¤Þ¤¶¤Þ¤Ê¥°¥ë¡¼¥×¤Ë°¤¹¤ë object ¤¬Åо줹¤ë. -¥°¥ë¡¼¥×̾¤Ï, ¤¿¤È¤¨¤Ð, OX Message/TCPIP/Basic0 ¤Ê¤É¤È½ñ¤¯. +¥°¥ë¡¼¥×̾¤Ï, ¤¿¤È¤¨¤Ð, OX Message/TCPIP/Primitive ¤Ê¤É¤È½ñ¤¯. {\tt message\_body} ¤ÎÉôʬ¤Î»ÅÍͤÏ, OX Message ¤Î¾å°Ì¤Ë°ÌÃÖ¤¹¤ëÉôʬ¤Ç¤¢¤ê, SMobject ¤Þ¤¿¤Ï CMObject ¤¬¤¯¤ë. ¤³¤ì¤é¤Î object ¤Ï¥¿¥°¤ò¤â¤Á, ¤½¤Î¥¿¥°Äê¿ô¤Ï {\tt SM\_} ¤Þ¤¿¤Ï @@ -62,66 +62,36 @@ SMobject ¤Ï, ¥¹¥¿¥Ã¥¯¥Þ¥·¥ó¥³¥Þ¥ó¥É¥á¥Ã¥»¡¼¥¸ object ¤ SMobject ¤Ï, ¥¹¥¿¥Ã¥¯¥Þ¥·¥ó¥³¥Þ¥ó¥É¥á¥Ã¥»¡¼¥¸ object ¤Ç¤¢¤ê, ¤ä¤Ï¤ê, ¥°¥ë¡¼¥×ʬ¤±¤µ¤ì¤Æ¤¤¤ë. ³Æ¥°¥ë¡¼¥×̾¤Ï, -SMobject/Basic0, SMobject/Basic1 ¤Ê¤É¤È½ñ¤¯. +SMobject/Primitive, SMobject/Basic ¤Ê¤É¤È½ñ¤¯. SMobject ¤Î¹½Â¤¤Ï ¥µ¡¼¥Ð¥¹¥¿¥Ã¥¯¥Þ¥·¥ó¤ÎÀá¤Ç¾Ü¤·¤¯ÀâÌÀ¤¹¤ë. -CMObject ¤Ë¤Ä¤¤¤Æ¤Ï¤¹¤Ç¤Ë Basic0 ¤Î CMObject ¤ÎÀâÌÀ¤ò¤·¤¿¤¬, +CMObject ¤Ë¤Ä¤¤¤Æ¤Ï¤¹¤Ç¤Ë Primitive ¤Î CMObject ¤ÎÀâÌÀ¤ò¤·¤¿¤¬, ¤¢¤È¤Ç CMObject ¥ì¥Ù¥ë 1¤ÎÀâÌÀ¤ò¤¹¤ë. OX Message ¤Î {\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 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, 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 following table shows the correspondence between -an OX message tag and a message body. - -\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} - +Typical OX message tags are {\tt OX\_COMMAND} followed by +SMobject and {\tt OX\_DATA} followed by CMObject. 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\_}. 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}. -We have already explained the Basic0 CMOobjects. -We will describe the Basic1 CMOobjects later. +We have already explained the Primitive CMObjects. +We will describe the Basic CMObjects in Section \ref{sec:basic1}. */ //&jp \subsection{ OX Message ¤Î ɽ¸½ÊýË¡ } //&eg \subsection{ OX Messages } /*&jp -Open XM ¤Ç³Æ¥×¥í¥»¥¹¤Ï +OpenXM ¤Ç³Æ¥×¥í¥»¥¹¤Ï \begin{center} (OXexpression ¤òÍý²ò¤¹¤ë¥¹¥¿¥Ã¥¯¥Þ¥·¥ó) $+$ (xxx ¸À¸ì¤Çư¤¯¥¨¥ó¥¸¥ó) \end{center} @@ -135,6 +105,15 @@ 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. +*/ + /*&C \begin{eqnarray*} \mbox{OXexpression} @@ -160,6 +139,17 @@ From AAA, To BBB, ¤ò OXexpression ¤ÎÁ°¤Ë½ñ¤¯. ¤¿¤È¤¨¤Ð, ¤¢¤È¤ÇÀâÌÀ¤¹¤ë, 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 \begin{center} (OX\_DATA, (CMO\_STRING, 5, "Hello")) @@ -167,9 +157,9 @@ From AAA, To BBB, ¤ò OXexpression ¤ÎÁ°¤Ë½ñ¤¯. */ -/*&jp -¤¢¤È¤ÇÀâÌÀ¤¹¤ë¤è¤¦¤Ë, local ´Ø¿ô ``hoge'' ¤ò¼Â¹Ô¤¹¤ë ¥¹¥¿¥Ã¥¯¥Þ¥·¥ó¥³¥Þ¥ó¥É¤Ï -¼¡¤Î¤è¤¦¤Ëɽ¸½¤¹¤ë: +/*&eg +The following expression means a request to execute +a local function ``hoge''. */ /*&C @@ -182,12 +172,12 @@ From AAA, To BBB, ¤ò OXexpression ¤ÎÁ°¤Ë½ñ¤¯. */ /*&jp -ɸ½à encoding Ë¡¤Ç¤Ï, ³Æ ¥¿¥°¤ò ¥Í¥Ã¥È¥ï¡¼¥¯¥Ð¥¤¥È¥ª¡¼¥À¡¼¤Î -32 bit integer ¤Çɽ¸½¤¹¤ë. +In our standard encoding method, each tag is expressed as +a 32 bit (4 byte) integer with the network byte order. */ //&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 ÄÌ¿®¤Î¼Â¸½ÊýË¡¤ÏÄÌ¿®Ï©¤Î¤È¤ê¤«¤¿¤Ë¤è¤ê¤«¤ï¤ë¤¬, ÏÀÍý¹½Â¤¤ÏÅý°ìŪ¤Ë¤¢¤Ä¤«¤ï¤Ê¤¤¤È¤¤¤±¤Ê¤¤. @@ -213,6 +203,25 @@ 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 \begin{center} \begin{tabular}{|c|c|} @@ -222,22 +231,25 @@ OX ¥Ñ¥±¥Ã¥È¤ÎÈÖ¹æ¤òÌ᤹¤Î¤Ë¼ç¤ËÍøÍѤµ¤ì¤ë. \end{tabular} \end{center} */ -//&jp ¤¬, ¤â¤Ã¤È¤³¤Þ¤«¤¯¸«¤ë¤È, +//&jp \noindent ¤¬, ¤â¤Ã¤È¤³¤Þ¤«¤¯¸«¤ë¤È, +//&eg \noindent More precisely it has the following representation. /*&C \begin{center} \begin{tabular}{|c|c|} \hline -{\tt ox message\_tag}, \ {\tt packet number}&{\tt message\_body} \\ +{\tt ox message\_tag}, \ {\tt serial number}&{\tt message\_body} \\ \hline \end{tabular} \end{center} */ /*&jp +\noindent ¤È¤Ê¤Ã¤Æ¤¤¤ë. -¥°¥ë¡¼¥× OX Message/TCPIP/Basic0 ¤Î +¥°¥ë¡¼¥× OX Message/TCPIP/Primitive ¤Î {\tt ox message\_tag} ¤È¤·¤Æ¤Ï¼¡¤Î¤â¤Î¤¬ÍѰդµ¤ì¤Æ¤¤¤ë. */ +//&eg \noindent As {\tt ox message\_tag} the following are provided. /*&C @plugin/oxMessageTag.h @@ -273,9 +285,20 @@ 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 +\noindent \begin{tabular}{|c|c|} \hline {\tt OX\_COMMAND} & {\tt int32 function\_id} \\ \hline @@ -286,7 +309,8 @@ OX ¥Ñ¥±¥Ã¥È¤ÎÈÖ¹æ¤òÌ᤹¤Î¤Ë¼ç¤ËÍøÍѤµ¤ì¤ë. \\ */ -//&jp \verb+ OX_DATA + ¥á¥Ã¥»¡¼¥¸¤Ï¼¡¤Î·Á¤Î¥Ñ¥±¥Ã¥È: \\ +//&jp \verb+ OX_DATA + ¥á¥Ã¥»¡¼¥¸¤Ï¼¡¤Î·Á¤Î¥Ñ¥±¥Ã¥È¤Çɽ¸½¤µ¤ì¤ë: \\ +//&eg CMO data message has the following form:\\ /*&C \begin{tabular}{|c|c|} \hline @@ -296,11 +320,8 @@ OX ¥Ñ¥±¥Ã¥È¤ÎÈÖ¹æ¤òÌ᤹¤Î¤Ë¼ç¤ËÍøÍѤµ¤ì¤ë. ({\tt OX\_DATA}, {\sl CMObject} data) \\ */ -/*&jp -¥Ç¡¼¥¿¤Ï CMO ¤òÍѤ¤¤ÆÉ½¸½¤¹¤ë. - -¥³¥ó¥È¥í¡¼¥ë¥á¥Ã¥»¡¼¥¸¤Ï¼¡¤Î·Á¤Î¥Ñ¥±¥Ã¥È: \\ -*/ +//&jp ¥³¥ó¥È¥í¡¼¥ë¥á¥Ã¥»¡¼¥¸¤Ï¼¡¤Î·Á¤Î¥Ñ¥±¥Ã¥È¤Çɽ¸½¤µ¤ì¤ë: \\ +//&eg The control message has the following form:\\ /*&C \begin{tabular}{|c|c|} \hline @@ -312,9 +333,14 @@ debug ¥â¡¼¥É¤òÈ´¤±¤¿¤¤, ¤Ê¤É¤ÎÍÑÅÓ¤ËÍøÍѤ¹¤ë. /*&jp ¥³¥ó¥È¥í¡¼¥ë¥á¥Ã¥»¡¼¥¸¤Ï, ·×»»¤òÃæÃǤ·¤¿¤¤, 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 \begin{tabular}{|c|c|l|} \hline @@ -328,9 +354,14 @@ debug ¥â¡¼¥É¤òÈ´¤±¤¿¤¤, ¤Ê¤É¤ÎÍÑÅÓ¤ËÍøÍѤ¹¤ë. /*&jp {\tt int32 function\_id} ¤ÎÉôʬ¤Ë, ¥µ¡¼¥Ð¥¹¥¿¥Ã¥¯¥Þ¥·¥ó ¤Î 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 @plugin/oxFunctionId.h \begin{verbatim} @@ -358,14 +389,16 @@ debug ¥â¡¼¥É¤òÈ´¤±¤¿¤¤, ¤Ê¤É¤ÎÍÑÅÓ¤ËÍøÍѤ¹¤ë. \end{verbatim} */ -//&jp ¤¿¤È¤¨¤Ð, -/*C +//&jp \noindent ¤¿¤È¤¨¤Ð, +//&eg \noindent For example +/*&C \begin{center} (OX\_COMMAND, SM\_pops) \end{center} */ -//&jp ¤Ï -/*C +//&jp \noindent ¤Ï +//&eg \noindent is encoded as follows. +/*&C \begin{center} \begin{tabular}{|c|c|} \hline @@ -374,10 +407,14 @@ debug ¥â¡¼¥É¤òÈ´¤±¤¿¤¤, ¤Ê¤É¤ÎÍÑÅÓ¤ËÍøÍѤ¹¤ë. \end{tabular} \end{center} */ -/*&jp -¤È¥¨¥ó¥³¡¼¥É¤µ¤ì¤ë. +//&jp ¤È¥¨¥ó¥³¡¼¥É¤µ¤ì¤ë. +/*&jp operator ¤Î¾ÜºÙ¤Ï¼¡¤ÎÀá¤ÇÀâÌÀ¤¹¤ë. ¤³¤ì¤é¤ÎÄê¿ô¤Î̾Á°¤Ï¥¤¥ó¥×¥ê¥á¥ó¥È¤Î¤È¤­Ã»½Ì·Á¤Çɽ¸½¤·¤Æ¤â¤è¤¤. +*/ +/*&eg +The details of the operators are described in Section \ref{sec:stackmachine}. +Names of these constants may be represented by abbreviated forms. */