Operating Systems - In-Depth Class Notes
1. Introduction to Operating Systems
An Operating System (OS) is system software that manages computer hardware and
software resources and provides common services for application programs.
Primary functions:
Process Management
Memory Management
File System Management
Device Management
Security and Access Control
Acts as an intermediary between users and hardware.
2. Process Management
A process is a program in execution; it includes code, data, stack, and heap.
Process States:
New
Ready
Running
Waiting (Blocked)
Terminated
Context Switching: The act of saving and restoring the state (context) of a CPU
so that execution can be resumed from the same point later.
Schedulers:
Long-term: decides which jobs enter the system.
Short-term: picks which process gets the CPU next.
Medium-term: suspends/resumes processes.
Scheduling Algorithms:
FCFS (First-Come-First-Serve)
SJF (Shortest Job First)
RR (Round Robin)
Priority Scheduling
Multilevel Queue
3. Threads and Concurrency
Thread: A lightweight process; shares memory with other threads in the same
process.
Multithreading: Multiple threads within a single process to achieve
parallelism.
Concurrency Issues:
Race Conditions
Deadlocks
Starvation
Livelock
Synchronization:
Mutexes, Semaphores, Monitors
Condition Variables
Critical Section Problem: Ensures only one process/thread accesses shared data
at a time.
4. Deadlocks
Deadlock: A set of processes are blocked because each process is holding a
resource and waiting for another.
Necessary Conditions:
Mutual Exclusion
Hold and Wait
No Preemption
Circular Wait
Handling Methods:
Prevention
Avoidance (Banker's Algorithm)
Detection and Recovery
5. Memory Management
Main Memory: Fast, volatile memory that stores processes during execution.
Memory Allocation Techniques:
Contiguous Allocation
Paging: Memory divided into fixed-size pages.
Segmentation: Memory divided into segments of different lengths.
Paging Concepts:
Page Table
TLB (Translation Lookaside Buffer)
Internal vs External Fragmentation
Virtual Memory:
Uses disk space to extend RAM (swap space).
Implements demand paging.
6. File Systems
File: A collection of related information stored on secondary storage.
File Attributes: Name, type, size, location, protection, etc.
Directory Structure:
Single-level, Two-level, Tree-structured, DAG, Acyclic Graph
File Operations:
Create, Read, Write, Delete, Open, Close
File Allocation Methods:
Contiguous, Linked, Indexed
Mounting: The process of making a file system available for use.
7. Input/Output Systems
I/O Devices: Disk, Keyboard, Mouse, Monitor, Network Interface
I/O Techniques:
Programmed I/O
Interrupt-driven I/O
DMA (Direct Memory Access)
Device Drivers: Software that abstracts device-specific operations.
Buffering, Caching, Spooling: Techniques to improve I/O efficiency.
8. Security and Protection
Protection: Mechanisms to control access to resources.
Security: Defending against threats, both internal and external.
Access Control Matrix: Defines rights of subjects over objects.
Authentication Methods:
Passwords, Biometrics, Tokens
Security Measures:
Encryption, Auditing, Firewalls
9. Virtualization and Cloud OS
Virtualization: Abstracting hardware using software (hypervisors).
Types:
Full Virtualization
Para-virtualization
OS-level Virtualization (Containers)
Cloud OS: Operating systems tailored to manage cloud infrastructure and
services.
10. Case Studies
UNIX/Linux:
Modular structure
Everything-is-a-file paradigm
Shell interface
Windows:
Hybrid kernel
GUI-centric
Extensive API support
Note: For practical learning, try writing shell scripts, exploring /proc in
Linux, and simulating scheduling/memory algorithms in code. Refer to "Operating
System Concepts" by Silberschatz for deeper understanding.