\documentstyle[11pt]{article}

\addtolength{\oddsidemargin}{-0.5in}
\addtolength{\textwidth}{1.0in}
\addtolength{\textheight}{1.0in}
\addtolength{\topmargin}{-0.5in}

\begin{document}

\thispagestyle{empty}

\begin{center}
{\Large \bf CS-230 Final Exam} \\
\vspace*{0.1in}
June 9, 1993
\end{center}

\begin{enumerate}

\item
Draw a typical state transition diagram for the processes in an
Operating System.  Describe each of the states.  Explain which states
are necessary, and which are just desirable.  Why are they desirable?

\item
Suggest a way to implement semaphores ({\it ie.}, Create, Signal, and Wait)
using message passing.  (Hint: Introduce a separate synchronization process.)
Is hardware support for mutual exclusion required in your proposal?  
Why, or why not?

\item
An approach to file access sometimes used in modern operating systems
is to ``memory map'' the file.  When a file is opened by a process, the 
virtual memory space of the process is extended by the length of the file
and the file is used as the backing store for the added pages.  This
approach to file access allows the contents of the file to be referenced as
a data-structure in memory and explicit ``read'' and ``write'' operations
are no longer necessary.

Briefly discuss the advantages and disadvantages of this approach to file 
use from both the user's and operating system's point of view.  Be sure to
comment on the support needed to ``write'' to the file.  Also be sure to
mention any complexities added to virtual memory management.

\item
Preemptive round robin process scheduling is generally fair and a reasonable
choice for operating system use.  However, round robin scheduling can allow
response times to become intolerable when using a workstation with a highly 
interactive, graphical user interface.  One approach to shortening the
response time for mouse movements and button clicks is to split interactive
programs into two threads: one to deal just with the user interface, and
one to do all the real work. The interface thread can then be given a high
priority so it will immediately takes control when required.

Would a strict priority based scheduling scheme work in this situation?  Would
a scheme with varying priorities be better or worse?  Why?
If a strict two-layer priority scheduler was desired, what could
the operating system do to prevent abuse by users who give non-interface
threads a high priority?

\item
In class we discussed ways the operating system might improve the efficiency of
disk usage by carefully scheduling the order of disk sector reads and writes.
One concern raised in class was that arbitrarily reordering reads and writes 
would create problems because a sector read might move from before a write
to the same sector to after that write (or {\it vice versa}).

Explain why this confusion is not really a problem.  Start by describing
why it won't occur for a single process with exclusive access to a file.  
Then consider two processes sharing the same file.  Show by example that two 
processes sharing a file {\it without} explicit coordination will get 
confused even if the operating system does preserve the order of reads and 
writes to a file.  How might the processes explicitly
coordinate file access to prevent confusion?  

\end{enumerate}

\end{document}
