Krazy Kaksha

Interview Prep

Top 40 Operating System Interview Questions and Answers for Freshers (2026)

Krazy Kaksha 6 min read

Top 40 Operating System Interview Questions and Answers for Freshers (2026)

Operating System (OS) is one of the four core subjects in every tech interview, along with DBMS, Computer Networks and OOPs. Interviewers do not want long theory; they want clear one-line definitions and one good example. These 40 questions cover almost everything asked in campus placements and fresher interviews.

Short on time? Read the bold lines first, then come back for the details.

Basics

1. What is an operating system?
An OS is system software that sits between the user and the hardware and manages CPU, memory, files and devices. Examples: Windows, Linux, macOS, Android.

2. What are the main functions of an OS?
Process management, memory management, file management, device (I/O) management, security and providing a user interface.

3. What is a kernel?
The core part of the OS that runs in privileged mode and directly controls hardware. Types: monolithic (Linux), microkernel (Minix, QNX) and hybrid (Windows, macOS).

4. What is a system call?
A request from a program to the kernel for a service like reading a file or creating a process. Examples: fork(), exec(), read(), write().

5. What is the difference between user mode and kernel mode?
In user mode programs have limited access; in kernel mode the OS has full access to hardware. A system call switches from user to kernel mode.

6. What are the types of operating systems?
Batch, time-sharing (multitasking), multiprogramming, multiprocessing, distributed, network and real-time OS.

Processes and threads

7. What is a process?
A program in execution. It has its own code, data, stack, heap and a Process Control Block (PCB).

8. What are the states of a process?
New, Ready, Running, Waiting (Blocked) and Terminated.

9. What is a PCB?
The Process Control Block stores everything the OS needs about a process: process ID, state, program counter, registers, priority, memory limits and open files.

10. What is a thread?
The smallest unit of execution inside a process. Threads of one process share code, data and files but have their own stack and registers.

11. Process vs thread?

ProcessThread
HeavyweightLightweight
Own memory spaceShares memory with other threads of the process
Context switch is slowContext switch is fast
Crash does not affect othersOne thread crash can stop the whole process

12. What is context switching?
Saving the state of the running process and loading the state of the next one, so the CPU can switch between processes.

13. What is a zombie process and an orphan process?
A zombie has finished but its parent has not read its exit status. An orphan is still running but its parent has ended; it is adopted by the init process.

14. What is IPC?
Inter-process communication: ways for processes to share data, such as pipes, message queues, shared memory, sockets and signals.

CPU scheduling

15. What is CPU scheduling?
Deciding which ready process gets the CPU next, to keep the CPU busy and reduce waiting time.

16. Preemptive vs non-preemptive scheduling?
In preemptive scheduling the OS can take the CPU away from a running process (Round Robin, SRTF). In non-preemptive, the process keeps the CPU until it finishes or waits (FCFS, SJF).

17. Explain the main scheduling algorithms.

  • FCFS: first come, first served. Simple, but short jobs wait behind long ones (convoy effect).
  • SJF / SRTF: shortest job first. Lowest average waiting time, but long jobs can starve.
  • Round Robin: each process gets a fixed time quantum in turns. Fair, good for time-sharing.
  • Priority: highest priority first. Can cause starvation; solved by aging.
  • Multilevel queue: separate queues for different types of processes.

18. Define turnaround time, waiting time and response time.
Turnaround = completion time minus arrival time. Waiting = turnaround minus burst time. Response = time of first CPU allocation minus arrival time.

19. What is starvation and aging?
Starvation is when a process waits forever because others keep getting priority. Aging slowly increases the priority of waiting processes to prevent it.

Synchronization and deadlock

20. What is a critical section?
The part of code that accesses shared data. Only one process should run it at a time.

21. What is a race condition?
When the result depends on the order in which processes access shared data, giving wrong or unpredictable output.

22. What is a semaphore?
An integer variable used for synchronization with two operations, wait (P) and signal (V). A binary semaphore works like a lock; a counting semaphore allows N processes.

23. Mutex vs semaphore?
A mutex is a lock owned by one thread and must be released by the same thread. A semaphore is a counter and can be signalled by any process.

24. What is a deadlock?
A situation where two or more processes wait for each other’s resources forever.

25. What are the four conditions for deadlock?
Mutual exclusion, hold and wait, no preemption and circular wait. All four must hold at the same time.

26. How can deadlocks be handled?
Prevention (break one of the four conditions), avoidance (Banker’s algorithm), detection and recovery, or ignoring it (the ostrich method, used by most desktop OSes).

27. What is the Banker’s algorithm?
A deadlock avoidance algorithm that grants a request only if the system stays in a safe state, meaning all processes can still finish in some order.

Memory management

28. What is paging?
Dividing a process into fixed-size pages and memory into equal frames, so a process need not be stored contiguously. It removes external fragmentation.

29. What is segmentation?
Dividing a program into variable-size logical segments like code, stack and data.

30. Internal vs external fragmentation?
Internal: wasted space inside an allocated block (common in paging). External: free memory is split into small pieces that cannot be used together (common in segmentation).

31. What is virtual memory?
A technique that lets a process run even if it is not fully in RAM, using disk space as an extension of memory.

32. What is demand paging?
Pages are loaded into memory only when they are needed, not all at the start.

33. What is a page fault?
When a process accesses a page that is not in RAM, the OS must bring it from disk.

34. Name the page replacement algorithms.
FIFO, LRU (least recently used) and Optimal. Optimal gives the fewest faults but needs future knowledge, so it is used only for comparison.

35. What is thrashing?
When the system spends more time swapping pages than executing, because processes do not have enough frames.

36. What is Belady’s anomaly?
In FIFO, increasing the number of frames can sometimes increase page faults.

37. What is a TLB?
The Translation Lookaside Buffer is a small, fast cache that stores recent page table entries to speed up address translation.

Files, disks and booting

38. What are the file allocation methods?
Contiguous, linked and indexed allocation.

39. Name the disk scheduling algorithms.
FCFS, SSTF, SCAN (elevator), C-SCAN, LOOK and C-LOOK.

40. What happens when you switch on a computer (booting)?
BIOS/UEFI runs the power-on self test, finds the boot device, loads the bootloader, which loads the kernel into memory, and the kernel starts the first process.

How to revise OS in one evening

  1. Learn the definitions above by heart.
  2. Practise 2 numericals each on Round Robin, SJF and page replacement (FIFO, LRU).
  3. Be ready to draw: the process state diagram and a deadlock cycle.

Want the full notes? Read our free Operating System short notes for placements and the OS interview questions PDF. Also see how much DSA you need for placements and the OOPs interview questions.

Doubts? Ask here

Leave a comment

Your email is not shown. Comments appear after a quick check.