Operating System Interview Questions: 30 OS Questions With Simple Answers (2026)

Operating System Interview Questions: 30 OS Questions With Simple Answers (2026)

Last updated: November 2026

Operating systems (OS) come up in almost every fresher tech interview, from TCS and Infosys to product companies. Interviewers use OS questions to check whether you understand what happens under your code: how programs run, share the CPU, use memory and avoid getting stuck.

Below are 30 OS questions grouped by topic, each with a short answer you can say out loud in under a minute.

What gets asked most: process vs thread, process states, CPU scheduling, deadlock and its four conditions, mutex vs semaphore, paging, virtual memory and page replacement. If you can explain these with one example each, you will handle most OS rounds.

Basics

1. What is an operating system?

Software that manages a computer's hardware and gives programs a simple way to use it. It handles the CPU, memory, files and devices. Examples: Windows, Linux, macOS, Android.

2. What is the kernel?

The core of the OS that runs with full control of the hardware. It manages processes, memory and devices. Everything else, such as the shell or apps, asks the kernel for help through system calls.

3. What is a system call?

A request from a program to the kernel, for example to open a file, create a process or send data over the network. Examples on Linux: read(), write(), fork().

4. What is the difference between user mode and kernel mode?

In user mode, a program has limited access and cannot touch hardware directly. In kernel mode, code has full access. A system call switches from user mode to kernel mode and back.

5. Multiprogramming vs multitasking vs multiprocessing?

  • Multiprogramming: several programs in memory, so the CPU always has something to run.
  • Multitasking: the CPU switches between tasks so fast that they seem to run together.
  • Multiprocessing: more than one CPU or core running tasks at the same time.

Processes and threads

6. What is a process?

A program in execution. It has its own memory (code, data, heap, stack), open files and a state. Opening Chrome twice creates two processes from one program.

7. What is a thread?

The smallest unit the CPU schedules. A process can have many threads that share its memory but each has its own stack and registers. A browser might use one thread for the page and another for downloads.

8. Process vs thread: what is the difference?

ProcessThread
MemoryOwn address spaceShares the process's memory
Creation costHigherLower
CommunicationNeeds IPC (pipes, sockets, shared memory)Through shared variables
If one crashesOthers usually unaffectedCan bring down the whole process

9. What are the states of a process?

New, Ready, Running, Waiting (or Blocked) and Terminated. A process moves from Ready to Running when the scheduler picks it, and from Running to Waiting when it needs input or output.

10. What is a PCB?

The Process Control Block. The OS keeps one per process with its ID, state, registers, memory details and open files. The PCB is what lets the OS pause and resume a process.

11. What is a context switch?

Saving the state of the running process or thread and loading another one. It lets many tasks share one CPU, but it costs time, so too many switches slow the system down.

12. What are zombie and orphan processes?

A zombie has finished but its parent has not yet read its exit status, so it still has an entry in the process table. An orphan is still running but its parent has ended; on Linux, it is adopted by the init process.

13. What does fork() do?

On Unix-like systems, fork() creates a child process that is a copy of the parent. It returns 0 in the child and the child's process ID in the parent.

CPU scheduling

14. What is CPU scheduling?

Deciding which ready process gets the CPU next. Goals include high CPU use, short waiting time and quick response for users.

15. Name common scheduling algorithms.

  • FCFS (First Come, First Served): simple, but one long job can make everyone wait.
  • SJF (Shortest Job First): lowest average waiting time, but needs to know job length.
  • Round Robin: each process gets a fixed time slice in turn. Good for sharing.
  • Priority scheduling: highest priority runs first.

16. Preemptive vs non-preemptive scheduling?

In preemptive scheduling, the OS can take the CPU away from a running process, for example when its time slice ends. In non-preemptive scheduling, a process keeps the CPU until it finishes or waits.

17. What is starvation, and how does aging fix it?

Starvation is when a low-priority process never gets the CPU. Aging slowly raises a process's priority the longer it waits, so it eventually runs.

Synchronization and deadlock

18. What is a race condition?

