LearnThatStack Ace your next interview
Computer Science Fundamentals

Operating Systems.

Start free Change topic Change

Practise Operating Systems one question at a time. Answer out loud or in writing, get graded, and see exactly what you missed.

Try one question

What does an operating system actually do for a running program?

The answer

An operating system sits between your program and the hardware and shares the CPU, memory and devices among every running program. Your code never talks to the disk or network directly. It asks the OS through system calls, and the OS grants access.

The OS has three main jobs. It schedules CPU time, so many programs take turns on limited cores. It gives each program its own view of memory, so a bug in one program cannot overwrite another program's memory. It also manages files, devices and the network behind uniform interfaces.

This design lets your program act as if it has the machine to itself, while dozens of programs share it. Without the OS enforcing those boundaries, a single careless loop could freeze everything or read another program's secrets.

Example · what grading looks like
What is a process, and what does the OS track about it?

“A process is basically a program that's actually running, and each one gets its own memory space, so if I open the same program twice they're two separate processes that can't see each other's memory. The OS keeps a process control block for each one, which holds things like the process ID, its current state like running or waiting, the program counter and registers, its open files, and its priority for scheduling.”

Knew it

They've got the core definition and the main PCB fields - PID, state, program counter, registers, files, priority. Missing parent process and memory layout, and didn't mention that saving/restoring registers is what makes context switching possible.

Missed: Didn't mention the OS tracks the parent process

Missed: Didn't mention memory layout as something tracked separately in the PCB

Missed: Left out why this bookkeeping matters: it's what lets the OS pause a process and resume it later from where it stopped


Get your own answers graded

Sign up free. Your account comes with 50 credits for grading, and it remembers what you missed.

What it covers

All 56 questions

Each on its own page

Kernel, system calls and privilege

What the OS does for a program, user and kernel mode, how system calls, interrupts and traps cross into the kernel, and how kernels are structured.

6 questions

  1. What does an operating system actually do for a running program?
  2. What is a system call, and how does it differ from a normal function call?
  3. What are user mode and kernel mode, and why do we need both?
  4. What hardware mechanism lets a system call cross into kernel mode? Pro
  5. What is the difference between a monolithic kernel and a microkernel? Pro
  6. What is the difference between an interrupt and a trap? Pro

Processes and threads

What a process is, how threads differ from processes, why threads are cheaper, when to choose each, and user-level versus kernel-level threads.

5 questions

  1. What is a process, and what does the OS track about it?
  2. What is the difference between a process and a thread?
  3. Why is creating a thread cheaper than creating a whole new process? Pro
  4. When should you use multiple processes instead of multiple threads? Pro
  5. What is the difference between user-level threads and kernel-level threads? Pro

Process lifecycle, fork and exec

How a program starts with fork and exec, why fork uses copy-on-write and can still be slow, and how zombie and orphan processes arise.

5 questions

  1. What actually happens, step by step, when you run a program? Pro
  2. Why does fork use copy-on-write instead of copying all the memory? Pro
  3. Why do you call fork and exec separately instead of in one step? Pro
  4. What are zombie and orphan processes, and how do they come about? Pro
  5. Why does fork get slow for a process using lots of memory? Pro

CPU scheduling and context switches

How the OS picks who runs next, classic and modern scheduling policies, what context switches cost in caches, and how NUMA changes the cost of memory access.

7 questions

  1. What is a context switch, and why is it considered expensive? Pro
  2. What is CPU scheduling, and why must the OS decide who runs next? Pro
  3. How does a preemptive scheduler differ from a cooperative one? Pro
  4. How do FCFS, shortest job first, and round robin scheduling compare? Pro
  5. Why can frequent context switches quietly wreck CPU cache performance? Pro
  6. How does NUMA change the cost of reaching memory across sockets? Pro
  7. How does a scheduler stay fair and fast with thousands of runnable threads? Pro

Signals, IPC and debugging

How processes receive signals and what is safe in a handler, the main ways processes communicate, and how a debugger stops and inspects a process.

4 questions

  1. What is a signal, and how does a process respond to one? Pro
  2. What are the main ways processes communicate with each other? Pro
  3. What restricts which functions are safe to call inside a signal handler? Pro
  4. How does a debugger use the OS to stop and inspect a process? Pro

Memory layout, stack and heap

