Tags: #◇Computer Science #◇CSOPESY #◇Operating Systems #◇Linux #◇Reviewer #◇Finals
CSOPESY Comprehensive Finals Reviewer
◇Overview
This reviewer consolidates Operating Systems Concepts and Architecture (CSOPESY). Core disciplines span OS structure (Dual-mode execution, User vs Kernel mode, system call interface), process management (Process Control Block - PCB, 5-state process lifecycle, process creation with fork() and execvp(), CPU scheduling: FCFS, SJF, Round Robin, Multilevel Feedback Queues), multithreading (POSIX pthreads, User vs Kernel threads), concurrency and process synchronization (Critical Section Problem, Peterson's algorithm, mutex locks, semaphores, classic synchronization problems: Producer-Consumer, Readers-Writers, Dining Philosophers), deadlock theory (Coffman conditions, Resource Allocation Graphs, Banker's Algorithm, deadlock detection and recovery), main memory management (contiguous allocation, internal vs external fragmentation, paging, multi-level page tables, TLB address translation), and virtual memory (demand paging, page faults, page replacement algorithms: FIFO, Optimal, LRU, Second-Chance, thrashing and working-set model).
◇1. Process 5-State Transition Lifecycle
◇2. Synchronization & Deadlock Matrix
Coffman Conditions for Deadlock
All 4 conditions must hold simultaneously for a deadlock to exist:
- Mutual Exclusion: At least one resource must be held in a non-shareable mode.
- Hold and Wait: A process holds at least one resource and is waiting to acquire others held by competing processes.
- No Preemption: Resources cannot be forcibly preempted; they must be voluntarily released by the holding process.
- Circular Wait: A closed chain of processes exists where waits for , and waits for .
Semaphore Primitives
wait(S)/sem_wait(&S): Decrements . If , caller blocks on semaphore wait queue.signal(S)/sem_post(&S): Increments . If processes are blocked, unblocks one process to ready queue.
◇3. Virtual Memory & Page Replacement Algorithms
| Algorithm | Replacement Criteria | Vulnerability / Overhead | Hardware Requirements |
|---|---|---|---|
| FIFO | Replaces the oldest loaded page | Bélády's Anomaly (More frames can cause more page faults!) | Simple queue |
| Optimal (OPT) | Replaces page that will not be used for the longest future time | Theoretical benchmark only (Requires clairvoyance / future knowledge) | Impossible in general OS |
| LRU | Replaces page unreferenced for the longest past time | High hardware cost (Counters or stack per reference) | Timestamp registers / hardware stack |
| Second Chance (Clock) | Inspects circular buffer; checks Reference Bit ( replace, and advance) | Approximates LRU with minimal hardware overhead | 1 reference bit per PTE |
◇4. High-Yield Exam Checklist
- Does
fork()create a duplicate child process with a separate copy of virtual address space? YES (Child returns 0, parent returns child PID). - What is Bélády's Anomaly? The phenomenon where increasing the number of physical page frames results in an increased number of page faults under FIFO replacement.
- What is Thrashing? When a system spends more time servicing page faults and swapping pages than executing instructions (working set exceeds physical memory).
- Can a deadlock occur if any one of the 4 Coffman conditions is broken? NO, breaking any single condition prevents deadlock entirely.
- What happens on a Translation Lookaside Buffer (TLB) hit? Physical frame number is retrieved in ns, bypassing the multi-level page table memory walk.
◇References & Navigation
- Previous Topic: ◇CSARCH1, ◇CCPROG2
- Next Topic: None
- Prerequisites: ◇Operating Systems, Processes, Threads, CPU Scheduling, Semaphores, Paging
- Cross-Curricular Connections: ◇LBYARCH
ACTIVE RECALL VERIFICATION
Select an answer to verify conceptual comprehension and reveal the technical rationale.
What system call in POSIX Linux replaces the current process's memory, code, stack, and heap with a new executable program?
Which CPU scheduling algorithm provides the theoretical minimum average waiting time for a given set of stationary processes?
Which page replacement algorithm can experience Bélády's Anomaly?
In the Banker's Algorithm for deadlock avoidance, a system state is considered "Safe" if:
In demand paging, what hardware mechanism allows the operating system to detect that a referenced page is not currently resident in physical RAM?