BCS401 Operating System Semester IV · AY 2025-26 onward
Unit 1 · Introduction & OS Structure

Lecture 8: OS structure: layers & components

Learning outcomes

  • Identify the common layers and major components used in operating systems.
  • Understand how design choices (monolithic / layered / microkernel / modular) affect performance and maintainability.

Prerequisites

-- Meaning of Operating System, kernel, and system calls (Lectures 1–2) -- Basic hardware terms: CPU, RAM, disk, I/O devices -- Basic idea of user mode vs kernel mode (why the kernel is "privileged")

Lecture Notes

Main content

Unit 1 — Introduction & OS Structure

Lecture 6: OS Structure — Layers & Components

Learning Outcome

Identify common layers and major system components used in operating systems, and understand how design choices (monolithic / layered / microkernel / modular) affect performance and maintainability.


1) Why "OS Structure" Matters

The OS is a large software system. To make it understandable, debuggable, and extensible, designers organize it using structures (architectures) such as monolithic, layered, microkernel, and modular. Each design trades off speed, reliability, and ease of maintenance.


2) Layered Operating System Architecture

In a layered design, each layer uses the services of the layer below it and provides services to the layer above it. This helps with clarity and debugging, but can add overhead due to extra boundaries.

Layer 5: User Interface / Applications Layer 4: System Programs (Shell, Tools, Compilers) Layer 3: OS Services (System Calls) Layer 2: Kernel (Scheduling, Memory Mgmt, IPC, Interrupts) Layer 1: Device Drivers / HAL Layer 0: Hardware (CPU, RAM, Disk, Devices) User Mode Kernel Mode
Fig 6.1: Typical layered OS view — Apps → System Programs → System Calls → Kernel → Drivers → Hardware.
Shortcut to remember the layers:

Apps → Shell/GUI → Services → Kernel → Drivers → Hardware


3) Core OS Components

3.1 Kernel (the core)

  • The program running at all times with full privileged access.
  • Handles CPU scheduling and memory management.
  • Handles interrupts and system calls.

(Privileged / kernel-mode component)

3.2 Device Drivers

  • Hardware-specific control code that helps the OS "talk" to devices.
  • Provides a standard interface for I/O, improving portability.
  • Can be loaded dynamically in modular kernels.

3.3 System Programs (Utilities)

  • Programs shipped with the OS but not part of the kernel.
  • Examples: compilers, editors, monitoring tools, networking utilities, file manager, shell.

3.4 Internal Kernel Subsystems

In most OS designs the kernel internally includes sub-managers:

  • Process / Thread Management: create/terminate, scheduling, context switching.
  • Memory Management: allocation, protection, virtual memory.
  • I/O Subsystem: buffering/caching, device management, driver interface.
  • File System: files/directories, permissions, mapping data to storage.
  • Protection & Security: privilege control, isolation, access checks.

4) Common OS Structures

Structure Main idea Trade-off
Monolithic One big kernel — many OS services run in kernel space together. Fast; but a kernel bug can crash the entire system.
Layered OS divided into layers; each layer uses only the one below. Cleaner design and easier debugging; can add overhead.
Microkernel Minimal kernel; many services run in user space as separate processes. More secure and robust isolation; performance may suffer due to message-passing overhead.
Modular Small core kernel + loadable modules (drivers, file systems) added dynamically. Flexible and common in modern OS; avoids recompiling the kernel for every change.
Book note (modern reality): Hybrid designs are common.

Real operating systems often combine structures. Linux is monolithic for performance but also modular. Windows is largely monolithic but includes some microkernel-like behavior and supports dynamically loadable kernel modules.


5) Modular Kernels — Loadable Kernel Modules

A widely used design is the loadable kernel module approach: a core kernel links in additional services at boot time or during runtime.

  • Core services (CPU scheduling, memory management) are built into the kernel.
  • Other services (file systems, device drivers) can be added as modules dynamically.
  • More efficient than microkernel message passing — modules communicate directly without message copying.

6) Quick Self-Check Questions

  1. Write the layer order: Apps → ? → ? → Kernel → Drivers → Hardware.
  2. Which component runs in privileged mode at all times?
  3. Why are device drivers needed for portability?
  4. State one advantage and one disadvantage of the layered design.
  5. Why can microkernels be slower than monolithic kernels? (one line)
  6. What is a loadable kernel module and why is it useful?

Worked Example

Worked Example: "Plug in a USB Device" — Which Components Get Involved?

User action: You plug in a USB drive while the OS is running.

Layer / Component Mapping

  1. Hardware: USB controller generates an interrupt/event.
  2. Kernel: receives the interrupt and triggers device handling.
  3. Device driver: USB storage driver communicates with the device.
  4. File system: OS mounts the device and exposes files/directories.
  5. System programs / UI: file manager shows the drive and its contents to the user.

This matches the layered path: Apps/UI → Services → Kernel → Drivers → Hardware.

Where "Modular Kernel" Helps

If the kernel does not currently have the required driver loaded, Linux can dynamically load the module at runtime when the USB device is plugged in — without rebooting or recompiling the kernel.

One-Page Summary

One-Page Summary — OS Structure: Layers & Components

  • Layered view (easy memory): Apps/UI → System Programs → OS Services (system calls) → Kernel → Drivers → Hardware.
  • Main OS components:
    • Kernel: privileged, always running; handles scheduling, memory, interrupts, system calls.
    • Device drivers: hardware-specific control code; standard I/O interface; improves portability.
    • System programs: utilities like shell, file manager, compilers, monitoring tools — not part of the kernel.
  • Common OS structures:
    • Monolithic: one big kernel (fast; crashes can be severe).
    • Layered: clean separation (easy to debug; can add overhead).
    • Microkernel: minimal kernel; services in user space; can suffer overhead from message passing.
    • Modular: core kernel + loadable modules; common in modern OS; avoids recompiling the kernel.
  • Reality: hybrid designs are most common — a mix of monolithic, modular, and microkernel-like behaviors.