Operating Systems¶
Operating system theory and concepts for computer science studies
Scope and use¶
This index links to teaching models, not configuration advice for a specific kernel. Algorithm properties assume the workload stated in each guide; implementation claims and timings require an OS/kernel version, hardware, workload, and trace. A lab is complete only when inputs, assumptions, failure states, commands, and raw results are recorded. Retry failed experiments only after preserving the error and changing one controlled condition.
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 | Possible with an unbounded/unstable arrival model | Simple arrival-ordered workloads |
| SJF / SRTF | SJF: No; SRTF: Yes | Yes, without aging/admission bounds | Workloads with known or estimated bursts |
| Priority | Policy-dependent | Yes, without aging or reservation | Explicit service classes; not sufficient alone for real-time guarantees |
| Round Robin | Yes | Avoided only under finite runnable set, positive quantum, and equal service class | Time-sharing |
| MLFQ | Yes | Possible without periodic boost or allocation bounds | Adaptive general-purpose scheduling |
Deadlock Conditions¶
For the classic reusable, non-preemptible resource model, all four Coffman conditions are necessary for deadlock:
- 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¶
These formulas use the simplified single-CPU examples in the guides. Waiting time equals turnaround minus CPU burst only when omitted I/O/service intervals and overhead are handled consistently. Address formulas assume integer page/frame numbering and the stated page size.
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