Top Banner Ad

BCS401 — Operating system

1-page visual cheat sheets and Mermaid memory maps for rapid revision.

VISUAL MEMORY MAP & CHEAT SHEET

Full 5-unit Mermaid mind map, recall anchors, and formula strips rendered below.

Save as PNG / Print →

Five units cover OS structure and services, process concurrency/synchronization, CPU scheduling and deadlocks, memory management, and I/O/file/disk management. Each unit keeps its own OS mechanism and metric.

1. Introduction

Recall anchor. OS is a resource manager and an extended machine. It mediates between user programs and hardware while providing services, protection, and efficient utilization.

Scored points.

  • Operating system functions include process management, memory management, file management, I/O device management, protection/security, and user interface/command interpretation.
  • OS types: batch (jobs grouped), interactive/time-sharing (quick response), real-time (deadline-bound), multiprocessor (parallel CPUs), multiuser, multiprogramming, and multithreaded systems.
  • OS services include program execution, I/O operations, file-system manipulation, communication, error detection, resource allocation, accounting, and protection.
  • OS structures: monolithic kernel (all services in kernel space), layered approach (levels of abstraction), microkernel (minimal kernel + user-space services), modules, and hybrid designs.
  • System calls provide the interface between user mode and kernel mode; mode bit switches during trap/interrupt to protect critical resources.
  • Reentrant kernel allows multiple processes/threads to execute kernel code safely by avoiding static/shared mutable state or by proper synchronization.

Formula strip.

CPU utilization=busy timetotal time,Throughput=jobs completedtime,Tresp=first response−arrival\text{CPU utilization}=\frac{\text{busy time}}{\text{total time}},\quad \text{Throughput}=\frac{\text{jobs completed}}{\text{time}},\quad T_{resp}=\text{first response}-\text{arrival}

Micro-example. In 100 ms, CPU executes jobs for 82 ms and waits for I/O for 18 ms: utilization = 82%. If 10 jobs complete in 5 s, throughput = 2 jobs/s.

Examiner line. For OS introduction, define the OS role, classify the OS type, name the relevant service/structure, and justify with a performance or protection benefit.

2. Concurrent Processes

Recall anchor. Concurrency needs mutual exclusion, progress, and bounded waiting. Critical sections must be protected without deadlock, starvation, or unnecessary blocking.

Scored points.

  • A process has states (new, ready, running, waiting, terminated) and PCB contains PID, state, PC, registers, scheduling info, memory info, and I/O status.
  • Critical-section problem requires mutual exclusion, progress, and bounded waiting; race condition occurs when outcome depends on interleaved execution order.
  • Software solutions include Dekker's and Peterson's algorithms for two processes; hardware support includes test-and-set/compare-and-swap and disabling interrupts (limited).
  • Semaphores: binary/mutex (0/1) and counting semaphores; wait(P) decrements/blocks, signal(V) increments/wakes. Atomic operations prevent race conditions.
  • Classical synchronization problems: Producer-Consumer (buffer full/empty), Dining Philosophers (deadlock/starvation), Readers-Writers, Sleeping Barber; solutions use semaphores/monitors.
  • Inter-process communication uses shared memory or message passing (send/receive, direct/indirect, blocking/non-blocking, buffering).

Formula strip.

wait(S):  S=S−1;  if S<0  block,signal(S):  S=S+1;  if S≤0  wake\text{wait}(S):\;S=S-1;\;\text{if }S<0\;\text{block},\quad \text{signal}(S):\;S=S+1;\;\text{if }S\le 0\;\text{wake}

Micro-example. Producer-Consumer with buffer size nn: empty=n, full=0, mutex=1. Producer does wait(empty); wait(mutex); put(); signal(mutex); signal(full). Consumer reverses full/empty order.

Examiner line. For concurrency, identify the shared resource/race, state the critical-section requirement, give semaphore or algorithm steps, and explain how deadlock/starvation is avoided.

3. CPU Scheduling

