\begin{exe} {Monitoring Process States}

   \begin{enumerate}
      \item
      Use \textbf{dd} to start a background process which
      reads from \filelink{/dev/urandom} and writes to
      \filelink{/dev/null}.
      \item
      Check the process state.  What should it be?
      \item
      Bring the process to the foreground using the
      \textbf{fg} command.  Then hit \verb?Ctrl-Z?.  What
      does this do? Look at the process state again, what is
      it?
      \item
      Run the \textbf{jobs} program.  What does it tell
      you?
      \item
      Bring the job back to the foreground, then terminate it
      using \textbf{kill} from another window.
   \end{enumerate}
   \begin{sol}

      \begin{enumerate}
         \item
         \begin{cmd}
$ dd if=/dev/urandom of=/dev/null &
         \end{cmd}
         \item
         \begin{cmd}
$ ps -C dd -o pid,cmd,stat
         \end{cmd}
         \begin{response}
25899 dd if=/dev/urandom of=/dev/ R
         \end{response}
         Should be \verb?S? or \verb?R?.
         \item
         \begin{cmd}
$ fg
$ ^Z
$ ps -C dd -o pid,cmd,stat
         \end{cmd}
         \begin{response}
  PID CMD                         STAT
25899 dd if=/dev/urandom of=/dev/ T
         \end{response}
         State should be \verb?T?.
         \item
         Type the \textbf{jobs} command.  What does
         it tell you?

         \begin{cmd}
$ jobs
         \end{cmd}
         \begin{response}
[1]+  Stopped                 dd if=/dev/urandom of=/dev/null
         \end{response}
         \item
         Bring the job back to the foreground, then
         kill it using the \textbf{kill} command from
         another window.

         \begin{cmd}
$ fg
$ kill  25899
         \end{cmd}
      \end{enumerate}
   \end{sol}
\end{exe}

