
\documentclass[twocolumn]{article}

\setlength{\oddsidemargin}{-0.5in}
\setlength{\evensidemargin}{-0.5in}
\setlength{\topmargin}{0.0in}
\setlength{\headheight}{0in}
\setlength{\headsep}{0in}
\setlength{\textwidth}{7.0in}
\setlength{\textheight}{9.5in}
\setlength{\parindent}{0in}
\setlength{\parskip}{0.05in}
\setlength{\columnseprule}{0.3pt}
\usepackage{fancyvrb}
\usepackage{relsize}
\usepackage{hyperref}

\begin{document}

Name: \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_

Directions: {\bf Work only on this sheet} (on both sides, if needed); 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.

{\bf 1.} (20) List the various arrays from our book that are created by
the OS.  In each case, state whether the array is accessed by the
hardware.

\begin{tabular}{|r|r|}
\hline
array name in book & hardware access? \\ \hline 
\hline
\ \ \ \ \  & \  \\ \hline 
\ \ \ \ \  & \  \\ \hline 
\ \ \ \ \  & \  \\ \hline 
\ \ \ \ \  & \  \\ \hline 
\ \ \ \ \  & \  \\ \hline 
\ \ \ \ \  & \  \\ \hline 
\ \ \ \ \  & \  \\ \hline 
\end{tabular}

{\bf 2.} Running the Linux {\bf pstree} command displays ``parents''
and ``children'' of processes.  Suppose we run the command on CSIF, and
notice that there is a {\bf gcc} process running.  

   \begin{itemize}

   \item [(a)] (15) The likely parent of that process is either 
   \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  or
   \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  or 
   \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  or ...
   (Fill in as many command names as appropriate; answer ``none'' if 
   there is likely no parent.)

   \item [(b)] (15) The likely child of that process is either 
   \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  or
   \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  or 
   \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  or ...
   (Fill in as many command names as appropriate; answer ``none'' if 
   there is likely no child.)

   \end{itemize}

{\bf 3} (20) Consider the 11-line excerpt of Linux internal code on
p.186, at the instant just before line 12 is executed.  Suppose at that
time, c(ESP) = 0x8000.  What will be in memory location 0x8000 at that
time?

{\bf 4.} Consider the threads example that begins on p.190.

   \begin{itemize}

   \item [(a)] (15) For each of the following variables in the code, write
   either SAAT (``same address across threads'') or DAAT (``different
   address across threads'').

   \begin{tabular}{|r|r|}
   \hline
   {\bf kb} & \ \ \ \ \  \\ \hline 
   {\bf nthreads} & \ \ \ \ \  \\ \hline 
   {\bf id[0]} & \ \ \ \ \  \\ \hline 
   \end{tabular}

   \item [(b)] (15) Suppose we run the program with the command

   \begin{Verbatim}[fontsize=\relsize{-2}]
   % hw /dev/pts/2 /dev/pts/5 /dev/pts/6
   \end{Verbatim}

   and we then type {\bf ps axH} in another window.  In the output of
   this latter command, we will likely see
   \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ entries for {\bf hw},
   \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ of which are in Run state,
   and \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ of which are in Sleep
   state.

   \end{itemize}

{\bf 
Solutions:} 

{\bf 1.}  

\begin{tabular}{|r|r|}
\hline
array & hardware access? \\ \hline 
\hline
memory-allocation table & no  \\ \hline 
process table & no  \\ \hline 
page table & yes  \\ \hline 
interrupt vector table & yes  \\ \hline 
\end{tabular}

{\bf 2a.} {\bf tcsh}, {\bf make}

{\bf 2b.} {\bf cpp}, {\bf cc1}, {\bf as}, {\bf ld}

{\bf 3.} PC value of the process that we are about to resume (called
{\bf v} in the text)

{\bf 4a.}

   \begin{tabular}{|r|r|}
   \hline
   {\bf kb} & DAAT\\ \hline 
   {\bf nthreads} & SAAT \\ \hline 
   {\bf id[0]} & SAAT \\ \hline 
   \end{tabular}

{\bf 4b.} 4, 1, 3

\end{document}

