Loading W Code...
Introduction to Operating Systems
6
Topics
30
Minutes
Beginner
Level
Goals of OS:
1. Convenience - Make computer easy to use
2. Efficiency - Use resources efficiently
3. Ability to Evolve - Allow updates without affecting users
Categories of System Calls:
| Category | Examples | Purpose |
|----------|----------|---------|
| Process Control | fork(), exec(), exit(), wait() | Create, manage, terminate processes |
| File Management | open(), read(), write(), close() | File operations |
| Device Management | ioctl(), read(), write() | Device I/O |
| Information | getpid(), alarm(), sleep() | System info |
| Communication | pipe(), shmget(), mmap() | IPC mechanisms |
User Mode vs Kernel Mode:
┌─────────────────────────────┐
│ User Space │
├─────────────────────────────┤
│ ┌───────────────────────┐ │
│ │ Monolithic Kernel │ │
│ │ (All services here) │ │
│ │ - File System │ │
│ │ - Device Drivers │ │
│ │ - Networking │ │
│ │ - Process Mgmt │ │
│ └───────────────────────┘ │
├─────────────────────────────┤
│ Hardware │
└─────────────────────────────┘
`
• All OS services run in kernel space
• Fast (no context switching)
• Large size, one bug can crash system
• Example: Linux, Unix
2. Microkernel
`
┌─────────────────────────────────────┐
│ User Space │
│ [File System] [Drivers] [Network] │
├─────────────────────────────────────┤
│ ┌─────────────────────┐ │
│ │ Microkernel │ │
│ │ (IPC, Scheduling) │ │
│ └─────────────────────┘ │
├─────────────────────────────────────┤
│ Hardware │
└─────────────────────────────────────┘
``
1. Interrupt occurs
│
▼
2. CPU stops current task
│
▼
3. Save current state (PC, registers)
│
▼
4. Look up ISR in Interrupt Vector Table
│
▼
5. Execute Interrupt Service Routine (ISR)
│
▼
6. Restore state
│
▼
7. Resume previous task
``
Interrupt Vector Table (IVT):
Layer 5: User Interface
Layer 4: I/O Management
Layer 3: Device Drivers
Layer 2: Memory Management
Layer 1: CPU Scheduling
Layer 0: Hardware
`
• Each layer uses services of lower layer
• Easy to debug and maintain
• Slower due to multiple layers
3. Modular Structure (Modern Linux)
• Core kernel + loadable modules
• Modules can be loaded/unloaded at runtime
• Flexible and efficient
• Example: Device drivers as modules
Booting Process:
`
1. Power On
│
▼
2. BIOS/UEFI runs POST (Power-On Self Test)
│
▼
3. Load bootloader from boot device
│
▼
4. Bootloader loads kernel into memory
│
▼
5. Kernel initializes hardware
│
▼
6. Start init process (PID 1)
│
▼
7. Load system services
│
▼
8. Display login prompt
``
Key Terms: