Operating SystemsOperating Systemsbeginner

OS Interview Questions for Freshers

25 operating system questions for campus rounds and vivas, from process vs thread to scheduling, deadlock and memory, with short answers and two worked scheduling examples.

Published
TL;DR – Quick Answer

OS interviews for freshers cover processes and threads, process states, CPU scheduling algorithms, synchronisation, deadlock and memory management such as paging and virtual memory. Learn each answer as a one-line definition plus a simple example, and practise one scheduling calculation by hand.

On This Page

Operating system interview questions for freshers come up in viva, written tests and the core subject part of technical rounds. Interviewers want simple, correct definitions and a small example. This page has 25 OS questions with short answers, including two scheduling problems solved step by step.

How to answer OS interview questions

Give the definition, then a daily-life or laptop example. "A process is a program in execution. When you open Chrome twice, you get two processes from the same program."

For numericals, draw the Gantt chart first. The interviewer can follow your steps, and you make fewer mistakes.

Pro tip: Open Task Manager or run top before the interview. Seeing real processes and threads makes these answers easier to explain.

OS basics questions

Q1. What is an operating system?

30-second answer: An operating system is software that manages the computer's hardware and gives programs a safe way to use it. It handles processes, memory, files, devices and security. Windows, Linux, macOS and Android are examples.

Q2. What is a kernel?

30-second answer: The kernel is the core of the OS that runs with full access to the hardware. It manages CPU scheduling, memory and devices.

Type Idea Example
Monolithic Most services run inside the kernel Linux
Microkernel Kernel kept small, services run outside it MINIX, QNX
Hybrid Mix of both Windows NT family, macOS XNU

Q3. What is a system call, and what are user mode and kernel mode?

30-second answer: A system call is how a program asks the kernel for a service, such as reading a file or creating a process. Programs run in user mode with limited rights. During a system call, the CPU switches to kernel mode, the kernel does the work, and control returns to user mode.

Examples are read, write, fork and exec on Linux.

Process and thread questions

Q4. What is the difference between a program and a process?

30-second answer: A program is a file of instructions stored on disk. A process is a program in execution, with its own memory, open files and CPU state. One program can run as many processes at once.

Q5. What are the states of a process?

30-second answer: New, ready, running, waiting (also called blocked) and terminated.

State Meaning
New Being created
Ready Waiting for the CPU
Running Using the CPU
Waiting Waiting for I/O or an event
Terminated Finished

A running process goes back to ready if its time slice ends, and to waiting if it asks for I/O.

Q6. What is a Process Control Block (PCB)?

30-second answer: The PCB is the data the OS keeps for each process. It holds the process ID, state, program counter, CPU registers, scheduling details, memory information and the list of open files. The OS uses it to pause a process and resume it later.

Q7. What is the difference between a process and a thread?

30-second answer: A process has its own memory space. A thread is a path of execution inside a process, and threads of the same process share its memory and open files. Threads are cheaper to create and switch, but a bug in one thread can affect the others.

Point Process Thread
Memory Separate Shared with other threads
Creation cost Higher Lower
Communication Needs IPC (pipes, sockets) Through shared memory
Crash effect Usually stays in that process Can bring down the whole process

See process vs thread for more examples.

Q8. What is a context switch?

30-second answer: A context switch is when the CPU stops one process or thread, saves its state in its PCB, and loads the state of another. It lets many tasks share one CPU. It costs time, because no useful work is done during the switch.

Q9. What is the difference between multiprogramming, multitasking, multiprocessing and multithreading?

Term Meaning
Multiprogramming Several programs in memory, CPU switches when one waits for I/O
Multitasking CPU time shared in small slices so many tasks seem to run together
Multiprocessing More than one CPU or core runs tasks truly in parallel
Multithreading One process has several threads

30-second answer: Multiprogramming keeps the CPU busy. Multitasking adds time slices for quick response. Multiprocessing uses more than one processor. Multithreading splits one process into threads.

Q10. What are zombie and orphan processes?

30-second answer: A zombie process has finished, but its parent has not yet read its exit status, so its entry stays in the process table. An orphan process is still running, but its parent has ended. On Linux, orphans are adopted by init or another reaper process, which later collects them.

CPU scheduling questions

Q11. What is CPU scheduling, and what is the difference between preemptive and non-preemptive scheduling?

30-second answer: CPU scheduling decides which ready process gets the CPU next. In non-preemptive scheduling, a process keeps the CPU until it finishes or waits. In preemptive scheduling, the OS can take the CPU away, for example when a time slice ends or a higher-priority process arrives.

Q12. Explain the common scheduling algorithms.

Algorithm Rule Preemptive? Main issue
FCFS First come, first served No Long job delays short ones
SJF Shortest burst first No Needs burst time, can starve long jobs
SRTF Shortest remaining time first Yes Same as SJF
Priority Highest priority first Either Low priority can starve
Round Robin Fixed time slice in turn Yes Slice size affects performance

30-second answer: FCFS is simple. SJF gives the lowest average waiting time when burst times are known. Round Robin is fair and suits time-sharing systems.

Q13. Solve: FCFS vs SJF waiting time

Three processes arrive at time 0 with burst times P1 = 5, P2 = 3 and P3 = 8.

FCFS order (P1, P2, P3):

| P1 | P2 | P3 |
0    5    8    16

Waiting times: P1 = 0, P2 = 5, P3 = 8. Average = 13 / 3 = 4.33.

SJF order (P2, P1, P3):

| P2 | P1 | P3 |
0    3    8    16

Waiting times: P2 = 0, P1 = 3, P3 = 8. Average = 11 / 3 = 3.67.

30-second answer: Running the short job first lowers the average waiting time. That is why SJF is optimal for average waiting time when all jobs are known in advance.

Q14. Solve: Round Robin with a time slice of 4

Same processes: P1 = 5, P2 = 3, P3 = 8, all arriving at 0.

| P1 | P2 | P3 | P1 | P3 |
0    4    7    11   12   16

Completion times: P1 = 12, P2 = 7, P3 = 16. Waiting time = completion time minus burst time (arrival is 0). P1 = 7, P2 = 4, P3 = 8. Average = 19 / 3 = 6.33.

30-second answer: Round Robin gave a higher average waiting time here, but every process got the CPU quickly. That quick first response is why it suits interactive systems.

Q15. What are starvation and aging?

30-second answer: Starvation is when a process waits for a very long time because others keep getting chosen first, as can happen with low priority in priority scheduling. Aging slowly raises the priority of a process the longer it waits, so it eventually runs.

Synchronisation and deadlock questions

Q16. What is a race condition and a critical section?

30-second answer: A race condition happens when two threads use shared data at the same time and the result depends on timing. The critical section is the part of the code that uses the shared data. Only one thread should be inside it at a time.

Example: two threads both read a balance of 100, both add 50 and both write 150. The correct result was 200.

Q17. What is the difference between a mutex and a semaphore?

30-second answer: A mutex is a lock that only one thread can hold, and the thread that locks it should unlock it. A semaphore is a counter. A counting semaphore lets up to N threads in at once, and a binary semaphore allows one.

Use a mutex to protect shared data. Use a counting semaphore to limit access to a pool, such as five database connections.

Q18. What is a deadlock, and what are its four conditions?

30-second answer: A deadlock is when a group of processes wait for each other forever, because each holds a resource another one needs. All four of these conditions must hold at the same time:

Condition Meaning
Mutual exclusion A resource can be used by only one process at a time
Hold and wait A process holds one resource while waiting for another
No preemption A resource cannot be taken away by force
Circular wait P1 waits for P2, P2 waits for P1 (or a longer cycle)

The deadlock lesson in Java shows the same idea in code.

Q19. How can deadlocks be handled?

30-second answer: There are four approaches. Prevention breaks one of the four conditions, for example by always taking locks in the same order. Avoidance checks each request and grants it only if the system stays in a safe state, as in the Banker's algorithm. Detection and recovery lets deadlock happen, finds it and then ends or rolls back a process. Ignoring it is also used by general-purpose systems when deadlocks are rare.