The regions of a process's address space, how the stack and heap differ and grow, how malloc gets memory, and how guard pages catch stack overflow.

5 questions

  1. What is the difference between the stack and the heap in memory?
  2. How does malloc get memory from the OS, and does free return it? Pro
  3. Why does the stack have a fixed limit while the heap can grow? Pro
  4. What are the main regions of a process's memory layout, and what lives where? Pro
  5. How do guard pages catch a stack that grows past its limit? Pro

Virtual memory and address translation

Why each process gets its own address space, how the MMU, page tables and TLB translate addresses, and the costs of huge pages and TLB shootdowns.

7 questions

  1. What is virtual memory, and why does each process get its own address space?
  2. How does the OS translate a virtual address into a physical one? Pro
  3. What is the TLB, and why does a miss slow things down? Pro
  4. What is the difference between paging and segmentation? Pro
  5. How do multi-level page tables keep the page table from getting huge? Pro
  6. What are huge pages, and when do they actually improve performance? Pro
  7. What is a TLB shootdown, and why does it worsen with more cores? Pro

Page faults and memory pressure

Page faults and demand paging, page eviction, thrashing, overcommit and the OOM killer, and how to diagnose latency and slowdowns caused by paging.

7 questions

  1. What is a page fault, and does it always mean something is wrong? Pro
  2. What is demand paging, and why not load the whole program upfront? Pro
  3. What is thrashing, and why does adding more load make it worse? Pro
  4. What is memory overcommit, and what does the OOM killer do about it? Pro
  5. How can a single page fault cause a latency spike on a hot path? Pro
  6. How does the OS choose which page to evict when memory fills up? Pro
  7. How would you diagnose a program that has grown slow because of paging? Pro

File descriptors and I/O models

What file descriptors are and what limits them, blocking versus non-blocking I/O, why buffering helps, and how epoll scales past select.

5 questions

  1. What is a file descriptor, and how does a program use one? Pro
  2. What is the difference between blocking and non-blocking I/O? Pro
  3. Why is buffered I/O faster than writing one byte at a time? Pro
  4. What limits how many file descriptors a process or system can open? Pro
  5. How do epoll and select differ when handling a hundred thousand connections? Pro

Page cache, mmap and zero-copy

How the page cache serves file I/O and how fsync makes it durable, memory-mapped files, zero-copy with sendfile, and when direct I/O bypasses the cache.

5 questions

  1. How do memory-mapped files differ from ordinary read and write calls? Pro
  2. What happens when you memory-map a file larger than physical RAM? Pro
  3. How does zero-copy I/O like sendfile avoid unnecessary memory copies? Pro
  4. What is the page cache, and how does fsync relate to durability? Pro
  5. When is direct I/O a better choice than going through the page cache? Pro
Practice · Questions

All questions

Showing of 56
Beginner 12
01

What does an operating system actually do for a running program?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

An operating system sits between your program and the hardware and shares the CPU, memory and devices among every running program. Your code never talks to the disk or network directly. It asks the OS through system calls, and the OS grants access.

The OS has three main jobs. It schedules CPU time, so many programs take turns on limited cores. It gives each program its own view of memory, so a bug in one program cannot overwrite another program's memory. It also manages files, devices and the network behind uniform interfaces.

This design lets your program act as if it has the machine to itself, while dozens of programs share it. Without the OS enforcing those boundaries, a single careless loop could freeze everything or read another program's secrets.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

02

What is a process, and what does the OS track about it?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

A process is a running instance of a program, with its own memory and resources. Launching the same program twice creates two processes that cannot see each other's memory.

The OS tracks each process in a structure often called a process control block.

  • Process ID
  • Current registers
  • Program counter
  • Memory layout
  • Open file descriptors
  • Parent process
  • Scheduling priority
  • Current state, such as running, ready or waiting

This bookkeeping is what makes pausing and resuming possible. When the OS switches away, it saves those registers, then restores them later so the process continues where it stopped.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

03

What is the difference between a process and a thread?

Visual

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain
Visual

The core difference is memory sharing. A process owns a private address space. Threads live inside one process and share that space, including the heap and global data.

Because threads share memory, they can pass data by reading and writing the same variables. Two processes cannot, so they need pipes, sockets or shared-memory setups. Each thread still gets its own stack and registers, so it can run its own function calls independently.