When two threads change shared data at the same time and the result depends on timing. Example: two threads both read a bank balance of ₹100, both add ₹50, and the final balance is ₹150 instead of ₹200.

19. What is a critical section?

The part of code that uses shared data. Only one thread should run it at a time. A correct solution needs mutual exclusion, progress and bounded waiting.

20. Mutex vs semaphore?

A mutex is a lock: one thread holds it, and only that thread can release it. A semaphore is a counter that allows up to N threads in. A binary semaphore (0 or 1) works like a lock, but any thread can signal it.

21. What is a deadlock?

A state where processes wait for each other forever. Example: process A holds the printer and wants the scanner, while process B holds the scanner and wants the printer.

22. What are the four conditions for deadlock?

  1. Mutual exclusion: a resource can be used by one process at a time.
  2. Hold and wait: a process holds one resource while waiting for another.
  3. No preemption: resources cannot be taken away by force.
  4. Circular wait: a cycle of processes, each waiting for the next.

All four must hold at once. Breaking any one prevents deadlock.

23. How can deadlocks be handled?

Prevention (break one of the four conditions, such as always taking locks in the same order), avoidance (only grant requests that keep the system safe, as in the Banker's algorithm), detection and recovery (find the cycle and kill or roll back a process), or ignoring it, which many desktop systems do.

Memory management

24. What is paging?

Splitting memory into fixed-size blocks: pages in the program's view and frames in physical memory. A page table maps pages to frames. Paging removes external fragmentation.

25. Paging vs segmentation?

Paging uses fixed-size blocks and is invisible to the programmer. Segmentation splits memory into variable-size logical parts such as code, data and stack. Segmentation can cause external fragmentation.

26. What is virtual memory?

A technique that lets programs use more memory than the physical RAM, by keeping some pages on disk and loading them when needed. Each process sees its own large, private address space.

27. What is a page fault?

When a program uses a page that is not in RAM, the OS pauses it, loads the page from disk, updates the page table and resumes the program.

28. What is thrashing?

When the system spends more time swapping pages in and out than running programs, usually because too many processes compete for too little RAM. The fix is to reduce the number of running processes or add memory.

29. Name page replacement algorithms.

FIFO removes the oldest page. LRU (Least Recently Used) removes the page not used for the longest time. Optimal removes the page that will not be used for the longest time in future; it is used as a benchmark because the future is unknown. FIFO can show Belady's anomaly: more frames causing more page faults.

30. Internal vs external fragmentation?

Internal: wasted space inside an allocated block, such as using 3 KB of a 4 KB page. External: enough free memory in total, but split into small pieces that cannot hold a new request.

How to prepare for the OS round

  • Draw it. Process state diagram, a deadlock cycle, a page table. Interviewers like candidates who sketch.
  • Use one example per concept. The printer-scanner deadlock or the bank balance race condition is easy to remember.
  • Practise on Linux. Run ps, top and kill, and see processes for yourself. Our Linux interview questions help here.
  • Revise the other CS core subjects too: DBMS, OOP and DSA.

For a full list of first-job questions across HR and technical rounds, see our interview questions for freshers.

Ready for your first IT job?

See open IT roles for freshers on Weekday, from service companies to startups, with filters for city and skills.

See IT fresher jobs →

Frequently asked questions

What are the most important OS topics for interviews?

Processes and threads, CPU scheduling, deadlock, mutex and semaphore, paging, virtual memory and page replacement.

What is the difference between a process and a thread?

A process has its own memory. Threads live inside a process and share its memory, so they are lighter to create but can affect each other if one crashes.

What are the four conditions of deadlock?

Mutual exclusion, hold and wait, no preemption and circular wait. All four must be true at the same time for a deadlock.

What is the difference between a mutex and a semaphore?

A mutex is a lock owned by one thread at a time. A semaphore is a counter that can allow several threads in, and any thread can signal it.

Do service companies ask OS questions to freshers?

Yes. OS basics such as process vs thread and deadlock are common in technical rounds at service companies and product companies alike.

Latest Articles

Browse Articles
Use AI to find jobs and apply

Stop manually filling job applications. Use AI to auto-apply to jobs

Browse jobs now