Operating System Basics — the mental models interviewers expect
Operating system (OS) questions test whether you understand how a computer actually manages running programs, memory, and resources — not textbook definitions in isolation. This page focuses on the mental models behind the most commonly asked topics.
Processes vs threads
A process is an independent running program with its own memory space. A thread is a lightweight unit of execution WITHIN a process, sharing that process's memory with other threads. This is why threads communicate faster than processes but are riskier — a bug in one thread can corrupt shared memory used by others.
Deadlocks — the four necessary conditions
A deadlock happens when processes wait on each other indefinitely for resources. It requires four conditions simultaneously: mutual exclusion, hold-and-wait, no preemption, and circular wait — breaking any ONE of these prevents deadlock, which is why solutions target just one condition at a time.
Memory paging — solving fragmentation
Paging divides memory into fixed-size blocks (pages) so a process's memory doesn't need to be one continuous block. This solves external fragmentation (wasted gaps between allocations) at the cost of some internal fragmentation (unused space within a page).
Examples
- A web browser with multiple tabs, each isolated, is closer to multiple processes; the tabs within one rendering engine sharing memory is closer to threads.
- Two processes each holding one resource the other needs, and refusing to release it, is a classic circular-wait deadlock.
- A 4KB page size means a process needing 4.1KB of memory actually gets allocated 8KB (two pages) — the extra 3.9KB is internal fragmentation.
Common mistakes
- Describing threads as 'lighter processes' without explaining that shared memory is the actual defining difference.
- Listing deadlock conditions without understanding that breaking just one prevents the deadlock.
- Confusing internal fragmentation (wasted space within an allocated block) with external fragmentation (wasted space between blocks).
Try it yourself
Which deadlock condition is broken if a process is forced to release its held resources when it requests a new one it can't get immediately?
Show answer
Hold-and-wait — the process is no longer allowed to hold resources while waiting for another.
Frequently asked questions
Are these concepts asked in both exams and interviews?
Yes — process/thread differences, deadlocks, and memory management are common in both college OS exams and technical placement interviews.
Can Learn2Plus AI explain this with a real-world analogy?
Yes — ask for a real-life analogy and you'll get one tailored to the specific OS concept you're stuck on.
Can I get OS interview-style practice questions?
Yes — ask for OS interview practice and you'll get one question at a time with feedback.
Related topics
Practice OS concepts with Learn2Plus AI
Try 2 lessons free — no card required.