All cheat sheets
⚙️

Operating Systems

Processes, threads, scheduling, memory, deadlocks — interview essentials.

Process vs Thread

ProcessIndependent program in execution; own address space; heavy context switch.
ThreadLightweight unit within a process; shared memory; faster context switch.
PCBProcess Control Block stores PID, state, registers, memory info, I/O status.
Context switchSave/restore CPU state when scheduler switches processes/threads.

CPU Scheduling

FCFSFirst Come First Serve — simple, convoy effect possible.
SJFShortest Job First — optimal avg waiting; needs prediction.
Round RobinTime quantum; fair; quantum too small → thrashing switches.
PriorityStatic/dynamic priorities; risk of starvation → aging.

Memory & Deadlock

PagingFixed-size pages; external fragmentation avoided; page table overhead.
Virtual memoryUse disk as extension of RAM; demand paging + page faults.
Deadlock 4Mutual exclusion, hold & wait, no preemption, circular wait.
Banker's algoAvoidance: allocate only if system stays in safe state.