

\documentstyle[twocolumn]{article}

\setlength{\oddsidemargin}{0in}
\setlength{\evensidemargin}{0in}
\setlength{\topmargin}{-0.3in}
\setlength{\headheight}{0in}
\setlength{\headsep}{0in}
\setlength{\textwidth}{6.5in}
\setlength{\textheight}{9.8in}
\setlength{\parindent}{0in}

\begin{document}

\parskip 0.1in

\bf
\hfill Name:  $\underline{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \  \ \ \ \
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }$
\rm                         

{\bf Directions:} Work on this sheet (both sides, if needed) only;
{\bf do not turn in any supplementary sheets of paper}.  There is 
actually plenty of room for your answers, as long as you organize 
yourself BEFORE starting writing.  In order to get full credit, 
{\large\bf WRITE LEGIBLY} ($\infty$ points off for illegible 
handwriting!), and {\large\bf SHOW YOUR WORK}.  Make sure you work on 
the easier problems first (which will usually be the earlier problems, 
and within multi-part problems, the earlier parts).         

{\bf 1.}  (40)  Convert the prime-number program in Figure 5.1 of
the Linda book to Glenda, in the form of two programs, a manager
and a worker.  Keep changes to a minimum!

{\bf 2.}  (30)  Write a PVM program to do root-finding.  The function
f is monotonic with f(a) $<$ 0 and f(b) $>$ 0, so a root exists
somewhere between a and b.  The work is done iteratively.  Let
CSI denote the ``current search interval.''  Say we have n workers.
At iteration 0, CSI = (a,b).  At any given iteration, the CSI is
divided into n equal subintervals, and the i-th worker is assigned
the i-th subinterval.  Each worker evaluates f() at the left and
right endpoints of its subinterval, and reports back to the master
whether f() had opposite signs at the two endpoints.  Whichever
subinterval has this property then becomes the new CSI.  We iterate
until we find a subinterval at which f() evaluated at the left
endpoint is within $\epsilon$ of 0.0.  The values of n, a, b and
$\epsilon$ are specified within the command line, but f is assumed
to be linked in separately.

{\bf 3.}  (30)  Write a pair of C-Linda (i.e. Linda as in the examples
from the Linda book) functions barrier() and barrier\_server(n).  The
latter will run as a process, initiated via {\bf eval}(), while the
former will be invoked via a regular function call by worker programs.
This should be a ``guaranteed to work'' barrier.  The parameter n in
barrier\_server(n) is the number of workers; the function barrier()
will have no parameters.

\end{document}

