PROJECTENGRAM

[REV] CSOPESY COMPREHENSIVE FINALS REVIEWER

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:

  1. Mutual Exclusion: At least one resource must be held in a non-shareable mode.
  2. Hold and Wait: A process holds at least one resource and is waiting to acquire others held by competing processes.
  3. No Preemption: Resources cannot be forcibly preempted; they must be voluntarily released by the holding process.
  4. Circular Wait: A closed chain of processes {P0,P1,…,Pn}\{P_0, P_1, \dots, P_n\} exists where P0P_0 waits for P1P_1, and PnP_n waits for P0P_0.

Semaphore Primitives

  • wait(S) / sem_wait(&S): Decrements SS. If S<0S < 0, caller blocks on semaphore wait queue.
  • signal(S) / sem_post(&S): Increments SS. If processes are blocked, unblocks one process to ready queue.

◇3. Virtual Memory & Page Replacement Algorithms

AlgorithmReplacement CriteriaVulnerability / OverheadHardware Requirements
FIFOReplaces the oldest loaded pageBé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 timeTheoretical benchmark only (Requires clairvoyance / future knowledge)Impossible in general OS
LRUReplaces page unreferenced for the longest past timeHigh hardware cost (Counters or stack per reference)Timestamp registers / hardware stack
Second Chance (Clock)Inspects circular buffer; checks Reference Bit (0→0 \to replace, 1→01 \to 0 and advance)Approximates LRU with minimal O(1)O(1) hardware overhead1 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 <1< 1 ns, bypassing the multi-level page table memory walk.

◇References & Navigation

CONFIRMATION // 理解度の確認

ACTIVE RECALL VERIFICATION

Select an answer to verify conceptual comprehension and reveal the technical rationale.

Q1

What system call in POSIX Linux replaces the current process's memory, code, stack, and heap with a new executable program?

Q2

Which CPU scheduling algorithm provides the theoretical minimum average waiting time for a given set of stationary processes?

Q3

Which page replacement algorithm can experience Bélády's Anomaly?

Q4

In the Banker's Algorithm for deadlock avoidance, a system state is considered "Safe" if:

Q5

In demand paging, what hardware mechanism allows the operating system to detect that a referenced page is not currently resident in physical RAM?

[REV] CSOPESY Comprehensive Finals Reviewer | PROJECT ENGRAM