Cheat sheets

OS-02Cheat sheet1 pageIn a paid pack

System Calls and Dual Mode

Dual-mode operation with a hardware mode bit, privileged instructions and what happens when user code tries one; traps, exceptions and interrupts as the only ways into the kernel; the step-by-step path of a system call through the libc wrapper, the trap, the system-call table and return-from-trap; how parameters are passed; the classes of system calls with POSIX examples; library calls that may or may not reach the kernel; and the difference between a mode switch and a context switch.

Diagrams from OS-02

OS-03Cheat sheet1 pageIn a paid pack

Processes and Process States

Program versus process and the process memory layout; the process control block and its fields; the five-state model with its six transitions and the transitions that cannot happen; suspended states and the medium-term scheduler; long-, short- and medium-term schedulers; what a context switch saves and why it is pure overhead; CPU-bound versus I/O-bound processes; zombie and orphan processes, exec, wait and exit.

Diagrams from OS-03

OS-04Cheat sheet1 pageIn a paid pack

fork(): Counting and Outputs

What fork() returns in the parent and the child, the 2 to the n rule and when it breaks, forks in loops, forks guarded by if, and forks inside && and || expressions, how many lines a loop of fork and printf prints, why a child sees its own copy of every variable, how stdio buffering can make text appear twice, what wait and exec change, and the solved GATE CS 2024 Set 1 Q.57. Every count was produced by a process-tree simulator.

Diagrams from OS-04

OS-05Cheat sheet1 pageIn a paid pack

Threads and Thread Models

What threads of one process share and what each thread owns; user-level versus kernel-level threads, who schedules them and what happens when one blocks; the many-to-one, one-to-one, many-to-many and two-level models; why thread creation and switching are cheaper than for processes; concurrency versus parallelism and Amdahl's law with computed speedups; the POSIX thread calls; and threading issues: fork in a threaded process, signals, cancellation and thread-safe code.