Skip to main content
Engineering LibreTexts

20.1: Multi-user Operating System

  • Page ID
    19988
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    A modern multi-user Operating System (OS) supports multiple programs executing, or appearing to be executing, simultaneously by sharing resources as necessary. The OS is responsible for managing and sharing the resources. These resources include the CPU cores, primary memory (i.e., RAM), secondary storage (i.e., disk or SSD), display screen, keyboard, and mouse. For example, multiple programs must share the available CPU resources (core or cores as applicable).

    The interrupt mechanism is the primary means that the OS uses in order to provide the resource sharing. Consequently, understanding how interrupts are processed by the computer provides insight into how the operating system is able to provide multi- processing functions. When an interrupt occurs, the current process is interrupted (i.e., placed on hold), the interrupt is handled (which depends on the specific reason for the interrupt), and then eventually the process is resumed. The OS may choose to perform other tasks or processes before the original process is resumed. The interrupt is handled by a special software routine called an Interrupt Service Routine (also called Interrupt Handler, Device Driver, etc.). By using interrupts and quickly switching between various processes, the OS is able to provide the illusion that all processes are executing simultaneously.

    Not all code can be interrupted. For example, due to the nature of some operating system kernel functions, there are regions in the kernel which must not be interrupted at all. This includes updating some sensitive operating system data structures.

    Interrupt Classification

    To better understand interrupts and interrupt processing, some background on the timing and categories of interrupts is useful.

    Interrupt Timing

    The timing of interrupts may occur synchronously or asynchronously. These terms are fairly common terms in computer processing and are explained in the following sections.

    Asynchronous Interrupts

    In the context of computer interrupts, an asynchronously occurring interrupt means that the interrupt may occur at an arbitrary time with respect to program execution. Asynchronous interrupts are unpredictable relative to any specific location within the executing process. For example, an external hardware device might interrupt the currently executing process at an unpredictable location.

    Synchronous Interrupts

    Synchronously occurring interrupts typically occur while under CPU control and are caused by or on behalf of the currently executing process. The synchronous nature is related to where the interrupt occurs and not a specific clock time or CPU cycle time. Synchronous interrupts typically reoccur at the same location (assuming nothing has changed to resolve the original cause).

    Interrupt Categories

    Interrupts are typically categorized as hardware or software.

    Hardware Interrupt

    Hardware interrupts are typically generated by hardware. Hardware interrupts can be issued by

    • I/O devices (keyboard, network adapter, etc.)
    • Interval timers
    • Other CPUs (on multiprocessor systems)

    Hardware interrupts are asynchronously occurring. An example of a hardware interrupt is when a key is typed on the keyboard. The OS cannot know ahead of time when, or even if, the key will be pressed. To handle this situation, the keyboard support hardware will generate an interrupt. If the OS is executing an unrelated program, that program is temporarily interrupted while the key is processed. In this example, that specific processing consists of storing the key in a buffer and returning to the interrupted process. Ideally, this brief interruption will have little impact in the interrupted process.

    20.1.3.1.1 Exceptions

    An exception is a term for an interrupt that is caused by the current process and needs the attention of the kernel. Exceptions are synchronously occurring. In this context, synchronous implies that the exception will occur in a predictable or repeatable manner.

    Exceptions are typically divided into categories as follows:

    • Faults
    • Traps
    • Abort

    An example of a fault is a page fault which is a request for loading part of the program from disk storage into memory. The interrupted process restarts with no loss of continuity.

    A trap is typically used for debugging. The process restarts with no loss of continuity.

    An abort is typically an indication that a serious error condition occurred and must be handled. This includes division by zero, attempt to access an invalid memory address, or attempt to execute an invalid/illegal instruction. An illegal instruction might be an instruction that is only allowed to be executed by privileged/authorized processes. An invalid instruction might be caused by attempting to execute a data item (which will not make sense). Based on the severity of the error condition, the process is often terminated. If the process is not terminated, another routine may be executed to attempt to resolve the problem and re-execute the original routine (but not necessarily from the interrupted location). The C/C++/Java try/catch block is an example of this.

    It must be noted that there is not an absolute agreed upon definition for these terms. Some texts use slightly different terminology.

    Software Interrupts

    A software interrupt is produced by the CPU while processing instructions. This is typically a programmed exception explicitly requested by the programmer. Such interrupts are typically synchronously occurring and often used to request system services from the OS. For example, requesting system services such as I/O.


    This page titled 20.1: Multi-user Operating System is shared under a CC BY-NC-SA license and was authored, remixed, and/or curated by Ed Jorgensen.

    • Was this article helpful?