The tradeoff is safety versus speed. Shared memory makes thread communication fast but risky, since one thread's bad write can corrupt another's data. Separate processes stay isolated, so a crash in one usually leaves the others running. Pick threads for tight cooperation and processes for isolation.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

04

What is the difference between the stack and the heap in memory?

Visual

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain
Visual

The stack holds local variables and call frames that last until their function returns, while the heap holds memory you allocate and free yourself.

The stack is automatic and fast. Each function call pushes a frame, and returning pops it. The compiler must know each frame's size up front, and the return frees that space at once.

The heap is flexible. You allocate a block, use it as long as you like, then free it yourself.

That flexibility has a cost. Heap allocation is slower, and the heap can fragment over time. Forget to free a block, and you leak memory.

Use the stack for short-lived, fixed-size data, and the heap when the size is unknown or the data must outlive the call.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

05

What is virtual memory, and why does each process get its own address space?

Visual

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain
Visual

Virtual memory gives each process a private address space, a range of addresses the OS maps onto physical RAM. Your program sees one continuous range starting near zero, even though physical memory is shared and scattered.

The hardware and OS translate every virtual address to a physical one during access. A process can only reach memory it owns, because its map has no entry for anyone else's pages.

That isolation is the main reason for separate address spaces. One process cannot read or corrupt another's data through a stray pointer. It also simplifies your code, since every program can assume the same layout. And because pages not in use can wait on disk, the machine can run programs whose combined footprint exceeds its RAM.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

06

What is a system call, and how does it differ from a normal function call?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

A system call is a request to the OS kernel to do something your program cannot do alone. Reading a file, opening a socket or asking the OS for more memory all end in system calls.

A normal function call stays inside your program's own code and privileges. A system call crosses the privilege boundary. The CPU switches from user mode into kernel mode, runs trusted kernel code, then switches back with a result.

That crossing is why system calls cost more than normal function calls. The mode switch takes time, and the kernel saves your registers on entry and restores them on return. Libraries often batch or buffer work to make fewer system calls.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

07

What are user mode and kernel mode, and why do we need both?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

User mode and kernel mode are CPU privilege levels, and modern CPUs have at least these two. Kernel mode can touch any hardware and any memory. User mode is restricted, and that is where your application code runs.

Your program cannot directly access devices or other processes' memory while in user mode. When it needs a privileged action, it makes a system call. That call enters kernel code at a fixed entry point and runs it in kernel mode.

The split exists because programs cannot be trusted with full access. If every program ran with full privileges, one bug or one malicious line could crash the machine or steal data. With two modes, the kernel checks each privileged request before carrying it out.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

08

What is a context switch, and why is it considered expensive?

Part of Pro Visual
09

What is a file descriptor, and how does a program use one?

Part of Pro Visual
10

What is a page fault, and does it always mean something is wrong?

Part of Pro Visual
11

What actually happens, step by step, when you run a program?

Part of Pro
12

What is CPU scheduling, and why must the OS decide who runs next?

Part of Pro
Intermediate 25
13

Why is creating a thread cheaper than creating a whole new process?

Part of Pro
14

How does the OS translate a virtual address into a physical one?

Part of Pro Visual
15

What is the TLB, and why does a miss slow things down?

Part of Pro Visual
16

Why does fork use copy-on-write instead of copying all the memory?

Part of Pro Visual
17

Why do you call fork and exec separately instead of in one step?

Part of Pro Visual
18

What is the difference between blocking and non-blocking I/O?

Part of Pro
19

Why is buffered I/O faster than writing one byte at a time?

Part of Pro
20

How do memory-mapped files differ from ordinary read and write calls?

Part of Pro Visual
21

What is a signal, and how does a process respond to one?

Part of Pro
22

What are zombie and orphan processes, and how do they come about?

Part of Pro Visual
23

What is demand paging, and why not load the whole program upfront?

Part of Pro Visual
24

How does malloc get memory from the OS, and does free return it?

Part of Pro Visual
25

Why does the stack have a fixed limit while the heap can grow?

Part of Pro
26

What is thrashing, and why does adding more load make it worse?

Part of Pro
27

How does a preemptive scheduler differ from a cooperative one?

Part of Pro
28

When should you use multiple processes instead of multiple threads?

Part of Pro
29

