OS Services

Some operating systems (UNIX is the prime example) provide a collection of software development tools:

But focus in this class is on necessary (well, largely necessary) OS services

Process Management

Task is a synonym for process. So is the same as job (at least mostly -- some jobs can have several associated tasks).

Standard process management tasks:

Memory Management

        Memory hierarchy:
         +-----+   +-----------+   +------------------------+
         |cache|   | primary   |   |     secondary          |
         |     |   | memory    |   |    memory/storage      |
         +-----+   +-----------+   +------------------------+
       very fast   fast            slow
       very exp.   mod. exp.       mod. cheap
       very small  medium          huge
For an instruction to executed or data to be read, it must be in cache.

Memory management tasks:

Secondary storage management I/O management File management Protection Network Distributed Systems (Parallel Systems) Embedded Systems Client - Server Systems Command interpreter An OS typically provides:
User interface
(command interpreter, windowing system) This is the way the "end user" interacts with the operating system.

Programmer interface
(how does application software request OS services?) This is the way applications and systems programmers request system services in the software they develop.

As an example of OS services, consider possible actions required to execute the C++ function call:

write( a, b, c );

(I am ignoring the compiler task of translating this statement in a high-level language into machine code which can be efficiently executed on the target hardware -- except the observation that in standard C++ function, 'a' may be the name of the file to which the values of the variables b and c are to be written. From this statement you can't tell if it is a variable or a file -- depends on how it is declared. The compiler handles this and generates appropriate code.)

The C++ compiler depends on a run-time support library. The routines necessary to translate from an internal representation (as floating point or integers, for example, to an external representation as a string of ascii characters), to read data from files or write data to files are contained in those libraries. Part of translation of the C++ code into machine code requires the use of a linker which links together the machine code directly translated from the user programmer with the machine code which is in the run-time library. It must use the OS to locate that library code and extract the part of the library which this user program requires.)

So some typical steps which must occur to "execute" this statement (after the compiler has translated it and the linker has located necessary library routines and the loader has placed the code in primary memory):

System Structure

OS's tend to be complex software systems. And evolve from simple clean designs to complex disorganized structures.

Consider the OLD MS-DOS:

Like many systems, suffers from the curse of "upward compatibility" and creeping featurism (more and more features get added over time).
     +-------------------------------------+
     |     application program             |
     +-------------------------------------+
            |                        |
            V                        |
     +---------------------------+   |
     | resident system programs  |   |
     +---------------------------+   |
            |             |          |
            V             |          |
     +--------------+     |          |
     | MS-DOS device|     |          |
     |    drivers   |     |          |
     +--------------+     |          |
            |             |          |
            V             V          V
     +-------------------------------------+
     |       ROM BIOS device drivers       |
     +-------------------------------------+
Because of this structure, OS cannot "enforce" much of anything (since software can easily bypass OS). Also changes (particularly to ROM BIOS) is much more difficult since it is not hidden from the application programs. If all calls had to go through OS routines, the ROM BIOS could be changed requiring only a change to a few OS routines (at least part of the time).

UNIX: much the same: what had started out as a clean simple elegant design becomes progressive more obtuse.

     +---------------------------------------------------------+
     |                     users                               |
     +---------------------------------------------------------+ < user interface
     | shells                                                  |
     | compilers/interpreters (other tools)                    |
     |    system libraries                                     |   system call
     +---------------------------------------------------------+ < interface to
     |                                                         |   kernel
     |  signals              file system       CPU scheduling  |
     |  terminal handling    swapping          memory mgmt     |
     |  character I/O system block I/O system                  |
     |  terminal drivers     disk drivers                      |   kernel
     +---------------------------------------------------------+ < interface to
     |  term cntrls        | device cntrls    | mem cntrls     |   hardware
     |  "terminal"         | disk & mouse     | physical mem.  |
     +---------------------------------------------------------+
Problem: kernel has become too large, thus hard to understand, hard to change (subtle interconnections).

Desired structure (modern Micro Kernals): layered approach (to better organize that amorphous blob called the kernel).

Six layers:

  1. user programs
  2. buffer management
  3. operator console, device management
  4. memory management
  5. CPU scheduler
  6. hardware

A few miscellaneous concepts


Index Previous Next

Copyright ©2014, G. Hill Price
Send comments to G. Hill Price