4. Components of Operating System

Tanish KumarTanish Kumar
3 min read

1. Two Main Components of OS

(A) User Space

What?

  • Area where user applications run (e.g., GUI, CLI).

  • Examples:

    • GUI (Graphical User Interface): Desktop icons, Windows Explorer.

    • CLI (Command Line Interface): Terminal (Linux), PowerShell (Windows).

Functions:

  1. Provides convenient environment for users (e.g., drag-and-drop files).

  2. Acts as a bridge between user and kernel (e.g., mkdir command → Kernel creates a folder).

Analogy:

  • GUI/CLI = Restaurant menu (user interacts).

  • Kernel = Kitchen (executes orders).


(B) Kernel

What?

  • Core of OS with direct hardware access.

  • Functions:

    1. Process Management: Creates/schedules processes.

    2. Memory Management: Allocates/deallocates RAM.

    3. File Management: Manages files/folders (e.g., tree structure in Linux).

    4. I/O Management: Handles devices (USB, printer).

Key Term:

  • Kernel Mode vs User Mode:

    • User Mode: Apps run with restricted access (e.g., mkdir command).

    • Kernel Mode: Full hardware access (e.g., creating the actual folder).


2. How User Space and Kernel Work Together

Example: Creating a Folder

  1. User Command: mkdir NewFolder (CLI) or Right-click → New Folder (GUI).

  2. Kernel Action:

    • Switches to kernel mode.

    • File management allocates disk space.

    • Returns to user mode (confirmation message).

Visual Flow:

User Space (CLI/GUI) → Kernel (File Management) → Hardware (Disk)

3. Types of Kernels

(A) Monolithic Kernel

What? All OS functions (process, memory, file, I/O) are inside the kernel.

  • Examples: Linux, Unix, MS-DOS.

  • Pros: Fast communication (all components in one place).

  • Cons:

    • Bulky (large codebase).

    • Less reliable (if one component crashes, entire kernel fails).

(B) Microkernel

What? Only core functions (process/memory management) in kernel; rest (file/I/O) in user space.

  • Examples: Symbian OS (old Nokia phones), MINIX.

  • Pros:

    • Modular (easy to debug).

    • Reliable (file/I/O crashes don’t affect kernel).

  • Cons:

    • Slower (frequent switches between user/kernel mode).

(C) Hybrid Kernel

What? Combines best of both (e.g., file management in user space, rest in kernel).

  • Examples: Windows NT, macOS.

  • Pros: Balanced speed and reliability.


4. Key Concepts

(1) Inter-Process Communication (IPC)

Problem: How do processes in user space and kernel communicate?
Solutions:

  1. Shared Memory: Processes read/write to a common memory area.

  2. Message Passing: OS provides a channel (e.g., pipes in Linux).

(2) I/O Management Techniques

  1. Buffering: Temporary storage (e.g., YouTube pre-loads video chunks).

  2. Spooling: Queues tasks (e.g., printer jobs).

  3. Caching: Stores frequently used data (e.g., browser cache).


5. Interview Questions

  1. Why is kernel called the "heart" of OS?

    • It manages all critical resources (CPU, RAM, devices).
  2. What happens during a user-to-kernel mode switch?

    • Software interrupt triggers the switch (e.g., system calls like mkdir).
  3. Which kernel type is used in modern OS?

    • Hybrid (e.g., Windows, macOS).

6. Real-World Examples

ComponentExample
User SpaceWindows Desktop, Terminal.
KernelLinux Kernel (manages RAM/CPU).
IPCChrome tabs sharing cache.

Key Takeaways:

  1. User Space = Where apps run (GUI/CLI).

  2. Kernel = Manages hardware (4 functions).

  3. Kernel Types: Monolithic (fast but bulky), Micro (reliable but slow), Hybrid (best of both).

0
Subscribe to my newsletter

Read articles from Tanish Kumar directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Tanish Kumar
Tanish Kumar