Q20. What is the difference between deadlock and starvation?

30-second answer: In deadlock, the processes are stuck and none of them can ever move without outside help. In starvation, the system keeps running, but one process keeps getting skipped. Aging fixes starvation, but not deadlock.

Memory management questions

Q21. What is paging?

30-second answer: Paging splits a process's logical memory into fixed-size pages and physical memory into frames of the same size. A page table maps each page to a frame. Pages do not need to sit next to each other in RAM, which removes external fragmentation.

Q22. What are internal and external fragmentation?

30-second answer: Internal fragmentation is wasted space inside an allocated block, such as the unused part of the last page. External fragmentation is free memory split into small gaps, so a large request fails even though the total free space is enough.

Paging avoids external fragmentation but can have internal fragmentation. Variable-sized allocation has the opposite problem.

Q23. What is virtual memory, and what is a page fault?

30-second answer: Virtual memory lets a process use more memory than the physical RAM by keeping some pages on disk. Only the pages in use need to be in RAM. A page fault happens when a process uses a page that is not in RAM. The OS then loads it from disk, which is slow compared with a RAM access.

Q24. What are the common page replacement algorithms?

Algorithm Removes
FIFO The page loaded earliest
LRU The page not used for the longest time
Optimal The page that will not be used for the longest time in future

30-second answer: Optimal is the best but needs the future, so it is used only to compare others. LRU is a good practical choice. FIFO is simple but can show Belady's anomaly, where adding more frames causes more page faults.

Q25. What is thrashing?

30-second answer: Thrashing happens when the system spends more time moving pages between RAM and disk than running programs. It occurs when too many processes are active and none has enough frames. The fix is to run fewer processes at once or give each one enough memory for the pages it is actively using.

Quick revision table

Topic One line to remember
Process vs thread Separate memory vs shared memory
Context switch Save one state, load another
SJF Lowest average waiting time
Round Robin Fair turns with a time slice
Deadlock Four conditions, all needed
Mutex vs semaphore Lock vs counter
Paging Fixed pages, no external fragmentation
Thrashing Too much paging, little work

How to prepare for OS questions

Spend one day each on processes and threads, scheduling, synchronisation and deadlock, and memory. Solve three scheduling numericals by hand. Then explain each topic aloud in one minute.

Practise the same way for the other core subjects. Use computer networks interview questions next, then DBMS interview questions. Knowing a few Linux commands such as ps and top helps you show processes during a live demo.

Frequently Asked Questions

Which OS topics are asked most in fresher interviews?
Process vs thread, process states, CPU scheduling, deadlock and its four conditions, mutex vs semaphore, paging and virtual memory. These come up in viva, written tests and the core subject part of technical rounds.
Do I need to solve scheduling problems in an interview?
Sometimes. Written tests often ask for average waiting time under FCFS, SJF or Round Robin. Practise drawing a Gantt chart and computing waiting time as start time minus arrival time, or completion time minus arrival time minus burst time.
Is OS asked for software testing and support roles too?
Core subject questions are common in campus rounds for most fresher IT roles, including testing and support. The depth is usually lower than for developer or systems roles, but process, thread and deadlock basics are expected.
Which book or source should I use to revise OS?
Your university textbook is enough for interviews. Operating System Concepts by Silberschatz, Galvin and Gagne is the standard reference used in many Indian universities. Revise from your own short notes the week before.
How do I connect OS answers to real experience?
Use your laptop. Task Manager or the top command shows processes, threads, CPU and memory use. Saying you watched a program's memory grow, or saw many threads in a browser process, makes an answer concrete.
Siva Prasad Galaba
Founder, CodeBegun · Staff Engineer

Founder of CodeBegun. 15+ years building Java systems at companies like Crunchyroll. Teaches Java, Spring Boot and system design the way the industry actually works, and mentors students through projects, mock interviews and placement preparation.

Technically reviewed by CodeBegun Technical TeamLast reviewed 4 December 2026 LinkedIn
Chat with us