[comp.sys.apple2] Initial proposal for a multi-tasking OS

stephens@latcs1.oz.au (Philip J Stephens) (03/08/90)

   Right-o.  I've come in for a lot of flak due to some premature comments
about Unix and all that (not without reason, but still...), so here is an
initial proposal for designing a simple multi-tasking OS on _any_ Apple, using
ideas already suggested by other people (I hope they haven't rushed out to
copyright them :-)  Note this no longer has anything to do with Unix!

   To begin with, we will need to write programs in relocatable code,
which is then modified to run at a specific address by a linker/loader.
Further, the program must be confined to a range of "virtual" memory that will
not change during it's execution.  Absolute references (particularly to
zero pages) will be allowed, but it will be up to the programmer to ensure
they are used properly.
   It is also up to the programmer (or compiler) to insert BRK instructions
at the approapiate points in the code.  As Todd suggested, we can include 
additional parameters after the BRK instruction, and make it a general entry
point into the OS.

   The OS will keep a memory map indicating which range of pages are allocated
to currently executing programs.  For simplicity, the entire program will be
present in RAM.  When a new program is to be multi-tasked, the OS will choose
an area of RAM to load the program into and protect it's pages.  When a program
completes execution, (via a BRK entry), the OS will free it's pages.

   The OS will also keep a record of a processes context.  This will include
all of the registers, zero page, and maybe even the stack.  Every time a
program BRK's, this context will be saved.  It is then a simple task for the
OS to choose the next program to execute (probably in a round robin affair). 

   The OS would also provide entry points (via BRK) to I/O functions and the
like; infact, we could hook up the ProDOS MLI to provide disk access
functions, and use ROM routines for screen and keyboard I/O.

   In other words, the OS I am proposing would just be a small system running
under ProDOS, which handled all of the BRK requests for executing programs.
I would imagine that we could also provide a shell program that multi-tasked
along with everything else, and which would act as the user front-end.

                         ----------------------

   There you have it.  I don't really think that paging is necessary; maybe
you wouldn't be able to multi-task many programs in 64K, but on a GS with
1 Meg of RAM...
   Furthermore, the overhead for switching programs wouldn't be too high, so
programs would run at quite a decent speed.

   What do people think?

</\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\></\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\>
<  Philip J. Stephens                ><   "Many views yield the truth."        >
<  Hons. student, Computer Science   ><   "Therefore, be not alone."           >
<  La Trobe University, Melbourne    ><          - Prime Song of the viggies   >
<\/\/\/\/\/\/\/\/\/\/\/\/\/\/\//\/\/\><\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/>