Recall anchor. Scheduler selects ready process; dispatcher gives it the CPU. Evaluate algorithms by waiting, turnaround, response, throughput, and fairness.

Scored points.

  • CPU scheduling occurs at long-term, short-term, and medium-term levels; dispatcher performs context switch, mode switch, and jumps to user program.
  • Criteria: CPU utilization, throughput, turnaround time, waiting time, response time; optimization goals differ for batch, interactive, and real-time systems.
  • FCFS is simple but suffers convoy effect; SJF/SRTF minimizes average waiting time but needs burst prediction and may starve long jobs.
  • Priority scheduling can be preemptive/non-preemptive; aging increases priority of waiting processes to prevent starvation.
  • Round Robin gives time quantum qq to each ready process; small qq increases context-switch overhead, large qq behaves like FCFS. Response time is good for time-sharing.
  • Deadlock requires mutual exclusion, hold-and-wait, no preemption, and circular wait; handle by prevention, avoidance (Banker's algorithm), detection/recovery, or ignorance.

Formula strip.

WT=TAT−BT,TAT=CT−AT,RT=first CPU start−AT,RR quantum q:  nq response boundWT=TAT-BT,\quad TAT=CT-AT,\quad RT=\text{first CPU start}-AT,\quad \text{RR quantum }q:\;nq\text{ response bound}

Micro-example. Processes P1(0,5), P2(1,3), P3(2,1) by SJF non-preemptive: order P1,P3,P2; CT=5,6,9; TAT=5,4,7; WT=0,3,4; average WT=7/3.

Examiner line. For scheduling, draw a Gantt chart, compute CT/TAT/WT/RT, compare algorithms against the stated criterion, and mention starvation/preemption trade-off.

4. Memory Management

Recall anchor. Memory manager maps logical addresses to physical addresses safely and efficiently. Paging/segmentation solve fragmentation; virtual memory extends apparent memory.

Scored points.

  • Bare machine has no protection; resident monitor and multiprogramming require partitioning, relocation, and protection. Fixed partitions cause internal fragmentation; variable partitions cause external fragmentation.
  • Paging divides logical memory into pages and physical memory into frames; page table maps page number to frame number. Logical address = (p,d)(p,d), physical = (f,d)(f,d).
  • Segmentation divides memory by logical units (code, stack, data); segment table holds base and limit, supporting protection and sharing but causing external fragmentation.
  • Virtual memory uses demand paging: pages loaded only when referenced. Page fault triggers disk access; effective access time depends on page fault rate.
  • Page replacement algorithms: FIFO, Optimal, LRU, Clock/Second-chance; Belady's anomaly can occur in FIFO. Thrashing occurs when excessive paging dominates CPU time.
  • Working-set/locality model: keep frequently used pages resident; allocate frames wisely and control multiprogramming degree to reduce thrashing.

Formula strip.

EAT=(1−p)tm+p tpf,Logical (p,d)→Physical (f,d),Page fault rate p=faultsreferencesEAT=(1-p)t_m+p\,t_{pf},\quad \text{Logical }(p,d)\to \text{Physical }(f,d),\quad \text{Page fault rate }p=\frac{\text{faults}}{\text{references}}

Micro-example. Memory access 100 ns, page fault service 8 ms, p=0.001p=0.001: EAT=0.999×100+0.001×8,000,000=99.9+8000=8099.9EAT=0.999\times100+0.001\times8,000,000=99.9+8000=8099.9 ns.

Examiner line. For memory management, translate the address, name the fragmentation/allocation issue, apply EAT or replacement steps, and state the thrashing/prevention implication.

5. I/O Management and Disk Scheduling

Recall anchor. I/O efficiency depends on buffering, interrupt/DMA handling, and disk head movement. File systems organize persistent data with naming, access, and protection.

Scored points.

  • I/O hardware includes devices, controllers, buses, and device drivers; I/O techniques: programmed I/O (polling), interrupt-driven I/O, and DMA for block transfers.
  • I/O buffering (single, double, circular) smooths speed mismatch between producer and consumer; spooling uses disk as large buffer for devices like printers.
  • Disk scheduling aims to reduce seek time and improve throughput/fairness: FCFS, SSTF, SCAN, C-SCAN, LOOK, C-LOOK; SSTF may starve far requests.
  • Disk access time: Taccess=Tseek+Trotation+Ttransfer+TcontrollerT_{access}=T_{seek}+T_{rotation}+T_{transfer}+T_{controller}; rotational latency averages half rotation.
  • File concept includes attributes, operations, and types; access methods are sequential, direct/random, and indexed. Directory structures include single-level, two-level, tree, and acyclic graph.
  • File allocation: contiguous (fast, external fragmentation), linked (no external fragmentation, poor random access), indexed (supports direct access, index overhead); free-space managed by bitmap/free list.

Formula strip.

Tdisk=Tseek+Trot+Txfer,Trot,avg=12R,DMA: CPU setup + transfer + interruptT_{disk}=T_{seek}+T_{rot}+T_{xfer},\quad T_{rot,avg}=\frac{1}{2R},\quad \text{DMA: CPU setup + transfer + interrupt}

Micro-example. Disk requests 98,183,37,122,14,124,65,67 with head at 53 (FCFS): total head movement = 640 cylinders. Average rotational latency at 7200 RPM is 0.5/120=4.170.5/120=4.17 ms.

Examiner line. For I/O and disk, specify the device transfer mode, compute seek/latency where given, compare scheduling orders, and state the file-allocation trade-off.

Memory map

%%{init: {'theme': 'base', 'look': 'handDrawn', 'themeVariables': {'fontFamily': "'Nunito', sans-serif", 'fontSize': '17px', 'primaryColor': '#EFEAD6', 'primaryBorderColor': '#0F766E', 'lineColor': '#23211C'}}}%%
flowchart LR
  U1["U1: Introduction"] --> U1a["OS functions/services"] --> U1b["Kernel structures, system calls"]
  U1b --> U2["U2: Concurrent Processes"] --> U2a["Critical section, semaphores"] --> U2b["IPC, classical problems"]
  U2b --> U3["U3: CPU Scheduling"] --> U3a["FCFS/SJF/RR/Priority"] --> U3b["Deadlock conditions/handling"]
  U3b --> U4["U4: Memory Management"] --> U4a["Paging/segmentation"] --> U4b["Virtual memory, EAT, thrashing"]
  U4b --> U5["U5: I/O Management and Disk Scheduling"] --> U5a["Buffering, DMA, disk scheduling"] --> U5b["File allocation, directories"]

Rapid recall

  1. U1 Introduction — OS manages CPU, memory, files, I/O; know batch/time-sharing/real-time/microkernel/monolithic and system-call mode switch.
  2. U2 Concurrent Processes — Race condition solved by mutual exclusion; semaphore wait/signal; Producer-Consumer, Dining Philosophers, Peterson/Dekker.
  3. U3 CPU Scheduling — Compute WT/TAT/RT from Gantt chart; RR quantum trade-off; deadlock needs four conditions.
  4. U4 Memory Management — Paging removes external fragmentation; virtual memory gives EAT = (1−p)tm+ptpf(1-p)t_m+p t_{pf}; LRU/Optimal/FIFO for page replacement.
  5. U5 I/O Management and Disk Scheduling — DMA reduces CPU load; disk time = seek + rotation + transfer; SSTF/SCAN/C-SCAN trade seek and fairness.

Final-answer checklist (BCS401)

  • Start with the OS term's definition and where it sits (process, memory, I/O, file, or deadlock).
  • For numericals, show Gantt chart/page trace/disk head movement before the final metric.
  • State assumptions: preemptive/non-preemptive, quantum, initial head position, page frame count, or memory access time.
  • Compare algorithms by the asked criterion (waiting time, fairness, starvation, fragmentation, seek time).
  • End with the computed value and a one-line interpretation of what it means for system performance.
Bottom Banner Ad