next up previous

2.5 Operating Systems

The user's view of a computer system is of a complex set of services that are provided by a combination of hardware (the architecture and its organization) and software (the operating system). Attributes of the operating system also affect the performance of user programs.

Operating systems for all but the simplest personal computers are multi-tasking operating systems. This means the computer will be running several jobs at once. A program is a static description of an algorithm. To run a program, the system will decide how much memory it needs and then start a process for this program; a process (also known as a task) can be viewed as a dynamic copy of a program. For example, the C compiler is a program. Several different users can be compiling their code at the same time; there will be a separate process in the system for each of these invocations of the compiler.

Processes in a multi-tasking operating system will be in one of three states. A process is active if the CPU is executing the corresponding program. In a single processor system there will be only one active process at any time. A process is idle if it is waiting to run. In order to allocate time on the CPU fairly to all processes, the operating system will let a process run for a short time (known as a time slice; typically around 20ms) and then interrupt it, change its status to idle, and install one of the other idle tasks as the new active process. The previous task goes to the end of a process queue to wait for another time slice.