

\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}
\setlength{\parskip}{0.1in}

\begin{document}

\bf
\hfill Name:  $\underline{ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }$
% \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
\rm
\bigskip
                                      
{\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
\normalsize\rm
($\infty$ points off for illegible handwriting!), and
\large\bf
SHOW YOUR WORK.  The earlier problems, and the earlier parts within each 
problem, are intended to be easier---MAKE SURE YOU WORK ON THEM FIRST!  
\normalsize\rm

{\bf 1.}  In the context of the CRL paper, consider a matrix-multiply
operation, in which we multiply an NxN matrix A by an Nx1 vector X,
storing the result in Y.  Let G denote a ``group size''; it does not
correspond to any physical hardware grouping, but rather just a grouping
in the following software sense.  Let K = P/G, where P is the number of
processors; K will then be the number of groups.  Let R = N/K.  (K and R
are assumed to be integers.) We will assign the first R rows of A to
processors 0 through G-1, the second set of R rows to processors G
through 2G-1, and so on.  We will have an array

\begin{verbatim}
int NextRow[MAX_GROUPS];
\end{verbatim}

to allocate tasks.  For processor I, we look at NextRow[J], where

\begin{verbatim}
J = I / G;
\end{verbatim}

We then execute

\begin{verbatim}
Row = NextRow[J]++;
\end{verbatim}

where Row is a local (i.e. nonshared) variable.   We then multiply the
Row-th row of A by X.

\begin{itemize}

\item [(a)]  (15) Fill in the blank:  The larger N is, the
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ the task granularity.

\item [(b)]  (15) Fill in the blank with a number:  If we were to run such
code on Alewife, on the native machine without CRL, we should probably
make sure that G is at most \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_.

\item [(c)]  (10) Fill in the blank, {\it using an official term from
the paper} :  Again if we were to run such
code on Alewife, on the native machine without CRL, we should change
the declaration of NextRow in such a way that its elements will be
widely separated, in order to avoid
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_.

\end{itemize}

{\bf 2.}  Answer the following questions about CRL.

\begin{itemize}

\item [(a)]  (15) Fill in the blank:  In the shared-memory programming
paradigm, one issue which arises is the degree to which the 
order of writes as perceived by the programmer will be preserved
in the actual accessing of memory.  Many policies for this are in
common use by various systems.  Of these, a policy which is similar
to the one used by CRL is \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_.

\item [(b)]  (10) Does CRL seem to have good scalability?  Cite something
in the paper to back up your answer.

\item [(c)]  (10) An apparent drawback of CRL is that it makes the
programmer work harder, since he or she must invoke functions like
rgn\_start\_write().  However, the authors claim that on a lot of
hardware-based systems the programmer would have to work this hard
anyway.  Explain why, and cite the relevant paragraph in the paper.

\end{itemize}

{\bf 3.}  (25) In our LindaDSM homework assignment, suppose we were to
distinguish between read and write accesses, so that DSMAccess() would
be replaced by DSMStartRead() and DSMStartWrite(), while DSMRelease()
would be replaced by DSMEndRead() and DSMEndWrite().  

A read request will block if a write is in progress.   A write request
will block if any operation is in progress.  Otherwise requests
execute right away.

Explain how to do this by adding a new field to the shared-variable
tuples, and write the code for DSMInit() and the four new functions
listed above.  (If you need a hint, let me know; you will still get 2/3
credit if you implement it correctly.)  

You must follow these constraints:  The arguments must be the same as
before (this actually would not be completely necessary, but follow this
anyway).  Avoid explicit polling, as discussed in the POSYBL paper..

\end{document}


