version 1.6, 2000/07/27 09:51:04 |
version 1.7, 2000/11/17 02:50:04 |
|
|
%% $OpenXM: OpenXM/doc/OpenXM-specs/control.tex,v 1.5 2000/01/24 07:36:35 noro Exp $ |
%% $OpenXM: OpenXM/doc/OpenXM-specs/control.tex,v 1.6 2000/07/27 09:51:04 ohara Exp $ |
\section{Session Management} |
\section{Session Management} |
|
|
\subsection{Control server} |
\subsection{Control server} |
|
|
An OpenXM server has logically two I/O channels: one for exchanging |
An OpenXM server has logically two I/O channels: one for exchanging |
data for computations and the other for controlling computations. The |
data for computations and the other for controlling computations. The |
control channel is used to send commands to control execution on the |
control channel is used to send commands to control execution on the |
server. The sample server ({\tt oxmain.c}) processes such control |
nserver. The sample server ({\tt oxmain.c}) processes such control |
messages on another process. We call such a process a {\it |
messages on another process. We call such a process a {\it |
control server}. In contrast, we call a server for computation an {\it |
control server}. In contrast, we call a server for computation an {\it |
engine}. As the control server and the engine runs on the |
engine}. As the control server and the engine runs on the |
Line 44 to send signals to a server or to terminate a server. |
|
Line 44 to send signals to a server or to terminate a server. |
|
Ä󶡤µ¤ì¤ë¡£¿·¤·¤¤¥³¥ó¥È¥í¡¼¥ë¥µ¡¼¥Ð¤Ï°Ê²¼¤ÎÅÀ¤Ç½¾Íè¤Î¤â¤Î¤È°Û¤Ê¤ë¡£ |
Ä󶡤µ¤ì¤ë¡£¿·¤·¤¤¥³¥ó¥È¥í¡¼¥ë¥µ¡¼¥Ð¤Ï°Ê²¼¤ÎÅÀ¤Ç½¾Íè¤Î¤â¤Î¤È°Û¤Ê¤ë¡£ |
\begin{enumerate} |
\begin{enumerate} |
\item ¥³¥ó¥È¥í¡¼¥ë¥µ¡¼¥Ð¤Ï OpenXM ¥¹¥¿¥Ã¥¯¥Þ¥·¥ó¤Ç¤¢¤ê¡¢ |
\item ¥³¥ó¥È¥í¡¼¥ë¥µ¡¼¥Ð¤Ï OpenXM ¥¹¥¿¥Ã¥¯¥Þ¥·¥ó¤Ç¤¢¤ê¡¢ |
CMObject/Primitive ¤ª¤è¤Ó CMO\_ZZ ¤ò¥µ¥Ý¡¼¥È¤¹¤ë¡£ |
CMObject/Primitive ¤ò¥µ¥Ý¡¼¥È¤¹¤ë¡£ |
\item ·×»»¥µ¡¼¥Ð¤Îµ¯Æ°¤Ï¥¹¥¿¥Ã¥¯¥Þ¥·¥ó¥³¥Þ¥ó¥É¤ò²ð¤·¤Æ¹Ô¤¦¡£ |
\item ·×»»¥µ¡¼¥Ð¤Îµ¯Æ°¤Ï¥¹¥¿¥Ã¥¯¥Þ¥·¥ó¥³¥Þ¥ó¥É¤ò²ð¤·¤Æ¹Ô¤¦¡£ |
\item °ì¤Ä¤Î¥³¥ó¥È¥í¡¼¥ë¥µ¡¼¥Ð¤«¤éÊ£¿ô¤Î·×»»¥µ¡¼¥Ð¤òµ¯Æ°¤Ç¤¤ë¡£ |
\item °ì¤Ä¤Î¥³¥ó¥È¥í¡¼¥ë¥µ¡¼¥Ð¤«¤éÊ£¿ô¤Î·×»»¥µ¡¼¥Ð¤òµ¯Æ°¤Ç¤¤ë¡£ |
\end{enumerate} |
\end{enumerate} |
Line 64 listen, accept ¤¹¤ë¡£Àܳ¸å¡¢¥Ð¥¤¥È¥ª¡¼¥À¤ò·èÄꤹ¤ë¡£¥ |
|
Line 64 listen, accept ¤¹¤ë¡£Àܳ¸å¡¢¥Ð¥¤¥È¥ª¡¼¥À¤ò·èÄꤹ¤ë¡£¥ |
|
oxc_open(·×»»¥µ¡¼¥Ð̾, ¥Û¥¹¥È̾, ¥Ý¡¼¥ÈÈÖ¹æ, ¥â¡¼¥É, ...) |
oxc_open(·×»»¥µ¡¼¥Ð̾, ¥Û¥¹¥È̾, ¥Ý¡¼¥ÈÈÖ¹æ, ¥â¡¼¥É, ...) |
\end{verbatim} |
\end{verbatim} |
¤È¤¤¤¦·Á¼°¤Ç¤¢¤ë¡£¤³¤³¤Ç¡¢¡Ö·×»»¥µ¡¼¥Ð̾¡×¡¢¡Ö¥Û¥¹¥È̾¡×¤Ï CMO\_STRING |
¤È¤¤¤¦·Á¼°¤Ç¤¢¤ë¡£¤³¤³¤Ç¡¢¡Ö·×»»¥µ¡¼¥Ð̾¡×¡¢¡Ö¥Û¥¹¥È̾¡×¤Ï CMO\_STRING |
·¿¤Î¥ª¥Ö¥¸¥§¥¯¥È¡¢¡Ö¥Ý¡¼¥ÈÈÖ¹æ¡×¡¢¡Ö¥â¡¼¥É¡×¤Ï CMO\_INT32·¿ ¤Þ¤¿¤Ï |
·¿¤Î¥ª¥Ö¥¸¥§¥¯¥È¡¢¡Ö¥Ý¡¼¥ÈÈÖ¹æ¡×¡¢¡Ö¥â¡¼¥É¡×¤Ï CMO\_INT32·¿ |
CMO\_ZZ ·¿¤Î¥ª¥Ö¥¸¥§¥¯¥È¤Ç¤¢¤ë¡£¥Û¥¹¥È̾¤È¤¤¤¦¤Î¤ÏOpenXM¥¯¥é¥¤¥¢¥ó¥È¤Î¥Û |
¤Î¥ª¥Ö¥¸¥§¥¯¥È¤Ç¤¢¤ë¡£¥Û¥¹¥È̾¤È¤¤¤¦¤Î¤ÏOpenXM¥¯¥é¥¤¥¢¥ó¥È¤Î¥Û |
¥¹¥È̾¤Î¤³¤È¤Ç¤¢¤ë¡£¥í¡¼¥«¥ë´Ø¿ô¤Î¼Â¹Ô¤Ï SM\_executeFunction ¤Ë¤è¤ë¡£¤¹ |
¥¹¥È̾¤Î¤³¤È¤Ç¤¢¤ë¡£¥í¡¼¥«¥ë´Ø¿ô¤Î¼Â¹Ô¤Ï SM\_executeFunction ¤Ë¤è¤ë¡£¤¹ |
¤Ê¤ï¤Á³Æ°ú¿ô¤ò½ç¤Ë¥¹¥¿¥Ã¥¯¤ËÀѤߡ¢ºÇ¸å¤ËSM\_executeFunction ¤ò¼Â¹Ô¤¹¤ë¡£ |
¤Ê¤ï¤Á³Æ°ú¿ô¤ò½ç¤Ë¥¹¥¿¥Ã¥¯¤ËÀѤߡ¢ºÇ¸å¤ËSM\_executeFunction ¤ò¼Â¹Ô¤¹¤ë¡£ |
SM\_executeStringByLocalParser ¤ÏÍøÍѤǤ¤Ê¤¤¤Î¤ÇÃí°Õ¤¹¤ë¡£ |
SM\_executeStringByLocalParser ¤ÏÍøÍѤǤ¤Ê¤¤¤Î¤ÇÃí°Õ¤¹¤ë¡£ |
|
|
0 0 2 03 (OX_SYNC_BALL) |
0 0 2 03 (OX_SYNC_BALL) |
\end{verbatim} |
\end{verbatim} |
|
|
|
\subsection{Notification from servers} |
|
|
|
/*&jp |
|
OpenXM ¥µ¡¼¥Ð¤Ï, ²Äǽ¤Ç¤¢¤ë¤«¤®¤ê²ÉÌۤǤ¢¤ë. |
|
¤¿¤È¤¨¤Ð¥¨¥é¡¼¤ò¤ª¤³¤·¤Æ¤â, ¥¨¥é¡¼¤Ï¥µ¡¼¥Ð¤Î¥¨¥ó¥¸¥ó¥¹¥¿¥Ã¥¯¤Ë¤Ä¤Þ¤ì¤ë |
|
¤À¤±¤Ç¤¢¤ê, ¥µ¡¼¥Ð¤Ï¥¯¥é¥¤¥¢¥ó¥È¤¬ {\tt pop\_cmo} ¥á¥Ã¥»¡¼¥¸¤ò¤ª¤¯¤é¤Ê¤¤ |
|
¤«¤®¤ê²¿¤âÁ÷¿®¤·¤Ê¤¤. |
|
*/ |
|
/*&eg |
|
OpenXM servers try to be quiet as far as possible. |
|
For example, engine errors of a server are only put on the engine stack and |
|
the engine does not send error packets unless the client sends the message |
|
{\tt pop\_cmo}. |
|
*/ |
|
|
|
/*&jp |
|
OpenXM ¤Ï¤³¤Î¸¶Â§¤ò¤ä¤Ö¤ëÎ㳰Ū¤ÊÊýË¡¤ò°ì¤ÄÍÑ°Õ¤·¤Æ¤¤¤ë. |
|
¥³¥ó¥È¥í¡¼¥ë¥µ¡¼¥Ð¤Ï, |
|
{\tt OX\_NOTIFY} ¥Ø¥Ã¥À¤ª¤è¤Ó¤½¤ì¤Ë¤Ä¤Å¤¯ {\tt OX\_DATA} ¥Ñ¥±¥Ã¥È¤òÁ÷¤ë |
|
¤³¤È¤¬¤Ç¤¤ë. |
|
¤³¤Îµ¡Ç½¤Ï mathcap ¤Ç¶Ø»ß¤¹¤ë¤³¤È¤â²Äǽ¤Ç¤¢¤ë. |
|
*/ |
|
/*&eg |
|
OpenXM provides a method to break this principle. |
|
Control server may send {\tt OX\_NOTIFY} header and an {\tt OX\_DATA} packet. |
|
This transmission can be prohibited by mathcap. |
|
*/ |
|
|
|
/*&jp |
|
¤³¤Îµ¡Ç½¤ò¤É¤Î¤è¤¦¤Ë»È¤¦¤«Îã¤ò¤¢¤²¤ÆÀâÌÀ¤·¤è¤¦. |
|
{\tt Asir} ¤Î {\tt ox\_plot} ¥µ¡¼¥Ð¤Ï, quit ¥Ü¥¿¥ó¤ò¤â¤Ã¤Æ¤¤¤ë. |
|
quit ¥Ü¥¿¥ó¤¬¤ª¤µ¤ì¤ë¤È canvas ¤¬¾ÃÌǤ¹¤ë¤¬, ¥¨¥ó¥¸¥ó¼«ÂΤϸºß¤ò |
|
¤Ä¤Å¤±¤ë. ¤³¤Î¾õÂÖ¤ÇÉÁ²èÌ¿Î᤬¤¯¤ë¤È, |
|
¥¨¥ó¥¸¥ó¥¹¥¿¥Ã¥¯¤Ë, ``canvas does not exist'' ¤È¤¤¤¦¥¨¥é¡¼¤¬¤Ä¤Þ¤ì¤ë. |
|
¥¨¥ó¥¸¥ó¤¬¤³¤Î¥¨¥é¡¼¤¬À¸¤¸¤¿¤³¤È¤ò¶ÛµÞ¤ËÃΤ餻¤¿¤¤¤È¤¤Ë |
|
{\tt OX\_NOTIFY} ¤òÍѤ¤¤ë. |
|
*/ |
|
/*&eg |
|
Let us explain how to use {\tt OX\_NOTIFY}. |
|
The {\tt ox\_plot} server of {\tt asir} has a quit button. |
|
If the quit button is pressed, the canvas dissappears, but the engine |
|
does not terminate. |
|
If the client sends drawing messages without the canvas, |
|
then the engine pushes |
|
error packets ``canvas does not exist'' on the engine stack. |
|
If the engine wants to notify the error to the client immediately, |
|
the {\tt OX\_NOTIFY} message should be used. |
|
*/ |
|
|
|
/*&jp |
|
¤³¤³¤Ç, {\tt OX\_NOTIFY} ¤ò¤ª¤¯¤ë¤Î¤Ï, ¥³¥ó¥È¥í¡¼¥ë¥×¥í¥»¥¹¤Ç |
|
¤¢¤ë¤³¤È¤ËÃí°Õ¤·¤è¤¦. |
|
¤·¤¿¤¬¤Ã¤Æ¥¨¥ó¥¸¥ó¤Ï¤Ê¤ó¤é¤«¤ÎÊýË¡¤Ç, ¥³¥ó¥È¥í¡¼¥ë¥µ¡¼¥Ð¤Ë |
|
{\tt OX\_NOTIFY} ¤ò¤ª¤¯¤ë¤³¤È¤ò°ÍÍꤷ¤Ê¤¤¤È¤¤¤±¤Ê¤¤. |
|
OpenXM ¤Îµ¬³Ê¤Ç¤Ï, |
|
¥Õ¥¡¥¤¥ë {\tt /tmp/.ox\_notify.pid} ¤Ë touch ¤¹¤ë¤³¤È¤Ç¤³¤ì¤Î |
|
°ì¤Ä¤Î¼Â¸½ÊýË¡¤òÍ¿¤¨¤Æ¤¤¤ë. |
|
¤³¤³¤Ç {\tt pid} ¤Ï¥¨¥ó¥¸¥ó¤Î¥×¥í¥»¥¹ÈÖ¹æ¤Ç¤¢¤ë. |
|
¥³¥ó¥È¥í¡¼¥ë¥µ¡¼¥Ð¤Ï¥Õ¥¡¥¤¥ë {\tt /tmp/.ox\_notify.pid} ¤¬ |
|
touch ¤µ¤ì¤¿¤³¤È¤ò¸¡½Ð¤·¤¿¤é, ¥¯¥é¥¤¥¢¥ó¥È¤Ë |
|
{\tt OX\_NOTIFY} ¥Ñ¥±¥Ã¥È¤ª¤è¤Ó {\tt OX\_DATA} ¤Ç {\tt cmo\_null} ¤òÁ÷¤ë. |
|
¥¨¥ó¥¸¥ó¤Ï¥Õ¥¡¥¤¥ë¤òÍѤ¤¤Æ¥³¥ó¥È¥í¡¼¥ë¥µ¡¼¥Ð¤ËµÞ¤òÃΤ餻¤ë°Ê³°¤Ë, |
|
¶¦Í¥á¥â¥ê¤ä¥·¥°¥Ê¥ë¤òÍѤ¤¤Æ¤·¤é¤»¤Æ¤â¤è¤¤. |
|
*/ |
|
/*&eg |
|
Let us note that it is the control process that sends {\tt OX\_NOTIFY}. |
|
Therefore, the engine must ask the control server to send |
|
{\tt OX\_NOTIFY}. |
|
In the OpenXM, if the engine touches the file |
|
{\tt /tmp/.ox\_notify.pid}, then the control server sends |
|
the {\tt OX\_NOTIFY} header and the {\tt OX\_DATA} packet |
|
of {\tt cmo\_null}. |
|
Here, {\tt pid} is the process id of the engine. |
|
Engines and control processes may use a shared memory or a signal |
|
instead of the file {\tt /tmp.ox\_notify.pid}. |
|
*/ |