Operating System Interview Questions for Freshers: 25 With Answers
25 fresher-level operating system interview questions with complete answers, a scheduling comparison, a topic-weighting table and a 7-day plan.
Last updated: 13 October 2026 · By the Asuraa Team
Quick answer: The operating system interview questions freshers face most cover process vs thread, process states, fork(), context switching, CPU scheduling (FCFS, SJF, Round Robin), mutex vs semaphore, deadlock conditions, paging, virtual memory and thrashing. Be precise: Microsoft's documentation explains that threads share their process's address space but keep their own registers and stack. Answer with a definition, a reason and an example.
Key takeaways
- Fresher OS interviews concentrate on processes and threads, CPU scheduling, synchronization and deadlocks, and memory management.
- Microsoft's documentation states that all threads of a process share its virtual address space and system resources, while each thread keeps its own registers, stack and scheduling priority.
- The Linux fork(2) man page states that fork returns the child's PID to the parent, 0 to the child and -1 on failure, and the child starts with only the calling thread.
- The Linux sched(7) man page gives real-time priorities from 1 to 99 and nice values from -20 (highest priority) to +19 (lowest).
- A deadlock needs all four Coffman conditions at once, so breaking any one, such as circular wait through consistent lock ordering, prevents it.
Operating system interviews for freshers cover five areas: OS basics, processes and threads, CPU scheduling, synchronization and deadlocks, and memory management. The 25 questions below follow that order, each with a complete answer you can give in about a minute. Where a fact depends on a real system, the answer cites the Linux man pages or Microsoft's Windows documentation rather than a textbook summary.
Which OS topics carry the most weight in fresher interviews?
Processes vs threads, deadlocks and memory management (paging and virtual memory) carry the most weight, because they appear in nearly every core-subject round.
| Area | Typical questions | What interviewers check |
|---|---|---|
| Basics | Kernel, system calls, user vs kernel mode | Whether you know what the OS actually does |
| Processes and threads | Process vs thread, fork, context switch | Precise vocabulary and examples |
| Scheduling | FCFS, SJF, Round Robin, starvation | Ability to compare algorithms and compute waiting time |
| Synchronization | Mutex vs semaphore, deadlock conditions | Reasoning about concurrency bugs |
| Memory | Paging, virtual memory, page replacement, thrashing | Understanding of how programs use RAM |
For related core subjects, see the interview questions by subject guide, along with DBMS interview questions for freshers and computer networks interview questions for freshers, which are usually asked in the same round.
What are the basic operating system questions?
1. What is an operating system and what are its main functions?
An operating system is system software that manages hardware and provides services to programs. Its main functions are process management, memory management, file system management, device (I/O) management, and security and access control. It also gives users an interface, either a command line or a graphical shell. Examples are Linux, Windows, macOS and Android.
2. What is the kernel, and what are user mode and kernel mode?
The kernel is the core of the OS that runs with full hardware privileges and handles scheduling, memory and devices. Applications run in user mode with restricted privileges, so a buggy app cannot crash the whole machine. When a program needs a privileged service, such as reading a file, it makes a system call, which switches the CPU into kernel mode, runs the kernel code and returns.
3. What is a system call? Give examples.
A system call is the controlled entry point a program uses to request a service from the kernel. On Linux, fork() creates a process, execve() runs a new program, open(), read() and write() handle files, and exit() ends a process. Library functions like printf eventually call system calls such as write.
4. What is the difference between a monolithic kernel and a microkernel?
A monolithic kernel runs most OS services (file systems, drivers, networking) inside kernel space, which is fast because components call each other directly; Linux is the common example. A microkernel keeps only minimal services in the kernel and runs the rest as user-space servers communicating by messages, which improves isolation but adds messaging overhead. Many real systems are hybrids.
What process and thread questions are asked?
5. What is the difference between a program and a process?
A program is a passive file of instructions on disk. A process is a program in execution, with its own memory, open files, registers and state. Running the same program twice creates two separate processes.
6. What are the process states, and what is a PCB?
A process typically moves through new, ready, running, waiting (blocked) and terminated states. The scheduler moves it from ready to running; an I/O request moves it to waiting; I/O completion moves it back to ready. The Process Control Block (PCB) is the kernel's record for each process, holding its ID, state, program counter, registers, memory information and open files.
7. What is the difference between a process and a thread?
A process provides the resources to run a program, including a virtual address space, handles and a security context, and starts with one thread. A thread is the unit the scheduler actually runs. Microsoft's processes and threads documentation explains that all threads of a process share its virtual address space and system resources, while each thread keeps its own registers, stack and scheduling priority. Threads are cheaper to create and switch, but a bug in one can corrupt shared memory for all.
8. What does fork() do?
fork() creates a child process by duplicating the calling process. According to the Linux fork(2) man page, it returns the child's PID to the parent, 0 to the child and -1 on failure. The child gets its own copy of memory using copy-on-write, so pages are copied only when one side writes, and the child starts with only one thread, the one that called fork().
pid_t pid = fork();
if (pid == 0) printf("child\n");
else if (pid > 0) printf("parent of %d\n", pid);
9. What is a context switch?
A context switch is the kernel saving the state of the running process or thread (registers, program counter, stack pointer) and loading the saved state of the next one. It happens on timer interrupts, blocking I/O or higher-priority work arriving. It is pure overhead because no useful work happens during the switch, which is why too many threads can slow a system down.
10. What are zombie and orphan processes?
A zombie is a child that has finished but whose parent has not yet read its exit status with wait(), so its process table entry remains. An orphan is a child whose parent exited first; on Linux it is adopted by init (or a designated subreaper), which later reaps it. Many zombies indicate a parent that never calls wait().
11. What are the ways processes communicate (IPC)?
Common inter-process communication methods are pipes, named pipes (FIFOs), message queues, shared memory, sockets and signals. Shared memory is fastest because data is not copied through the kernel, but it needs synchronization such as semaphores. Sockets work across machines, which is why most network services use them.
What CPU scheduling questions come up?
12. What is the difference between preemptive and non-preemptive scheduling?
In preemptive scheduling, the OS can take the CPU away from a running process, for example when its time slice ends or a higher-priority process arrives. In non-preemptive scheduling, a process keeps the CPU until it finishes or blocks. Preemptive scheduling gives better responsiveness for interactive systems, at the cost of more context switches.
13. Compare FCFS, SJF, Round Robin and priority scheduling.
FCFS (first come, first served) is simple but suffers the convoy effect when a long job delays short ones. SJF (shortest job first) minimises average waiting time but needs burst-time estimates and can starve long jobs. Round Robin gives each process a fixed time quantum in turn, which suits time-sharing; too small a quantum causes excessive context switches. Priority scheduling runs the highest-priority process first and can starve low-priority ones.
| Algorithm | Preemptive? | Strength | Weakness |
|---|---|---|---|
| FCFS | No | Simple, fair by arrival | Convoy effect |
| SJF / SRTF | Either | Lowest average waiting time | Starvation, needs estimates |
| Round Robin | Yes | Good response time | Quantum choice matters |
| Priority | Either | Important work first | Starvation without aging |
14. What is starvation, and how does aging fix it?
Starvation happens when a process waits indefinitely because others keep getting priority. Aging gradually raises the priority of processes that have waited a long time, so they eventually run. Starvation differs from deadlock: a starving process could run, it just never gets chosen.
15. How does Linux schedule processes?
The Linux sched(7) man page describes normal policies (SCHED_OTHER, SCHED_BATCH, SCHED_IDLE) and real-time policies (SCHED_FIFO and SCHED_RR). Real-time priorities range from 1 to 99 and always preempt normal threads, and nice values for normal threads run from -20 (highest priority) to +19 (lowest). SCHED_RR adds a time quantum to SCHED_FIFO, which has no time slicing.
What synchronization and deadlock questions are asked?
16. What is a race condition and a critical section?
A race condition occurs when the result depends on the timing of threads accessing shared data, such as two threads incrementing the same counter and losing an update. A critical section is the code that accesses that shared data. A correct solution provides mutual exclusion, progress and bounded waiting.
17. What is the difference between a mutex and a semaphore?
A mutex is a lock with ownership: only the thread that locked it should unlock it, and it lets one thread into a critical section at a time. A semaphore is an integer counter with wait (P) and signal (V) operations; a counting semaphore can allow up to N threads, such as N database connections, and a binary semaphore allows one. Semaphores are also used for signalling between threads, which mutexes are not designed for.
18. What is a deadlock, and what are its four necessary conditions?
A deadlock is a set of processes each waiting for a resource held by another, so none can proceed. The four Coffman conditions are mutual exclusion, hold and wait, no preemption and circular wait; all four must hold at once. Breaking any one prevents deadlock, for example by always acquiring locks in a fixed order to remove circular wait.
19. How are deadlocks handled, and what is the Banker's algorithm?
There are four strategies: prevention (break a Coffman condition), avoidance (grant requests only if the system stays in a safe state), detection and recovery (find cycles and kill or roll back a process), and ignoring the problem, which many general-purpose OSs do for user programs. The Banker's algorithm is an avoidance method: before granting a request, it checks whether some order exists in which every process can still finish with the available resources.
What memory management questions should freshers prepare?
20. What is the difference between paging and segmentation?
Paging divides memory into fixed-size pages and frames, mapped through a page table, which eliminates external fragmentation. Segmentation divides a program into variable-size logical segments such as code, data and stack, which matches how programmers think but can cause external fragmentation. Many systems combine both ideas.
21. What is virtual memory, and what is a page fault?
Virtual memory gives each process its own large address space, mapped to physical RAM and backed by disk, so programs can be larger than RAM and are isolated from each other. A page fault occurs when a process accesses a page that is not currently in RAM; the OS loads it from disk, updates the page table and resumes the process. Frequent page faults slow the system sharply because disk is far slower than RAM.
22. What are the page replacement algorithms, and what is Belady's anomaly?
When RAM is full, the OS must evict a page. FIFO evicts the oldest page, LRU evicts the least recently used page, and Optimal evicts the page used furthest in the future, which is ideal but impossible in practice and serves as a benchmark. Belady's anomaly is when FIFO produces more page faults after adding frames; LRU and Optimal do not show it.
23. What is thrashing?
Thrashing is when a system spends more time swapping pages in and out than running processes, usually because too many processes compete for too little RAM. CPU utilisation drops, which can wrongly prompt the scheduler to admit even more processes. The fixes are reducing the number of active processes, adding memory or using working-set based allocation.
24. What is the difference between internal and external fragmentation?
Internal fragmentation is wasted space inside an allocated block, such as a 4 KB page holding only 1 KB of data. External fragmentation is free memory split into small non-contiguous gaps, so a large request fails even though total free memory is enough. Paging removes external fragmentation but can cause internal fragmentation; compaction addresses external fragmentation.
25. What happens when you switch on a computer?
The firmware (BIOS or UEFI) runs a power-on self-test, then finds a boot device and loads the bootloader, such as GRUB. The bootloader loads the kernel into memory, the kernel initialises hardware and memory management and mounts the root file system, and finally it starts the first user-space process, which launches system services and the login screen.
How should you revise operating systems in 7 days before the interview?
Revise one area per day, and practise on a real Linux shell so terms like process, signal and permission become concrete. The technical interview preparation guide explains how to answer theory questions crisply.
- Day 1: Basics. OS functions, kernel, user vs kernel mode, system calls, kernel types.
- Day 2: Processes and threads. States, PCB, process vs thread, fork, zombie and orphan. Run
psandtopon Linux. - Day 3: Scheduling. Solve four Gantt-chart problems for FCFS, SJF, Round Robin and priority, computing waiting and turnaround times.
- Day 4: Synchronization. Race conditions, mutex vs semaphore, producer-consumer problem.
- Day 5: Deadlocks. Coffman conditions, prevention vs avoidance, one Banker's algorithm safe-state problem.
- Day 6: Memory. Paging, virtual memory, page faults, page replacement with a FIFO vs LRU example, thrashing.
- Day 7: Mock round. Answer all 25 questions aloud and explain any OS concept your projects relied on, such as threads in a server.
To build practical command-line skills alongside theory, see Linux skills for IT jobs.
What do most guides on operating system interview questions get wrong?
Most guides treat OS as pure theory, so candidates can recite the four deadlock conditions but cannot connect them to code. Interviewers increasingly ask "how would you avoid a deadlock in your program?", and the practical answer is consistent lock ordering. Guides also say "threads share everything", which is wrong: Microsoft's documentation shows each thread keeps its own registers, stack and priority while sharing the address space. Finally, many explain fork() as copying all memory immediately; the Linux man page describes copy-on-write, which is why fork() is cheap.
Related guides
- Interview Questions by Subject: Java, Python, SQL, DSA, Cloud, AI
- OOPs Interview Questions for Freshers: 25 Questions With Code Examples
- Computer Networks Interview Questions for Freshers: 25 With Answers
- DBMS Interview Questions for Freshers: 25 Questions With Answers
FAQ
What are the most important OS topics for a fresher interview?
Focus on process vs thread, process states and the PCB, fork and context switching, CPU scheduling algorithms with waiting-time calculations, mutex vs semaphore, the four deadlock conditions and how to prevent them, paging, virtual memory, page replacement algorithms and thrashing. Practise at least one Gantt-chart scheduling problem by hand.
What is the simplest way to explain process vs thread?
A process is a running program with its own memory and resources; a thread is a unit of execution inside a process. Threads of the same process share memory and open resources, so they communicate easily but can corrupt shared data, while each thread keeps its own stack and registers. Processes are isolated from each other, which makes them safer but heavier.
What is the difference between deadlock and starvation?
In a deadlock, a set of processes each wait for resources held by another in the set, so none can ever proceed without outside intervention. In starvation, a process could run but is repeatedly passed over, for example by a priority scheduler. Aging fixes starvation, while deadlocks need prevention, avoidance or detection and recovery.
Do I need Linux knowledge for OS interview questions?
It helps a lot. Commands like ps, top, kill and chmod make processes, signals and permissions concrete, and many interviewers ask about fork or Linux scheduling. You do not need kernel programming experience, but being able to show a process list or explain what happens when you run a command makes theory answers stronger.
How do I calculate waiting time in Round Robin scheduling?
Draw a Gantt chart giving each process the time quantum in turn until all finish. For each process, turnaround time is completion time minus arrival time, and waiting time is turnaround time minus burst time. Average the waiting times across processes. Interviewers mainly check that your chart is correct and that you handle arrival times properly.
Final thoughts
OS rounds reward freshers who can connect theory to what a real system does, such as why fork is cheap or how lock ordering prevents deadlocks. Work through the scheduling and page-replacement problems by hand, and use a Linux shell to make process concepts concrete. When you are ready, browse software and IT support roles on Asuraa jobs.
Related articles
Remote Software Engineering Internships in India: Where to Look
Where remote SDE internships in India really come from, what they pay, which open-source programmes count, and a 4-week plan to get shortlisted.
Remote Data Science Internships for Freshers: How to Find Real Ones
Real remote data science internships come from startups, consultancies and open-source programmes. Here is where to find them, what they pay and how to prepare in 4 weeks.
Interview Questions by Subject: Java, Python, SQL, DSA, Cloud, AI
Every interview question set in one place, organised by subject and role: core CS, programming languages, web and testing, data and analytics, AI and ML, cloud, DevOps and HR rounds.
Projects and Portfolio Guide for Freshers: Data, Software and AI
Choose the right projects for data analyst, data scientist, ML, web and software roles, build them on real public data or APIs, and present them so recruiters notice.