Operating Systems¶
Operating system theory and concepts for computer science studies
Topics¶
-
CPU Scheduling
Process scheduling algorithms: FCFS, SJF, Priority, Round Robin, MLFQ.
-
Synchronization
Mutex, semaphores, monitors, and critical section problems.
-
Deadlocks
Deadlock conditions, prevention, avoidance, and detection.
-
Memory Management
Virtual memory, paging, segmentation, and page replacement.
-
Process Management
Process creation, fork(), exec(), and inter-process communication.
-
Virtualization
Hypervisor mechanisms and Docker vs VM isolation comparison.
-
Distributed Deadlocks
Deadlock handling in distributed systems and Edge Chasing algorithm.
Learning Path¶
flowchart TD
subgraph Fundamentals
A[Process Concept] --> B[Process States]
B --> C[Context Switching]
end
subgraph Scheduling
C --> D[CPU Scheduling]
D --> E[Scheduling Algorithms]
end
subgraph Concurrency
E --> F[Synchronization]
F --> G[Critical Section]
G --> H[Deadlocks]
end
subgraph Memory
H --> I[Memory Management]
I --> J[Virtual Memory]
J --> K[Page Replacement]
end
Key Concepts¶
Process States¶
stateDiagram-v2
[*] --> New: Create
New --> Ready: Admit
Ready --> Running: Dispatch
Running --> Ready: Interrupt
Running --> Waiting: I/O Wait
Waiting --> Ready: I/O Complete
Running --> Terminated: Exit
Terminated --> [*]
Scheduling Algorithms Comparison¶
| Algorithm | Preemptive | Starvation | Best For |
|---|---|---|---|
| FCFS | No | No | Batch systems |
| SJF | Both | Yes | Short jobs |
| Priority | Both | Yes | Real-time |
| Round Robin | Yes | No | Time-sharing |
| MLFQ | Yes | No | General purpose |
Deadlock Conditions¶
All four conditions must hold simultaneously:
- Mutual Exclusion - Resource held exclusively
- Hold and Wait - Process holding while waiting
- No Preemption - Cannot forcibly remove
- Circular Wait - Circular chain of processes
Quick Formulas¶
CPU Scheduling¶
Turnaround Time = Completion Time - Arrival Time
Waiting Time = Turnaround Time - Burst Time
Response Time = First Response - Arrival Time
Throughput = Number of Processes / Total Time
CPU Utilization = (CPU Busy Time / Total Time) × 100%
Memory Management¶
Page Number = Virtual Address / Page Size
Page Offset = Virtual Address % Page Size
Physical Address = (Frame Number × Page Size) + Offset