%% LATEX TWICE TO GET THE REFERENCES RIGHT
%%\documentstyle[12pt]{article}
\documentstyle[11pt,epsf,psfig]{article}

\newcommand{\postscript}[2]
 {\setlength{\epsfxsize}{#2\hsize}
  \centerline{\epsfbox{#1}}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newtheorem{theorem}{Theorem}
\newtheorem{itlemma}{Lemma}[section] %number by section (set in \em by default)
%%%same numbering counter as itlemmas:
\newtheorem{itproposition}[itlemma]{Proposition}
\newtheorem{itcorollary}[itlemma]{Corollary}
\newtheorem{itremark}[itlemma]{Remark}
\newtheorem{itnote}[itlemma]{Note}
\newtheorem{itobservation}[itlemma]{Observation}
\newtheorem{itdefinition}[itlemma]{Definition}
\newtheorem{itexercise}[itlemma]{Exercise}
\newtheorem{itexample}[itlemma]{Example}

\newenvironment{lemma}{\begin{itlemma}\rm}{\end{itlemma}} %no-italics
\newenvironment{remark}{\begin{itremark}\rm}{\end{itremark}} %no-italics
\newenvironment{observation}{\begin{itobservation}\rm}{\end{itobservation}} %no-italics
\newenvironment{corollary}{\begin{itcorollary}\rm}{\end{itcorollary}}
\newenvironment{proposition}{\begin{itproposition}\rm}{\end{itproposition}}
\newenvironment{definition}{\begin{itdefinition}\rm}{\end{itdefinition}}
\newenvironment{exercise}{\begin{itexercise}\rm}{\end{itexercise}}
\newenvironment{example}{\begin{itexample}\rm}{\end{itexample}}

\tolerance=1600 %allow some tolerance in extending after line.
\parskip=3pt plus 1pt minus 1pt
\overfullrule=0pt %no dark lines if overfull

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% These are for choices.  They take 4 or 6 args
%% (carriage returns allowed in between}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\twoif}[4]{
\left\{ \begin{array}{ll}#1&#2\\#3&#4\end{array}\right.
}
\newcommand{\threeif}[6]{
\left\{ \begin{array}{ll}#1&#2\\#3&#4\\#5&#6\end{array}\right.
}
\newcommand{\fourif}[8]{
\left\{ \begin{array}{ll}#1&#2\\#3&#4\\#5&#6\\#7&#8\end{array}\right.
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\partmlab#1#2#3#4#5#6#7#8{\bordermatrix{&#1&#2\cr#3&#5&#6\cr
                                        \noalign{\medskip}#4&#7&#8\cr}}
%% For 2by2 partitioned matrices; arguments are: two labels of top, side,
%% 4 entries (row by row).  If entries are themselves matrix or pmatrix,
%% better for readability of source to define first: \def\matrix1{...} etc.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\bigframebox}[1]{\framebox{\parbox{\smallerwidth}{#1}}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Warning: use \noindent before!
% AND IN TEXT, after begin doc, do:
% \newlength{\smallerwidth}  %for bigboxes
% \setlength{\smallerwidth}{\textwidth}
% \addtolength{\smallerwidth}{-8pt}        %MUST BE DONE AFTER begin doc
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def \beq {\begin{eqnarray}}
\def \eeq {\end{eqnarray}}
\def \beqn {\begin{eqnarray*}}
\def \eeqn {\end{eqnarray*}}

\newcommand{\rf}[1]{[\ref{#1}]}            %bibliographical references

\newcommand{\text}[1]{\hbox{\rm \ #1\ \/}}
\newcommand{\be}[1]{\begin{equation}\label{#1}}
\newcommand{\ee}{\end{equation}}
\newcommand{\bl}[1]{\begin{lemma}\label{#1}}
\newcommand{\ble}[1]{\begin{lemmaex}\label{#1}}
\newcommand{\br}[1]{\begin{remark}\label{#1}}
\newcommand{\bn}[1]{\begin{note}\label{#1}}
\newcommand{\bo}[1]{\begin{observation}\label{#1}}
\newcommand{\bt}[1]{\begin{theorem}\label{#1}}
\newcommand{\bd}[1]{\begin{definition}\label{#1}}
\newcommand{\bp}[1]{\begin{proposition}\label{#1}}
\newcommand{\bc}[1]{\begin{corollary}\label{#1}}
\newcommand{\bfact}[1]{\begin{fact}\label{#1}}
\newcommand{\ber}[1]{\begin{exercise}\label{#1}}
\newcommand{\bex}[1]{\begin{example}\label{#1}}
\newcommand{\bem}[1]{\begin{example}\label{#1}}    %Yes, 2 different ones :-)
\newcommand{\ec}{\mybox\end{corollary}}
\newcommand{\efact}{\mybox\end{fact}}
\newcommand{\eer}{\mybox\end{exercise}}
\newcommand{\eex}{\mybox\end{example}}
\newcommand{\eem}{\mybox\end{example}}
\newcommand{\el}{\mybox\end{lemma}}
\newcommand{\ele}{\mybox\end{lemmaex}}
\newcommand{\er}{\mybox\end{remark}}
\newcommand{\en}{\mybox\end{note}}
\newcommand{\eo}{\mybox\end{observation}}
\newcommand{\et}{\qed\end{theorem}}
\newcommand{\ed}{\mybox\end{definition}}
\newcommand{\ep}{\mybox\end{proposition}}
\newcommand{\epr}{\end{proof}}
\newcommand{\bpr}{\begin{proof}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%  These are just for statements, no "qed" box is put in.
%%  (Also for when I have to finish something after a displayed equation
%%        or itemized.)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\ecs}{\end{corollary}}
\newcommand{\eers}{\end{exercise}}
\newcommand{\eexs}{\end{example}}
\newcommand{\eems}{\end{example}}
\newcommand{\els}{\end{lemma}}
\newcommand{\eles}{\end{lemmaex}}
\newcommand{\ers}{\end{remark}}
\newcommand{\ens}{\end{note}}
\newcommand{\eos}{\end{observation}}
\newcommand{\ets}{\end{theorem}}
\newcommand{\eds}{\end{definition}}
\newcommand{\eps}{\end{proposition}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\qed}{\hfill \halmos} %put \qed at right margin
\newcommand{\mybox}{\hfill $\Box$} %put \qed at right margin (white square)

%%%\newcommand{\pmat}[2]{\left( \begin{array}{#1} #2 \end{array} \right) }
%%%use as e.g. \pmat{cc}{ a&b\\ a &c }  Note 'cc' for 2 Centered cols
%%%can also use \pmatrix{ a&b\cr a &c \cr} for plainTeX standard construct
%%%\setcounter{page}{27} should set the CURRENT page to 27

\def \R {\bb R} % reals
\def \C {\bb C} % complexes
\def \Z {\bb Z} % integers
\def \X {\bb X} % for this paper only!
\def \inter {{\rm int \,}}
\def \rank {{\rm rank \,}}
%%%\def \inf {{\rm inf \,}}  %better in Latex -- subscripts OK!
%%%\def \min {{\rm min \,}}
\def \im {{\rm im \,}}
\def \ker {{\rm ker \,}}
\def \norm #1{\Vert #1 \Vert}
\def \ip #1\by #2{\langle #1 , #2 \rangle}
\def \Sone {{\bf S}^1} % circle
\def \wigglearrow {\sim \mkern -6mu >}

\def \today {\ifcase \month \or January\or February\or  
  March\or April\or May\or June\or July\or August\or 
  September\or October\or November\or December\fi\   
  \number \day, \number \year}                       
\newcommand{\comment}[1]{}
\newcommand{\halmos}{\rule{1ex}{1.4ex}}
%%%alternative to \qed (see below)
\newenvironment{proof}{\noindent {\em Proof}.\ }{\hspace*{\fill}$\halmos$\medskip}

%%%\def\qed{\kern 1em \vrule height .5em width .5em depth 0em}
%%%(I now use new qed: in right margin)

\def\vbar{\mathchoice{\vrule height6.3ptdepth-.5ptwidth.8pt\kern-.8pt}
   {\vrule height6.3ptdepth-.5ptwidth.8pt\kern-.8pt}
   {\vrule height4.1ptdepth-.35ptwidth.6pt\kern-.6pt}
   {\vrule height3.1ptdepth-.25ptwidth.5pt\kern-.5pt}}
\def\fudge{\mathchoice{}{}{\mkern.5mu}{\mkern.8mu}}
\def\bbc#1#2{{\rm \mkern#2mu\vbar\mkern-#2mu#1}}
\def\bbb#1{{\rm I\mkern-3.5mu #1}}
\def\bba#1#2{{\rm #1\mkern-#2mu\fudge #1}}
\def\bb#1{{\count4=`#1 \advance\count4by-64 \ifcase\count4\or\bba A{11.5}\or
   \bbb B\or\bbc C{5}\or\bbb D\or\bbb E\or\bbb F \or\bbc G{5}\or\bbb H\or
   \bbb I\or\bbc J{3}\or\bbb K\or\bbb L \or\bbb M\or\bbb N\or\bbc O{5} \or
   \bbb P\or\bbc Q{5}\or\bbb R\or\bbc S{4.2}\or\bba T{10.5}\or\bbc U{5}\or
%%%   \bbb P\or\bbc Q{5}\or\bbb R\or\bba S{8}\or\bba T{10.5}\or\bbc U{5}\or
   \bba V{12}\or\bba W{16.5}\or\bba X{11}\or\bba Y{11.7}\or\bba Z{7.5}\fi}}
%
%
\renewcommand{\thefootnote}{\fnsymbol{footnote}}
%%% read as: theFOOTNOTE (i.e. the command  executed when doing a footnote) is
%%% now to be set as a FOOTNOTESYMBOL (type of number) value of counter
%%% FOOTNOTE (Instead of Roman).  See LaTeX manual pp.91-92 as well as 175.
\def\bi{\begin{itemize}}
\def\ei{\end{itemize}}
\def\ben{\begin{enumerate}}
\def\een{\end{enumerate}}
\def\st{\, | \,}

\newcommand{\myboxineq}{\eqno\Box} %put \qed at margin (white square) in eqn
\newcommand{\qedineq}{\eqno\halmos} %put \qed at margin in eqn

\topmargin -0.5in %default is 0.0, i.e. 1 inch from top.  Now it is 0.5
\textheight 9in
\oddsidemargin 0.25in %more reasonable margins!  (This is 1.25; can use <0 too)
\evensidemargin 0.25in %(same as above)
\textwidth 6.25in %(could use also -.5,-.5,7.5 for instance)
\tolerance=1600 %allow some tolerance in extending after line.
\parskip=3pt plus 1pt minus 1pt
\overfullrule=0pt %no dark lines if overfull

%%%% FROM HERE, macros special for paper
\def\mm{m}
\def\pp{p}
\def\proj{\pi _1} % projection on first group of coordinates
\def\x{u}  % vector argument
\def\SEC{(SEC)}
\def\SECo{(SEC$^0$)}
\def\INV{(INV)}
\def\Fp{{\cal F}_\pp}
\def\Fpm{{\cal F}_\pp^\mm}  %there is a 3,3 and a 2,1 in text

\def\Rm{\R^m}
\def\Rn{\R^n}
\newcommand{\ball}[2]{{\bb B}(#1,#2)}
\newcommand{\cball}[2]{\overline {\bb B} (#1,#2)}
\def\Fnm{{\cal F}_n^\mm}
\def\clos{{\rm clos\,}}
\def\inter{{\rm int\,}}

\def\CCF{compatible class of functions}
\begin{document}

\bibliographystyle{alpha}
\begin{center} 
{\LARGE\bf 
Synchronization Technique for a Collaborative Application
}
\vspace{1cm}

{\large
M. A. Saleh Elmohamed, Dongmin Kim and Geoffrey Fox\\}
\vspace{.5cm}
Northeast Parallel Architectures Center\\
Syracuse University, Syracuse, NY 13244\\
\vspace{.25cm}
\{saleh, kimd, gcf\}@npac.syr.edu\\
\end{center}

\vspace{1cm}
\centerline{\today}

\vspace{1.5cm}
\centerline{ABSTRACT}
We investigate a synchronization protocol for a master-clients model 
on web-based collaborative systems in general, and on the
collaborative framework of Tango Interactive
(http://www.npac.syr.edu/tango) in particular. Also as part of the
investigation, we look at issues of synchronization overhead, relative
speed of various platforms (i.e. the heterogeneity of the master and
clients platforms.), and late joining of clients to the collaboratory
sessions.

\vspace{4cm} 
% \vfill

\vfill

\newpage
\pagestyle{plain}
\pagestyle{myheadings}
%% \markright{\sl SCCS report }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Introduction}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setcounter{page}{1}
The aspect of synchronization is quite important in problem-solving
collaboratory environment such as web-based distance
education. Java-based collaborative systems such as Tango, which is 
now primarily used for distance learning, don't usually have built-in
synchronization techniques to correctly support the
master(i.e. teacher)-clients(i.e. students) model when the need arise 
to deal with simulation-based tools or applets during the course of
the lecture. 

In this report we outline a synchronization protocol that we have
developed specifically for Tango to remedy the aforementioned
shortcomings. In addition we analyze three issues that might arise
during a collaboratory session of distance learning, and possible ways
of properly handling or avoiding these type of problems. 

\section{Collaborative Systems}

--Including summary of Tango's architecture--

\subsection{Key Challenges}
Collaborative applications over the network combine the challenges of
distributed systems with those of user interface systems. Such
interfaces would require instantaneous feedback and quick reaction
time. On the other hand distributed systems depend on a network of
unknown size and reliability to transfer data. This raises two
fundamental issues that need to be addressed: First, there is the
problem of nondeterministic latency of not knowning will it take for
the data to traverse the network. Second, and more important is how to 
handle the issue of partial failure in some part of the system without 
having much effects on the working parts.


\section{Application-level Synchronization}
Our synchronization or ``lock-step'' protocol for Tango is something
similar to the application-level transactions a user provide on top of
Sun's JSDT (Java Shared Data Toolkit).

\subsection{Outline of the Protocol}
Let's assume the system is represented by three
processes: {\bf proc1} for master (professor), {\bf proc2} for clients
(students) who are present at the start of session, and {\bf proc3}
for those later just-joined-in clients.


{\bf \underline{Master}}
\begin{itemize}
\item Set up the application.

\item Set {\it integer} {\bf intervalTimeLimit} = <value1>, integer {\bf
      iterationNum} = <value2>, boolean {\bf start} = true, integer {\bf
      counter} = 0, boolean {\bf synchFlag} = false, boolean {\bf stop} = false.

\item Get list of {\bf clients} from Tango  --- set them to {\bf proc2}
  group.

\item Set {\bf listener} to add clients to {\bf proc3} group as they
  join in the session.

\item Set overall {\bf convergence criterion}.

\item Set {\bf timer}.

\item Outer loop: \underline{While no convergence do}
\begin{enumerate}
  \item Run simulation (compute and render) till

      synchFlag = {\bf if (counter $\geq$ iterationNum)} or/and 
      {\bf if (timer $\geq$ intervalTimeLimit)}  ``whichever chosen by the user
      to be true''. 

  \item {\bf if (synchFlag)} 
       { 
    \begin{itemize}
        \item broadcast (iterationNum, intervalTimeLimit, start) to
           proc2 and proc3 clients;
        \item reset {\bf timer} = 0, {\bf counter} = 0;
        \item Optional: reset {\bf intervalTimeLimit} = <newvalue>
               or/and reset {\bf iterationNum} = <newvalue>;
        \item wait for clients to respond with their states;
    \end{itemize}
       }
     else 
       { 
        {\bf if (counter < iterationNum)} or/and 
        {\bf if (timer < intervalTimeLimit)} 
         {
          \begin{itemize}
           \item increment {\bf counter};
           \item increment {\bf timer};
           \item continue at outer loop;
          \end{itemize}
        }
      }
 \item if all clients in {\bf proc2} respond before reaching 
       {\bf intervalTimeLimit} {continue at the outer loop; }

        else { move ``un-responded'' clients from {\bf proc2} to {\bf proc3};
               continue at the outer loop; }

 \item if any of {\bf proc3} clients indicate to master they have caught up 
         before next round of iteration at outer loop:
  \begin{itemize}
   \item move them from {\bf proc3} to {\bf proc2};
   \item continue at the outer loop;
  \end{itemize}
 \end{enumerate}
\end{itemize}


{\bf \underline{Clients}}

\begin{itemize}
\item Listen for {\bf iteratnum} and {\bf intervallimit} messages
  coming from {\bf Master}.

\item When received post the {\bf Master iteration limit} as 
         the {\bf iteratnum} for {\bf client} user to see (on the
         applet).

\item Post your {\bf iteratnum} as iterations proceed.

\item Set the {\bf stop flag} to {\bf iteratnum + intervallimit}
        and restart (start if {\bf iteratnum} equal 0) the simulation.

\item If you are behind, then a new {\bf iteratnum} and {\bf
    intervallimit} message will arrive while you are simulating.

\item If so just reset flags and proceed. 

\item If you reach the {\bf stop flag} before {\bf
    iteratnum + intervallimit} message arrives, then you are a {\bf proc2}
  client. 

\item Send a completion message to {\bf Master} and wait for restart
message. 
 
\item Tell {\bf client} user what the status is.
\end{itemize}

{\bf NOTE}: From this one can characterize the functional difference
between {\bf proc2} and {\bf proc3} with respect to {\bf proc1} as follows:
   {\bf proc1} is prepared to wait for a response from {\bf proc2} up
   to the  {\bf intervallimit}, while it won't for {\bf proc3}. In
   other words, {\bf proc2} responds {\it synchronously} to {\bf proc1}
   while {\bf proc3} responses are {\it asynchronous}. 


\section{On the Issues Involved}

Several points to be considered:

\begin{enumerate}
\item As mentioned above, the three key issues we will need to take
  into account are: synchronization overhead and this will involve
  things such as network communication, etc., late arrival clients,
  and the relative speed of various hardware platforms used in the
  collaboration (i.e. the heterogeneity of the platforms).

\item The CFD applet is used merely as an example but the above
  protocol is general enough to be applicable to other applications.

\item The time of the interval need to be considered as a parameter
  with a value dependent on the degree of variation of speed between
  the platform used by the master and those of the clients.

\item On the issue of late arrival of clients, in order to bring them 
  up to speed with the session we perhaps will need to look into
  separating the function of computation from the function of
  rendering in the application. That is, late arriving clients need 
  only do computation but no rendering until they actually catch up
  with the master$\ldots$ This point will probably greatly depends on 
  the application or the applet itself and whether it was designed in
  such a way that there is clean separation between the parts that are
  involved in computation and those involved in rendering. If such a
  clean separation exists then this would make it much simpler to
  handle the issue of late arrivals. Otherwise, if possible, only
  a minimal amount of rendering to be done while carrying on with the 
  computation.
\end{enumerate} 

\end{document}