What are the main regions of a process's memory layout, and what lives where?

Part of Pro Visual
30

What hardware mechanism lets a system call cross into kernel mode?

Part of Pro
31

What is the difference between paging and segmentation?

Part of Pro Visual
32

How do FCFS, shortest job first, and round robin scheduling compare?

Part of Pro Visual
33

What is the difference between a monolithic kernel and a microkernel?

Part of Pro
34

What is the difference between an interrupt and a trap?

Part of Pro
35

What are the main ways processes communicate with each other?

Part of Pro
36

What is the difference between user-level threads and kernel-level threads?

Part of Pro Visual
37

What limits how many file descriptors a process or system can open?

Part of Pro
Expert 19
38

How do multi-level page tables keep the page table from getting huge?

Part of Pro Visual
39

What are huge pages, and when do they actually improve performance?

Part of Pro
40

Why can frequent context switches quietly wreck CPU cache performance?

Part of Pro Visual
41

What is a TLB shootdown, and why does it worsen with more cores?

Part of Pro Visual
42

Why does fork get slow for a process using lots of memory?

Part of Pro
43

How do epoll and select differ when handling a hundred thousand connections?

Part of Pro
44

What is memory overcommit, and what does the OOM killer do about it?

Part of Pro
45

What happens when you memory-map a file larger than physical RAM?

Part of Pro Visual
46

How does zero-copy I/O like sendfile avoid unnecessary memory copies?

Part of Pro Visual
47

What is the page cache, and how does fsync relate to durability?

Part of Pro Visual
48

How can a single page fault cause a latency spike on a hot path?

Part of Pro
49

What restricts which functions are safe to call inside a signal handler?

Part of Pro Visual
50

How does NUMA change the cost of reaching memory across sockets?

Part of Pro Visual
51

How do guard pages catch a stack that grows past its limit?

Part of Pro Visual
52

How does a debugger use the OS to stop and inspect a process?

Part of Pro Visual
53

When is direct I/O a better choice than going through the page cache?

Part of Pro
54

How does the OS choose which page to evict when memory fills up?

Part of Pro Visual
55

How does a scheduler stay fair and fast with thousands of runnable threads?

Part of Pro
56

How would you diagnose a program that has grown slow because of paging?

Part of Pro

No matches

Try a different filter or search term.

Know someone prepping for Operating Systems? Send them this set.
Quick recap

Operating Systems in pictures.

A quick recap of Operating Systems in 31 short animated pictures, one idea at a time. About 8 min to get the whole topic back in your head before you walk in. Pause any picture, slow it down, or step through it.

Pro The first chapter is free to play. The other 28 pictures come with Pro.

Get Pro · $10/mo
Pro · $10/mo

49 of 56 Operating Systems answers are in Pro.

Full answers, code samples, and AI explanations that go simpler or deeper. Cancel anytime.

  • Full answers + code
  • AI explanations, simpler or deeper
  • 1,000 AI credits / month
  • Cancel anytime

Change topic

Pick a different technology or stack. Your current topic stays put until you choose a new one.

Technologies
No technologies match “”.
Cross-cutting topics
No topics match “”.
By role
Stacks & frameworks

MEAN

MongoDB, Express, Angular, Node.js

MERN

MongoDB, Express, React, Node.js

LAMP

Linux, Apache, MySQL, PHP

Django

Python Full-Stack Development

Ruby on Rails

Convention over Configuration

Serverless on AWS

Serverless Architecture on AWS

Flutter Mobile

Flutter Cross-Platform Mobile Development

Spring Boot

Enterprise Java Development

.NET

Microsoft Ecosystem

Vue

Vue.js, Vite, TypeScript, Tailwind, Node.js

Go Backend

Golang, gRPC, PostgreSQL, Redis, RabbitMQ

FastAPI

Python, FastAPI, SQLAlchemy, PostgreSQL

React Native

React, TypeScript, Redux, Firebase

iOS Native

Swift, SwiftUI, UIKit, Firebase

Android Native

Java, Jetpack Compose, Firebase

DevOps / Platform

Docker, Kubernetes, Terraform, CI/CD

AI Engineer

LLMs, RAG, Agents, Evals

AI-Powered Developer

Claude Code, Copilot, Agentic Workflows

Core SWE Interview Prep

Data structures, algorithms, OS, concurrency, networking, git