4. Components of Operating System

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:
Provides convenient environment for users (e.g., drag-and-drop files).
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:
Process Management: Creates/schedules processes.
Memory Management: Allocates/deallocates RAM.
File Management: Manages files/folders (e.g., tree structure in Linux).
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
User Command:
mkdir NewFolder
(CLI) or Right-click → New Folder (GUI).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:
Shared Memory: Processes read/write to a common memory area.
Message Passing: OS provides a channel (e.g., pipes in Linux).
(2) I/O Management Techniques
Buffering: Temporary storage (e.g., YouTube pre-loads video chunks).
Spooling: Queues tasks (e.g., printer jobs).
Caching: Stores frequently used data (e.g., browser cache).
5. Interview Questions
Why is kernel called the "heart" of OS?
- It manages all critical resources (CPU, RAM, devices).
What happens during a user-to-kernel mode switch?
- Software interrupt triggers the switch (e.g., system calls like
mkdir
).
- Software interrupt triggers the switch (e.g., system calls like
Which kernel type is used in modern OS?
- Hybrid (e.g., Windows, macOS).
6. Real-World Examples
Component | Example |
User Space | Windows Desktop, Terminal. |
Kernel | Linux Kernel (manages RAM/CPU). |
IPC | Chrome tabs sharing cache. |
Key Takeaways:
User Space = Where apps run (GUI/CLI).
Kernel = Manages hardware (4 functions).
Kernel Types: Monolithic (fast but bulky), Micro (reliable but slow), Hybrid (best of both).
Subscribe to my newsletter
Read articles from Tanish Kumar directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
