C SC 340 Lecture 2: OS Overview Part 2
[ previous
| schedule
| next ]
Operating System Structures
We've looked at major computer system structures that support operating system
functionality. Now let's consider major OS functions and design considerations.
OS Responsibilities
OS is very complex, its responsibilities can be grouped into logical categories.
Each is introduced in turn.
Process management
- process == running program (not exactly accurate but OK for now)
- processor is the CPU
- processor management is just a matter of making sure the CPU has something useful
to do all the time, and process management takes care of this
- includes switching CPU from one process to another
- includes scheduling, creating, suspending, resuming, terminating processes
- includes interprocess communication
- includes process synchronization
- includes deadlock detection, prevention, avoidance, recovery
Memory management
- main goal is to utilize main memory in a way that supports most effective use of CPU
- instructions have to be in main memory to be executed
- to keep CPU busy, it may be necessary to work concurrently with more processes than will fit into main memory
- includes deciding which processes should be allocated memory
- includes allocating memory to processes
- includes deallocating memory from processes
File System management
- file is a logical concept, since it can be stored different ways on different media
- thus file management addresses device-independent issues
- includes file creation, manipulation, deletion, protection
- includes directory creation, manipulation, deletion, protection
- includes file system backup
Mass Storage management
- refers primarily to disk management
- includes management of free disk space
- includes allocating disk space to files/directories
- includes deallocating disk space from files/directories
- includes scheduling of disk read/write operations
I/O device management
- issues common to all I/O devices and specific to each type
- includes interrupt handlers
- includes buffering and caching of data
- includes hardware specific device drivers
Network communication
- includes communication protocols
- includes network configuration
- includes message passing and routing
- includes forming coherent system image from heterogeneous network configuration
- includes network reliability and security
Overarching design issue: mechanism versus policy
All the management responsibilities need to be designed so that
policy is separated from mechanism.
- policy refers to deciding what is to be done
- mechanism refers to how it is done, once the decision is made
- process management example:
- mechanism: when a running process terminates, the CPU is given another process to run. The
transition is called context switching and involves saving and restoring
register values.
- policy: deciding which process to give to the CPU. e.g., scheduling.
- disk management example:
- mechanism: allocating a block of disk space to a file
- policy: deciding which block to allocate
- It is best to separate them because designer will want to change policy
without changing mechanism.
Non-traditional systems
Due to the limited class time for this course (less than 30 hours),
it is feasible to cover only basic OS functionality. Topics are chosen from
the first 15 chapters. Textbook chapters 16
through 20 cover interesting and relevant topics that I encourage you to
explore on your own. These include:
- distributed systems (network OS), chap 16
- distributed file systems, chap 17
- coordination in distributed systems (mutual exclusion, deadlock), chap 18
- real-time systems, chap 19
- multimedia systems, chap 20
User Interaction
- interface between interactive user and operating system services
- not considered part of the OS kernel
- includes command-line interpreters (Unix, DOS)
In the Unix/Linux world, these are known as shells.
Anyone (even you!) can write a new
shell. It merely maps user commands to system services. The major shells
(C shell, Bourne shell, Bourne-again shell, Korn shell) differ in relatively
minor ways
- includes graphical user interfaces (Windows, Macintosh)
Original Windows was simply a GUI layered on top of DOS. Macs were designed
for GUI interaction from the start, with CLI available only with OS X
overhaul based on Unix kernel. Many GUIs have been developed for Unix/Linux,
such as X, CDE, KDE, Gnome.
- consider human-computer interaction issues
You may laugh at "primitive" command interfaces, but suppose for example
you have a directory
filled with different types of files and wanted to put all the ".txt" files
into a new directory called "text". With a command interface, you could
do all that by typing: mkdir text; mv *.txt text
How long would it take using a GUI?
System services, calls, and programs
System services
OS provides a number of basic and advanced services to its users: loading
and running programs, storing programs and data, operating I/O devices,
providing communication, providing protection.
OS also provides services that benefit mostly its own operation and system
administration: efficient
resource allocation, accounting, security.
System calls
Processes interface with the OS through system calls. Put another way,
the OS provides sets of system calls through its API (Application Programmer Interface)
to those who will develop software to run on it.
- examples of APIs are WIN32 for Windows, POSIX for Unix/Linux, Java API
for JVM
- System calls are predefined and precompiled functions, usually written
in C, C++ or assembly.
- typical (layered) structure: system calls are not part of the API itself
but are called by the API functions. This is illustrated in Figure 2.6.
- System calls typically operate in kernel mode.
- The API function is thus programmer's interface to system calls
and thus priviledged instructions.
There are many different system calls, grouped into the same categories
as OS responsibilities listed above (process management, file management, etc).
The textbook contains a nice outlined list in Figure 2.5.
System programs
These are programs provided by the OS to the interactive user. Some simply
invoke system calls on the user's behalf, others are much more complex.
- They are distinguished from system calls in that they are typically used interactively at
the user interface.
- In a GUI environment, system programs are typically triggered by clicking
on a representative icon.
- E.g. In Windows, double-clicking on a folder (directory) icon called bin
makes it current and displays its contents.
- In a command-line interpreter
environment, system programs are typically triggered by typing in their names.
- E.g. In Unix/Linux, the commands cd bin followed by ls
would make the bin directory current then display its contents.
Ways of structuring an OS
All OS's are complex software systems and so need to be structured in some way.
Modern OS's have a layered structure. Textbook figures 2.10 through 2.15
illustrate layered structures used by different OS's. Each is clearly distinct
from the others, showing there is no consensus on how layers should be structured.
Here are a few approaches.
Original Unix: kernel and system programs
There are a small number of layers.
The first layer above the hardware is the OS kernel. The kernel refers
to the most essential modules of the OS, those that need to be memory resident
at all times. The kernel primarily fulfills process, memory and file responsibilities.
System calls are the interface of the kernel to programmers. The next layer
is the system programs. Criticized for being too monolithic with
too much kernel functionality.
Mach, NT: microkernel
Idea is to keep the kernel as small as possible. This allows OS overall to be more
extendable and portable. Also simplifies protection.
Kernel may contain only partial process, file, and communication management.
Communication is through message passing.
NT uses a client-server approach in which both are user mode but communication
between them must go through kernel. Thus significant portion of the OS itself
operates in user mode.
OS/2: highly layered
This can be visualized with OS layers as concentric circles or boxes surrounding
hardware. Each layer provides services to the layers that surround it
and is implemented using only the services provided by the layers it encloses.
This approach is highly modular and easier to maintain, but performance suffers
due to the multiple layers
and it is difficult to decide which OS services belong in which layer. OS/2 and the
first version of Windows NT were highly layered.
Modern Unix: kernel modules
More object-oriented. Core kernel and dynamically loadable kernel modules.
Modern Unix variations: Solaris, Linux, Mac OS X, employ this. Has advantage of
microkernel w/o disadvantage of message passing. Has protection advantage of
layered w/o disadvantage of strict hierarchy (modules can call each other).
IBM VM: virtual machines
The other OS architectures all have a kernel layer directly interfacing with
hardware. Another strategy is to place an additional OS layer called the virtual
machine between the kernel and the hardware. The virtual machine does not
provide any functionality to the kernel but instead provides an identical interface
as that of the hardware itself. The kernel thinks it is interacting directly with
bare hardware. Advantage is that each process can have its own kernel (or OS)
and different processes can use different OS's concurrently on the same hardware
- even simple single user OS's.
Virtual PC (Microsoft) is an application program
that provides this capability. Java's JVM (Java Virtual Machine) and .NET's CLR
(Common Language Runtime) also follow the virtual machine
concept to provide "managed execution".
[ C
SC 340 | Peter
Sanderson | Math Sciences server
| Math Sciences home page
| Otterbein ]
Last updated:
Peter Sanderson (PSanderson@otterbein.edu)