All questions
Showing of 50What does an operating system actually do for a running program?
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:
Last attempt -
An operating system stands between your program and the raw hardware. Your code never talks to the disk or network directly. It asks the OS, which grants access through system calls.
Three jobs dominate. The OS schedules CPU time, so many programs take turns on limited cores. It hands each program its own memory view, so one bug cannot scribble on another. It manages files, devices, and network behind uniform interfaces.
This design lets your program pretend it owns the machine. In reality dozens of programs share one box. Without the OS enforcing boundaries, a single careless loop could freeze everything or read another program's secrets. That isolation and sharing is the whole point.
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 ↓
What is a process, and what does the OS track about it?
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:
Last attempt -
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. It records the process ID, current registers, the program counter, and memory layout. It also holds open file descriptors, the parent process, scheduling priority, and current state like 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 exactly where it stopped. The tracked state is the process's whole identity to the kernel.
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 ↓
What is the difference between a process and a thread?
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:
Last attempt -
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 just reading the same variables. Two processes cannot; 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. Separate processes stay isolated, so a crash in one usually leaves the others standing. Pick threads for tight cooperation, processes for isolation.
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 ↓
What is the difference between the stack and the heap in memory?
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:
Last attempt -
Both hold your program's data, but they behave very differently. The stack stores local variables and function call frames. The heap stores memory you request explicitly and control by hand.
The stack is automatic and fast. Each function call pushes a frame; returning pops it. Sizes must be known up front, and the space is freed the instant the function returns. The heap is flexible. You allocate a block, use it as long as you like, then free it yourself.
That flexibility carries a cost. Heap allocation is slower and can fragment over time. Forget to free, and you leak memory. Use the stack for short-lived, fixed-size data, and the heap when size or lifetime outlives one function call.
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 ↓
What is virtual memory, and why does each process get its own address space?
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:
Last attempt -
Virtual memory gives each process a private set of addresses that the OS maps to real physical RAM. Your program sees a clean, 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 simply has no entry for anyone else's pages.
That isolation is the main payoff. 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 familiar layout. And it lets the machine run programs whose combined footprint exceeds the RAM actually installed.
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 ↓
What is a system call, and how does it differ from a normal function call?
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:
Last attempt -
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 allocating memory all end in system calls.
A normal function call stays inside your program's own code and privileges. A system call crosses a hard 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 plain calls. There is mode-switching overhead and saved state on each side. Libraries often batch or buffer work to make fewer of them. So treat system calls as the expensive doorway between your code and the machine's protected parts.
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 ↓
What are user mode and kernel mode, and why do we need both?
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:
Last attempt -
Modern CPUs run in at least two privilege levels. Kernel mode can touch any hardware and any memory. User mode is restricted, and that is where your application code lives.
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, which safely transfers control to kernel code running in kernel mode.
We need both because trust is not free. If every program ran with full privileges, one bug or one malicious line could crash the machine or steal data. The two-mode split lets the kernel police every dangerous action. User code stays sandboxed, and the kernel stays the single gatekeeper.
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 ↓
What is a context switch, and why is it considered expensive?
What is a file descriptor, and how does a program use one?
What is a page fault, and does it always mean something is wrong?
What actually happens, step by step, when you run a program?
What is CPU scheduling, and why must the OS decide who runs next?
Why is creating a thread cheaper than creating a whole new process?
How does the OS translate a virtual address into a physical one?
What is the TLB, and why does a miss slow things down?
Why does fork use copy-on-write instead of copying all the memory?
Why do you call fork and exec separately instead of in one step?
What is the difference between blocking and non-blocking I/O?
Why is buffered I/O faster than writing one byte at a time?
How do memory-mapped files differ from ordinary read and write calls?
What is a signal, and how does a process respond to one?
What are zombie and orphan processes, and how do they come about?
What is demand paging, and why not load the whole program upfront?
How does malloc get memory from the OS, and does free return it?
Why does the stack have a fixed limit while the heap can grow?
What is thrashing, and why does adding more load make it worse?
How does a preemptive scheduler differ from a cooperative one?
When should you use multiple processes instead of multiple threads?
What are the main regions of a process's memory layout, and what lives where?
What hardware mechanism lets a system call cross into kernel mode?
How do multi-level page tables keep the page table from getting huge?
What are huge pages, and when do they actually improve performance?
Why can frequent context switches quietly wreck CPU cache performance?
What is a TLB shootdown, and why does it worsen with more cores?
Why does fork get slow for a process using lots of memory?
How do epoll and select differ when handling a hundred thousand connections?
What is memory overcommit, and what does the OOM killer do about it?
What happens when you memory-map a file larger than physical RAM?
How does zero-copy I/O like sendfile avoid unnecessary memory copies?
What is the page cache, and how does fsync relate to durability?
How can a single page fault cause a latency spike on a hot path?
What restricts which functions are safe to call inside a signal handler?
How does NUMA change the cost of reaching memory across sockets?
What limits how many file descriptors a process or system can open?
How do guard pages catch a stack that grows past its limit?
How does a debugger use the OS to stop and inspect a process?
When is direct I/O a better choice than going through the page cache?
How does the OS choose which page to evict when memory fills up?
How does a scheduler stay fair and fast with thousands of runnable threads?
How would you diagnose a program that has grown slow because of paging?
This answer is part of Pro.
The full written answer, with the trade-offs and follow-ups an interviewer will probe.
No matches
Try a different filter or search term.
43 of 50 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.
MEAN
MongoDB, Express, Angular, Node.jsMERN
MongoDB, Express, React, Node.jsDjango
Python Full-Stack DevelopmentRuby on Rails
Convention over ConfigurationServerless on AWS
Serverless Architecture on AWSInterviewers also test these - they're common to every stack, whichever one you picked above.
Flutter Mobile
Flutter Cross-Platform Mobile DevelopmentInterviewers also test these - they're common to every stack, whichever one you picked above.
Spring Boot
Enterprise Java Development.NET
Microsoft EcosystemVue
Vue.js, Vite, TypeScript, Tailwind, Node.jsGo Backend
Golang, gRPC, PostgreSQL, Redis, RabbitMQInterviewers also test these - they're common to every stack, whichever one you picked above.
FastAPI
Python, FastAPI, SQLAlchemy, PostgreSQLReact Native
React, TypeScript, Redux, FirebaseiOS Native
Swift, SwiftUI, UIKit, FirebaseAndroid Native
Java, Jetpack Compose, FirebaseDevOps / Platform
Docker, Kubernetes, Terraform, CI/CDInterviewers also test these - they're common to every stack, whichever one you picked above.
AI Engineer
LLMs, RAG, Agents, EvalsAI-Powered Developer
Claude Code, Copilot, Agentic WorkflowsCore SWE Interview Prep
Data structures, algorithms, OS, concurrency, networking, gitInterviewers also test these - they're common to every stack, whichever one you picked above.
Interviewers also test these - they're common to every stack, whichever one you picked above.