\documentstyle{article}

\begin{document}

\begin{flushright}
Michael B. Parker, MIT '89 \\
|\\
East Campus - Mun. 303 \\
3 Ames Street \\
Cambridge, MA 02139 \\
(617) 225-6303

\medskip

10 December 1987
\end{flushright}

\begin{flushleft}
Mr. Ken Sheldon\\
|\\
Byte Magazine \\
70 Main Street\\
Peterborough, NH 03458\\
(603) 924-9281\\
\bigskip
Dear Mr. Williams,\\
\bigskip
\end{flushleft}

To address the problems of multitasking understanding and portability
within the small systems world, I propose a series of three short articles
in which {\em the reader actually builds his or her own portable
multitasking environment}.

The articles, each which could stand alone, will address two
important needs of the mini- and micro-computer world:

\begin{description}

	\item[Understanding Need:] First, mini- and micro-computer
users are now realizing the benefits of multitasking their systems and
are becoming increasingly interested.  For years, users have wanted
multitasking but not understood it.  Programmers have needed it but
not known how to implement it.  The ``pop-up'' software and
``application-integrators'' found on the Macintosh and IBM PC indicate
the need for multitasking but have not fully satisfied that need.
Real and effective multitasking involves tricky synchronization and
coding issues not commonly understood in the small systems world.
Only recently are operating systems beginning to appear (Apple
MultiFinder, Microsoft OS/2) which provide multitasking support.  And
as users begin to appreciate them, I speculate {\em a growing need to
know how to operate and program within a multitasking environment.}

	\item[Portability Need:] Second, the few multitasking
environments which do exist on small systems are often very complex;
worse, they also demand special hardware which limit the portability of
their applications.  To be flexible and efficient, sophisticated
applications require multiple tasks; yet, because of the poor
multitasking constructs available, they quickly become bound to the
operating system and the machine on which they were written.  So as users
begin taking advantage of multitasking, I speculate {\em a growing need
for portability and standard multitasking constructs.}

\end{description}

My series, then, will {\bf explain} the programming concepts and
constructs of a multitasking environment, and {\bf construct} a
general-purpose multitasking environment which is portable to most
stack-based languages and computers.

\underline{Build A {\em Portable} Multitasking Environment in ``C''} will
be divided into three articles: {\em Switching Contexts}, {\em Organizing
a Task Force}, and {\em Managing Resources}.  The code for the
multitasking environment is already designed and suitable for
distribution on BIX.  To date, the code for the first article runs
successfully on {\em both} MS-DOS and UNIX operating systems (see the
UNIX ``man'' page (enclosed) for a brief synopsis of what it does).  With
it alone, the reader can write programs which have multiple threads of
execution and are {\em portable} between MS-DOS and UNIX.  Though this in
itself is a major achievement, the code also serves as an important
addition to both operating systems (MS-DOS provides no concurrency
mechanisms and UNIX provides no or little shared memory).

(See the outline and sample text (enclosed) for more information about
the first article.)

I have come to write this package for the same reason I expect your
readers will be interested in it.  I am one of your regular subscribers
and an undergraduate at MIT.  Funded by a competitive research grant from
the Institute, I am developing a distributed operating system for
heterogeneous small-systems environments.  The operating system requires a
solid but portable multitasking basis.

If you decide to go with this article (or perhaps the series), I look
forward to working with you so that I can tailor the article to your
requirements.

\medskip
Sincerely,
\bigskip
\begin{center}
Mike Parker\\
MIT - 1989
\end{center}

\newpage
\begin{figure}
\caption{Outline for {\em Switching Contexts}}

\begin{description}

	\item[Introduction] -
	\begin{enumerate}

		\item The Need for (Portable) Multitasking

		\item The Fundamental Context Switch...

	\end{enumerate}

	\item[What's A Context Switch?] -
	\begin{enumerate}

		\item The No-Return / Multiple-Return Approach

		\item The Switch-Function Approach

	\end{enumerate}

	\item[Building a Context Switch in ``C''] -
	\begin{enumerate}

		\item The Thread Cluster - Data Structure

		\item The Thread Cluster - Code Structure

		\begin{itemize}
			\item Achieving Atomicity with Signals and Semaphores
			\item Switching Between Contexts: {\em mpthd\_switch}
			\item Creating and Destroying Contexts:
				{\em mpthd\_init} and {\em mpthd\_dinit}
		\end{itemize}

	\end{enumerate}

	\item[Putting the Context Switch to Good Use] -
	\begin{enumerate}
		\item Software-Driven Switching $\Longleftarrow$ Interprocess Communication
		\item Hardware-Driven Switching $\Longleftarrow$ Resource Management
	\end{enumerate}

	\item[Conclusions] --

\end{description}
\end{figure}

\begin{figure}
\caption{Sample Text from {\em Switching Contexts}}

\begin{quote}
\begin{center} \bf
Build A \\
{\em Portable} Multitasking Environment\\
in ``C''\\
----------------------------------\\
{\em \#1 - Switching Contexts}
\end{center}

...In short, we would like to create a {\bf parallel programming
environment}, an environment which has several tasks to do at once
({\bf multitasking}) and possibly several processors to do them ({\bf
multiprocessing}).  In the heart of our parallel environment will live
the {\bf scheduler}, the ``computer's entrepreneur'' which tries to
schedule the processing resources to meet the tasks' computational
demands.  The scheduler insures each processor is hard at work on a
task; however, there are usually more tasks to run than there are
processors, and tasks will often insist on waiting for something and
could waste processor time.  Therefore, the scheduler must regularly
switch a processor from one task to another, it must {\bf switch} the
processor's {\bf context}.

Context switching is an extremely common activity within multitasking
environments; it must be done efficiently if the system is to perform
well.  It also is a highly machine-dependent activity; it involves
completely replacing the current {\bf state} of the processor with
another.  Most importantly, however, context switching is a delicate
and tricky operation; if not done with care and consistency, one
processor can unexpectedly crash the entire system, and the timing
bugs are unpredictable and often impossible to reproduce.  So for
efficiency, portability, and simplicity, this article presents a
context switch {\bf abstraction}, encapsulating all the details of
context switching into a single, powerful {\bf control construct}...

\end{quote}
\end{figure}

\end{document}
