Operating Systems : The Basics
Operating Systems were developed to provide a convenient method for loading and running other
programs and to provide a collection of commonly used service subroutines. Various utility
programs, especially those dealing with file management, have almost always been included with
operating systems as well.
A General Purpose Program Loader
Dedicated vs. General Purpose Systems
- Dedicated Systems are used for a single purpose (e.g. a "word-processing machine") and may be automatically loaded with a single application program, without the need (or ability) to switch to some other type of application program (and thus without the need for an Operating System "loader" function).
- General Purpose Systems are used for many different applications depending upon the user's requirements at any specific time. Automatic loading of not single application would satisfy this need; therefore, a more general program is required which will allow the user to select applications to be loaded and executed as required.
Getting the First Program into Memory
- No matter whether the initial program is an "application" (for a dedicated system) or a general purpose Operating System which can load and run other programs, the computer needs to execute instructions which will load this initial program into memory when the computer is turned on (or re-set).
- Theoretically, the initial program could be contained in a ROM, avoiding the need to load it from an external source, but in practice this is not practical. It means that there would be no easy or cost-effective way to upgrade the Operating System or supply "fixes" to "bugs".
- Normally, only a very simple program loader is provided in ROM which can only load a single program from a fixed physical location on an external device (normally from the first "sector" or "physical record" on the first disk drive). Such a program in ROM is called the "bootstrap loader". The first physically record read into memory must contain more code to load the remainder of the initial program; this "first record" is called the "bootstrap" program.
Loading Programs on Command
- A general purpose Operating System must contain the ability to copy application program files into memory upon user request.
- Address adjustments may be required to the loaded application program to allow for the fact that the program will not always be loaded into memory at the same location (for examples, with different Operating System versions).
- With most (but not all) Operating Systems, once the application program has been loaded (and possibly modified) the Operating System will "jump" to the first instruction of the application program. When application programs terminate, they should "jump" back to the Operating System to permit loading and execution of subsequent applications.
Service Subroutines
Common Routines
- Routines that are required by most/many programs; typically dealing with input/output operations
- Get the next character that was typed on the keyboard
- Display a character on the video screen
- Read or write a block of data from (or to) a disk
Hardware Dependant Routines
- Certain functions may be contained in the Operating System although they are not (necessarilly) used by most programs. They may be present in order to permit control of some hardware device or feature that an application program could not normally be expected to know how to control (e.g. a non-standard I/O device).
Accessing Service Subroutines
- Need to be able to use these routines in a manner similar to how a program would "call" one of its own subroutines.
- Need to be able to use the same application programs (that use these service routines) with later versions of the same Operating System.
- With new versions of an Operating System, the service routines will have different sizes and will end-up being loaded into memory at different starting addresses.
- Because of these conflicting requirements, an application program can not contain the actual address of the Operating System service routine it needs to "call".
- The most common solution to this problem is for the Operating System to contain some form of "Dispatch Table" which is always located at the same place in every version of that Operating System and which contains the actual addresses of service routines for that specific version.
Utilities
Common Utilities
- Typically operations involving file and/or disk management
- Copying, Renaming, Deleting files
- Directory/Folder Management
- Establishing/Modifying Display and/or Keyboard modes or states
As External Programs
- Separate executeable program files supplied with the Operating System, but run in the same way as any other program.
- Only use memory space when actually being executed, but must be loaded into memory every time they are needed.
- Example: MS-DOS command FORMAT.
Built-In Routines
- Part of the Operating System; always available (provided the Operating System has been loaded and is running).
- Results in the Operating System requiring more Memory space (even when routine is not being used).
- Example: MS-DOS commands DIR and COPY