version 1.7, 2000/01/15 03:46:27 |
version 1.12, 2000/01/17 07:15:52 |
|
|
% $OpenXM: OpenXM/doc/issac2000/session-management.tex,v 1.6 2000/01/15 00:20:46 takayama Exp $ |
% $OpenXM: OpenXM/doc/issac2000/session-management.tex,v 1.11 2000/01/17 06:10:41 noro Exp $ |
|
|
\section{Session Management} |
\section{Session Management} |
\label{secsession} |
\label{secsession} |
|
|
%Security (ssh PAM), initial negotiation of byte order, |
%Security (ssh PAM), initial negotiation of byte order, |
%mathcap, interruption, debugging window, etc. |
%mathcap, interruption, debugging window, etc. |
|
|
In this section we show the realization of control integration in |
In this section we explain our control integration in |
OpenXM. In OpenXM it is assumed that various clients and servers |
OpenXM. We assume that various clients and servers |
establish connections dynamically and communicate to each |
establish connections dynamically and communicate to each |
other. Therefore it is necessary to unify the communication interface |
other. Therefore it is necessary to give a dynamical and unified |
and the method of communication establishment. Besides, interruption |
method to start servers and to establish connections. |
of an execution and debugging are common operations when we use |
In addition to that, interruption of executions and |
programming systems. OpenXM provides a method to realize them for |
debugging facilities |
distributed computation. |
are necessary for interactive distributed computation. |
|
|
\subsection{Interface of servers} |
%\subsection{Interface of servers} |
|
% |
|
%A server has additional I/O streams for exchanging data between |
|
%a client and itself other than ones for diagnostic |
|
%messages. As the streams are for binary data, |
|
%the byte order conversion is necessary when a |
|
%client and a server have different byte orders. It is determined by |
|
%exchanging the preferable byte order of each peer. If the preference |
|
%does not coincide with each other, |
|
%then the network byte order is used. |
|
%This implies that all servers and clients should be able to |
|
%handle the network byte |
|
%order. Nevertheless it is necessary to negotiate the byte order to |
|
%skip the byte order conversion because its cost is often dominant over |
|
%fast networks. |
|
|
A server has additional I/O streams for exchanging data between |
\subsection{Invocation of servers} |
a client and itself other than ones for diagnostic |
\label{launcher} |
messages. As the streams are for binary data, |
|
|
An application called {\it launcher} is provided to start servers |
|
and to establish connections as follows. |
|
|
|
\begin{enumerate} |
|
\item A launcher is invoked from a client. |
|
When the launcher is invoked, the client |
|
informs the launcher of a port number for TCP/IP connection |
|
and the name of a server. |
|
\item The launcher and the client establish a connection with the |
|
specified port number. One time password may be used to prevent |
|
launcher spoofing. |
|
\item The launcher creates a process and executes the server after |
|
setting the data channel appropriately. |
|
\end{enumerate} |
|
|
|
After finishing the above task as a launcher, the launcher process |
|
acts as a control server and controls the server process created by |
|
itself. As to the control server see Section \ref{control}. |
|
|
|
As the data channel is used to exchange binary data, |
the byte order conversion is necessary when a |
the byte order conversion is necessary when a |
client and a server have different byte orders. It is determined by |
client and a server have different byte orders. It is determined by |
exchanging the preferable byte order of each peer. If the preference |
exchanging the preferable byte order of each peer. If the preference |
Line 31 order. Nevertheless it is necessary to negotiate the b |
|
Line 65 order. Nevertheless it is necessary to negotiate the b |
|
skip the byte order conversion because its cost is often dominant over |
skip the byte order conversion because its cost is often dominant over |
fast networks. |
fast networks. |
|
|
\subsection{Invocation of servers} |
|
\label{launcher} |
|
|
|
In general it is complicated to establish a connection over TCP/IP. |
|
On the other hand a server itself does not have any function to |
|
make a connection. In order to fill this gap an application called |
|
{\bf launcher} is provided. A connection is established by using |
|
the launcher as follows. |
|
|
|
\begin{enumerate} |
|
\item A launcher is invoked from a client or by hand. |
|
When the launcher is invoked, a port number for TCP/IP connection |
|
and the name of a server should be informed. |
|
\item The launcher and the client establish a connection with the |
|
specified port number. |
|
\item The launcher create a process and execute the server after |
|
setting the binary I/O channels appropriately. |
|
\end{enumerate} |
|
|
|
After finishing the above task as a launcher, the launcher process |
|
acts as a control server and controls the server process created by |
|
itself. As for a control server see Section \ref{control}. |
|
|
|
\subsection{Control server} |
\subsection{Control server} |
\label{control} |
\label{control} |
When we use a mathematical software, an execution time or necessary |
In OpenXM we adopted the following simple and robust method to |
storage is often unknown in advance. Therefore it is desirable |
control servers. |
to be able to abort an execution and to start another execution. |
|
In OpenXM we adopted the following simple and robust method. |
|
|
|
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 launcher introduced in Section \ref{launcher} |
server. The launcher introduced in Section \ref{launcher} |
is used as a control process. We call such a process a {\bf |
is used as a control process. We call such a process a {\it |
control server}. In contrast, we call a server for computation an {\bf |
control server}. In contrast, we call a server for computation an {\it |
engine}. In this case the control server and the engine runs on the |
engine}. As the control server and the engine runs on the |
same machine and it is easy to manipulate the engine, especially to |
same machine, it is easy to manipulate the engine, especially to |
send a signal from the control server. A control server is also an |
send a signal from the control server. A control server is also an |
OpenXM stackmachine and it accepts {\tt SM\_control\_*} commands |
OpenXM stack machine and it accepts {\tt SM\_control\_*} commands |
to send signals to a server or to terminate a server. |
to send signals to a server or to terminate a server. |
|
|
\subsection{Resetting a connection} |
\subsection{Resetting an engine} |
|
|
By using the control channel a client can send a signal to an engine |
A client can send a signal to an engine by using the control channel |
at any time. However, I/O operations are usually buffered and several |
at any time. However, I/O operations are usually buffered, |
additional operations on buffers after sending a signal is necessary |
which may cause troubles. |
to reset connections safely. Here a safe resetting means the |
To reset an engine safely the following are required. |
following: |
|
|
|
\begin{enumerate} |
\begin{enumerate} |
\item A sending of an {\tt OX} message must be completed. |
\item Any OX message must be a synchronized object in the sense of Java. |
|
|
As an {\tt OX} message is sent as a combination of several {\tt CMO} |
As an OX message is sent as a combination of several {\tt CMO} |
data, a global exit without sending all the data confuses the |
data, a global exit without sending all may generate broken data. |
subsequent communication. |
|
|
|
\item After restarting a server, a request from a client |
\item After restarting an engine, a request from a client |
must correctly corresponds to the response from the server. |
must correctly corresponds to the response from the engine. |
|
|
An incorrect correspondence occurs if some data remain on the stream |
An incorrect correspondence occurs if some data remain on the stream |
after restarting a server. |
after restarting an engine. |
\end{enumerate} |
\end{enumerate} |
|
|
{\tt SM\_control\_reset\_connection} is an {\tt SM} command to |
{\tt SM\_control\_reset\_connection} is a stack machine command to |
initiate a safe resetting of a connection. We show the action of |
initiate a safe resetting of an engine. |
a server and a client from the initiation to the completion of |
The control server sends {\tt SIGUSR1} to the engine if it receives |
a resetting. |
{\tt SM\_control\_reset\_connection} from the client. |
|
Under the OpenXM reset protocol an engine and a client act as follows. |
|
|
\centerline{\fbox{client}} |
\vskip 2mm |
|
\noindent |
|
{\it Client side} |
\begin{enumerate} |
\begin{enumerate} |
\item The client sends {\tt SM\_control\_reset\_connection} to the |
\item After sending {\tt SM\_control\_reset\_connection} to the |
control server. The control server sends {\tt SIGUSR1} to the engine. |
control server, the client enters the resetting state. It skips all {\tt |
\item The client enters the resetting state. it skips all {\tt |
|
OX} messages from the engine until it receives {\tt OX\_SYNC\_BALL}. |
OX} messages from the engine until it receives {\tt OX\_SYNC\_BALL}. |
\item After receiving {\tt OX\_SYNC\_BALL} the client sends |
\item After receiving {\tt OX\_SYNC\_BALL} the client sends |
{\tt OX\_SYNC\_BALL} to the engine and returns to the usual state. |
{\tt OX\_SYNC\_BALL} to the engine and returns to the usual state. |
\end{enumerate} |
\end{enumerate} |
|
|
\centerline{\fbox{engine}} |
\noindent |
|
{\it Engine side} |
\begin{enumerate} |
\begin{enumerate} |
\item After receiving {\tt SIGUSR1} from the control server, |
\item |
|
After receiving {\tt SIGUSR1} from the control server, |
the engine enters the resetting state. |
the engine enters the resetting state. |
\item If an {\tt OX} message is being sent or received, then |
The engine sends {\tt OX\_SYNC\_BALL} to the client. |
the engine completes it. This does not block because |
The operation does not block because |
the client reads and skips {\tt OX} messages soon after sending |
the client is now in the resetting state. |
{\tt SM\_control\_reset\_connection}. |
\item The engine skips all OX messages from the engine until it |
\item The engine sends {\tt OX\_SYNC\_BALL} to the client. |
receives {\tt OX\_SYNC\_BALL}. After receiving {\tt OX\_SYNC\_BALL} |
\item The engine skips all {\tt OX} messages from the engine until it |
the engine returns to the usual state. |
receives {\tt OX\_SYNC\_BALL}. |
|
\item After receiving {\tt OX\_SYNC\_BALL} the engine returns to the |
|
usual state. |
|
\end{enumerate} |
\end{enumerate} |
|
|
{\tt OX\_SYNC\_BALL} means an end mark of the data remaining in the |
\begin{figure}[htbp] |
I/O streams. After reading it it is assured that each stream is empty |
\epsfxsize=8.5cm |
|
\epsffile{reset.eps} |
|
\caption{OpenXM reset procedure} |
|
\label{reset} |
|
\end{figure} |
|
|
|
Figure \ref{reset} illustrates the flow of data. |
|
{\tt OX\_SYNC\_BALL} is used to mark the end of data remaining in the |
|
I/O streams. After reading it, it is assured that each stream is empty |
and that the subsequent request from a client correctly |
and that the subsequent request from a client correctly |
corresponds to the response from the server. |
corresponds to the response from the engine. |
We note that we don't have to associate {\tt OX\_SYNC\_BALL} with |
We note that we don't have to associate {\tt OX\_SYNC\_BALL} with |
any special action to be executed by the server because it is |
any special action to be executed by the engine because it is |
assured that the peer is in the resetting state when one receives |
assured that the engine is in the resetting state when it has received |
{\tt OX\_SYNC\_BALL}. |
{\tt OX\_SYNC\_BALL}. |
|
|
\subsection{Debugging supports} |
\subsection{Debugging facilities} |
To help debugging on the server, various supports are possible. If |
Debugging is sometimes very hard for distributed computations. |
servers are executed on X window system, then the control server can |
We provide two methods to help debugging on X window system: |
attach an {\tt xterm} to the standard outputs of the engine to display |
1. the diagnostic messages from the engine are displayed in a {\tt xterm} |
diagnostic messages from the engine. |
window; |
Furthermore, if the engine provides an interface to input commands, |
2. the engine can pop up a window to input debug commands. |
then debugging of user defined programs will be |
For example {\tt ox\_asir}, which is |
possible. For example {\tt ox\_asir}, which is |
the OpenXM server of Risa/Asir, can pop up a window to input |
the OpenXM server of {\tt Risa/Asir}, can pop up a window to input |
|
debug commands and the debugging similar to that on usual terminals is possible. |
debug commands and the debugging similar to that on usual terminals is possible. |
One can also send {\tt SIGINT} by using {\tt SM\_control\_to\_debug\_mode} |
One can also send {\tt SIGINT} by using {\tt SM\_control\_to\_debug\_mode} |
and it provides a similar functionality to entering the debugging |
and it provides a similar functionality to entering the debugging |