=================================================================== RCS file: /home/cvs/OpenXM/doc/OpenXM-specs/communication-model.tex,v retrieving revision 1.1.1.1 retrieving revision 1.5 diff -u -p -r1.1.1.1 -r1.5 --- OpenXM/doc/OpenXM-specs/communication-model.tex 2000/01/20 08:52:46 1.1.1.1 +++ OpenXM/doc/OpenXM-specs/communication-model.tex 2000/01/21 08:44:54 1.5 @@ -1,4 +1,4 @@ -%% $OpenXM$ +%% $OpenXM: OpenXM/doc/OpenXM-specs/communication-model.tex,v 1.4 2000/01/21 06:24:49 noro Exp $ //&jp \section{ Open XM ¤ÎÄÌ¿®¥â¥Ç¥ë} //&eg \section{ Communication model of Open XM} (This part has not yet been translated) @@ -25,7 +25,7 @@ In our model of comutation, 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. @@ -69,45 +69,15 @@ CMObject ¤Ë¤Ä¤¤¤Æ¤Ï¤¹¤Ç¤Ë Basic0 ¤Î 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. 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 CMOobject. Each message object also has its tag. For SMobject, the name of a tag begins with {\tt SM\_}. For CMOobject, the name of a tag begins with {\tt CMO\_}. @@ -135,6 +105,15 @@ OX Message ¤ò ¥¹¥¿¥Ã¥¯¥Þ¥·¥ó¥³¥Þ¥ó¥É, SMobject ¤ò ¥¹¥¿¥Ã¥¯¥Þ¥·¥ó¥ª¥Ú¥ì¡¼¥¿¤È¤â¤è¤Ö. */ +/*&eg +In Open XM, 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 comman `{\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")) @@ -168,8 +158,8 @@ From AAA, To BBB, ¤ò OXexpression ¤ÎÁ°¤Ë½ñ¤¯. /*&jp -¤¢¤È¤ÇÀâÌÀ¤¹¤ë¤è¤¦¤Ë, local ´Ø¿ô ``hoge'' ¤ò¼Â¹Ô¤¹¤ë ¥¹¥¿¥Ã¥¯¥Þ¥·¥ó¥³¥Þ¥ó¥É¤Ï -¼¡¤Î¤è¤¦¤Ëɽ¸½¤¹¤ë: +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 enconding 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|} @@ -223,6 +232,7 @@ OX ¥Ñ¥±¥Ã¥È¤ÎÈÖ¹æ¤òÌ᤹¤Î¤Ë¼ç¤ËÍøÍѤµ¤ì¤ë. \end{center} */ //&jp ¤¬, ¤â¤Ã¤È¤³¤Þ¤«¤¯¸«¤ë¤È, +//&eg More precisely it has the following representation. /*&C \begin{center} \begin{tabular}{|c|c|} @@ -238,6 +248,7 @@ OX ¥Ñ¥±¥Ã¥È¤ÎÈÖ¹æ¤òÌ᤹¤Î¤Ë¼ç¤ËÍøÍѤµ¤ì¤ë. ¥°¥ë¡¼¥× OX Message/TCPIP/Basic0 ¤Î {\tt ox message\_tag} ¤È¤·¤Æ¤Ï¼¡¤Î¤â¤Î¤¬ÍÑ°Õ¤µ¤ì¤Æ¤¤¤ë. */ +//&eg As {\tt ox message\_tag} the following are provided. /*&C @plugin/oxMessageTag.h @@ -273,8 +284,18 @@ OX ¥Ñ¥±¥Ã¥È¤ÎÈÖ¹æ¤òÌ᤹¤Î¤Ë¼ç¤ËÍøÍѤµ¤ì¤ë. ¼Â¸½¤·¤Æ¤¤¤ë. -\verb+ OX_COMMAND + ¥á¥Ã¥»¡¼¥¸¤Ï¼¡¤Î·Á¤Î¥Ñ¥±¥Ã¥È: \\ +\verb+ OX_COMMAND + ¥á¥Ã¥»¡¼¥¸¤Ï¼¡¤Î·Á¤Î¥Ñ¥±¥Ã¥È¤Çɽ¸½¤µ¤ì¤ë: \\ */ +/*&eg +Two streams are used 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 \begin{tabular}{|c|c|} \hline @@ -286,7 +307,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 +318,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 +331,14 @@ OX ¥Ñ¥±¥Ã¥È¤ÎÈÖ¹æ¤òÌ᤹¤Î¤Ë¼ç¤ËÍøÍѤµ¤ì¤ë. /*&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 cotrol message has the following form:\\ /*&C \begin{tabular}{|c|c|l|} \hline @@ -331,6 +355,11 @@ debug ¥â¡¼¥É¤òÈ´¤±¤¿¤¤, ¤Ê¤É¤ÎÍÑÅÓ¤ËÍøÍѤ¹¤ë. ¥°¥ë¡¼¥× SMobject/Basic0 ¤ª¤è¤Ó SMobject/Basic1 ¤Ë°¤¹¤ë ¥¿¥°¤È¤·¤Æ°Ê²¼¤Î¤â¤Î¤¬¤¢¤ë. */ +/*&eg +{\tt int32 function\_id} is the value of a stack machine command. +SM tags in SMobject/Basic0 and SMobject/Basic1 and corresponding +values are as follows. +*/ /*&C @plugin/oxFunctionId.h \begin{verbatim} @@ -359,13 +388,15 @@ debug ¥â¡¼¥É¤òÈ´¤±¤¿¤¤, ¤Ê¤É¤ÎÍÑÅÓ¤ËÍøÍѤ¹¤ë. */ //&jp ¤¿¤È¤¨¤Ð, -/*C +//&eg For example +/*&C \begin{center} (OX\_COMMAND, SM\_pops) \end{center} */ //&jp ¤Ï -/*C +//&eg is encoded as follows. +/*&C \begin{center} \begin{tabular}{|c|c|} \hline @@ -374,10 +405,14 @@ debug ¥â¡¼¥É¤òÈ´¤±¤¿¤¤, ¤Ê¤É¤ÎÍÑÅÓ¤ËÍøÍѤ¹¤ë. \end{tabular} \end{center} */ -/*&jp -¤È¥¨¥ó¥³¡¼¥É¤µ¤ì¤ë. +//&jp ¤È¥¨¥ó¥³¡¼¥É¤µ¤ì¤ë. +/*&jp operator ¤Î¾ÜºÙ¤Ï¼¡¤ÎÀá¤ÇÀâÌÀ¤¹¤ë. ¤³¤ì¤é¤ÎÄê¿ô¤Î̾Á°¤Ï¥¤¥ó¥×¥ê¥á¥ó¥È¤Î¤È¤­Ã»½Ì·Á¤Çɽ¸½¤·¤Æ¤â¤è¤¤. +*/ +/*&eg +The details of the operators are described in Section \ref{sec:stackmanine}. +Names of these constants may be represented by abbreviated forms. */