Operating System Interview Questions

Delve into the world of operating systems with 'Operating System Interview Questions.' This blog is your indispensable resource for preparing for interviews related to operating systems, featuring a diverse collection of questions and detailed answers. Whether you're a computer scientist, a system administrator, or an OS enthusiast, our guide covers OS fundamentals, process management, memory allocation, and best practices. Prepare with confidence and explore the critical domain of managing computer hardware and software efficiently with operating systems.

1. What is an operating system?

An operating system is a software that acts as an intermediary between computer hardware and the computer user. It provides services to manage resources, execute applications, and ensure efficient system operation.

2. What are the main functions of an operating system?

The main functions of an operating system include process management, memory management, file system management, device management, and security and protection.

3. What's the main purpose of an OS? What are the different types of OS?

The main purpose of an OS is to execute user programs and make it easier for users to understand and interact with computers as well as run applications. It is specially designed to ensure that the computer system performs better by managing all computational activities. It also manages computer memory, processes, and operation of all hardware and software.

Types of OS:

  • Batched OS (Example: Payroll System, Transactions Process, etc.)
  • Multi-Programmed OS (Example: Windows O/S, UNIX O/S, etc.)
  • Timesharing OS (Example: Multics, etc.)
  • Distributed OS (LOCUS, etc.)
  • Real-Time OS (PSOS, VRTX, etc.)

4. What are the benefits of a multiprocessor system?

A Multiprocessor system is a type of system that includes two or more CPUs. It involves the processing of different computer programs at the same time mostly by a computer system with two or more CPUs that are sharing single memory. 


  • Such systems are used widely nowadays to improve performance in systems that are running multiple programs concurrently. 
  • By increasing the number of processors, a greater number of tasks can be completed in unit time. 
  • One also gets a considerable increase in throughput and is cost-effective also as all processors share the same resources.
  • It simply improves the reliability of the computer system.

5. What is GUI?

GUI (Graphical User Interface) is basically a type of user interface that allows users to use graphics to interact with OS. GUI is created because it is more user-friendly, less complex, and easier to understand rather than a command-line interface. Its main goal is to increase efficiency and ease of use. Instead of having to memorize commands, users can just click on a button to simply execute the procedure. Examples of GUI include Microsoft Windows, macOS, Apple’s iOS, etc.

6. What is a Pipe and when it is used?

The pipe is generally a connection among two or more processes that are interrelated to each other. It is a mechanism that is used for inter-process communication using message passing.  One can easily send information such as the output of one program process to another program process using a pipe. It can be used when two processes want to communicate one-way i.e., inter-process communication (IPC).

7. What are the different kinds of operations that are possible on semaphore?

There are basically two atomic operations that are possible:

  • Wait()
  • Signal()

8. Explain demand paging?

Demand paging is a method that loads pages into memory on demand. This method is mostly used in virtual memory. In this, a page is only brought into memory when a location on that particular page is referenced during execution. The following steps are generally followed:

  • Attempt to access the page.
  • If the page is valid (in memory) then continue processing instructions as normal.
  • If a page is invalid then a page-fault trap occurs.
  • Check if the memory reference is a valid reference to a location on secondary memory. If not, the process is terminated (illegal memory access). Otherwise, we have to page in the required page.
  • Schedule disk operation to read the desired page into main memory.
  • Restart the instruction that was interrupted by the operating system trap.

9. What do you mean by process synchronization?

Process synchronization is basically a way to coordinate processes that use shared resources or data. It is very much essential to ensure synchronized execution of cooperating processes so that will maintain data consistency. Its main purpose is to share resources without any interference using mutual exclusion. There are two types of process synchronization:

  • Independent Process
  • Cooperative Process

10. What is IPC? What are the different IPC mechanisms?

IPC (Interprocess Communication) is a mechanism that requires the use of resources like a memory that is shared between processes or threads. With IPC, OS allows different processes to communicate with each other. It is simply used for exchanging data between multiple threads in one or more programs or processes. In this mechanism, different processes can communicate with each other with the approval of the OS.

Different IPC Mechanisms:

  • Pipes
  • Message Queuing
  • Semaphores
  • Socket
  • Shared Memory
  • Signals

11. What is different between main memory and secondary memory.

Main memory: Main memory in a computer is RAM (Random Access Memory). It is also known as primary memory or read-write memory or internal memory. The programs and data that the CPU requires during the execution of a program are stored in this memory.
Secondary memory: Secondary memory in a computer are storage devices that can store data and programs. It is also known as external memory or additional memory or backup memory or auxiliary memory. Such storage devices are capable of storing high-volume data. Storage devices can be hard drives, USB flash drives, CDs, etc. 

Primary Memory Secondary Memory
Data can be directly accessed by the processing unit. Firstly, data is transferred to primary memory and after then routed to the processing unit.
It can be both volatile and non-volatile in nature. It is non-volatile in nature.
It is more costly than secondary memory. It is more cost-effective or less costly than primary memory.
It is temporary because data is stored temporarily. It is permanent because data is stored permanently.
In this memory, data can be lost whenever there is a power failure. In this memory, data is stored permanently and therefore cannot be lost even in case of power failure.
It is much faster than secondary memory and saves data that is currently used by the computer. It is slower as compared to primary memory and saves different kinds of data in different formats.
It can be accessed by data. It can be accessed by I/O channels.

12. What do you mean by overlays in OS?

Overlays is basically a programming method that divides processes into pieces so that instructions that are important and need can be saved in memory. It does not need any type of support from the OS. It can run programs that are bigger in size than physical memory by only keeping only important data and instructions that can be needed at any given time. 

13. Write top 10 examples of OS?

Some of the top OS’s that are used mostly are given below:

  • MS-Windows
  • Ubuntu
  • Mac OS
  • Fedora
  • Solaris
  • Free BSD
  • Chrome OS
  • CentOS
  • Debian
  • Android

14. What do you mean by FCFS?

FCFS (First Come First Serve) is a type of OS scheduling algorithm that executes processes in the same order in which processes arrive. In simple words, the process that arrives first will be executed first. It is non-preemptive in nature. FCFS scheduling may cause the problem of starvation if the burst time of the first process is the longest among all the jobs. Burst time here means the time that is required in milliseconds by the process for its execution. It is also considered the easiest and simplest OS scheduling algorithm as compared to others. Implementation of FCFS is generally managed with help of the FIFO (First In First Out) queue. 

15. What is Reentrancy?

Reentrant is simply a function in which various clients can use and shares a single copy of a program during a similar period. This concept is generally associated with OS code and does not deal with concurrency. It has two major functions:

  • Program code cannot change or modify itself.
  • Local data for every client process needs to be stored in different disks.

16. What is the difference between paging and segmentation?

Paging: It is generally a memory management technique that allows OS to retrieve processes from secondary storage into main memory. It is a non-contiguous allocation technique that divides each process in the form of pages. 
Segmentation: It is generally a memory management technique that divides processes into modules and parts of different sizes. These parts and modules are known as segments that can be allocated to process. 

Paging Segmentation
It is invisible to a programmer. It is visible to a programmer.
In this, the size of pages is fixed. In this, the size of segments is not fixed.
Procedures and data cannot be separated in paging. Procedures and data can be separated in segmentation.
It allows a cumulative total of virtual address spaces to cross physical main memory. It allows all programs, data, and codes to break up into independent address spaces.
It is mostly available on CPUs and MMU chips. It is mostly available on Windows servers that may support backward compatibility, while Linux has limited support.
It is faster for memory access as compared to segmentation. It is slower as compared to paging.
In this, OS needs to maintain a free frame. In this, OS needs to maintain a list of holes in the main memory.
In paging, the type of fragmentation is internal. In segmentation, the type of fragmentation is external.
The size of the page is determined by available memory. The size of the page is determined by the user.

17. What is thrashing in OS?

It is generally a situation where the CPU performs less productive work and more swapping or paging work. It spends more time swapping or paging activities rather than its execution. By evaluating the level of CPU utilization, a system can detect thrashing. It occurs when the process does not have enough pages due to which the page-fault rate is increased. It inhibits much application-level processing that causes computer performance to degrade or collapse. 

18. Explain zombie process?

Zombie process, referred to as a defunct process, is basically a process that is terminated or completed but the whole process control block is not cleaned up from the main memory because it still has an entry in the process table to report to its parent process. It does not consume any of the resources and is dead, but it still exists. It also shows that resources are held by process and are not free.

19. What do you mean by cascading termination?

Cascading termination is a process termination in which if the parent process is exiting or terminating then the children process will also get terminated. It does not allow the child to continue processing as its parent process terminates. It is generally initiated by OS.

20. What is starvation and aging in OS?

When we use Priority Scheduling or Shortest Job First Scheduling, Starvation can happen, This algorithm is mostly used in CPU schedulers

Starvation: It is generally a problem that usually occurs when a process has not been able to get the required resources it needs for progress with its execution for a long period of time. In this condition, low priority processes get blocked and only high priority processes proceed towards completion because of which low priority processes suffer from lack of resources. 

Aging: It is a technique that is used to overcome the situation or problem of starvation. It simply increases the priority of processes that wait in the system for resources for a long period of time. It is considered the best technique to resolve the problem of starvation as it adds an aging factor to the priority of each and every request by various processes for resources. It also ensures that low-level queue jobs or processes complete their execution. 

21. What are different types of Kernel?

There are basically five types of Kernels as given below:

  • Monolithic Kernel
  • MicroKernel
  • Hybrid Kernel 
  • Nano Kernel
  • Exo Kernel

22. What is SMP (Symmetric Multiprocessing)?

SMP is generally referred to as computer architecture in which the processing of programs is done by multiple processors that share a common OS and memory. SMP is very much required if you want to take advantage of multiprocessor hardware. It simply enables any processor to work on any of the tasks no matter where data or resources for that particular task are located in memory. These systems are more reliable than single-processor systems. 

23. What is Context Switching?

Context switching is basically a process of saving the context of one process and loading the context of another process. It is one of the cost-effective and time-saving measures executed by CPU the because it allows multiple processes to share a single CPU. Therefore, it is considered an important part of a modern OS. This technique is used by OS to switch a process from one state to another i.e., from running state to ready state. It also allows a single CPU to handle and control various different processes or threads without even the need for additional resources.

24. What is a deadlock in OS? What are the necessary conditions for a deadlock?

Deadlock is generally a situation where a set of processes are blocked as each process is holding resources and waits to acquire resources held by another process. In this situation, two or more processes simply try to execute simultaneously and wait for each to finish their execution because they are dependent on each other. We can see a hand problem in our system whenever a deadlock occurs in a program. It is one of the common problems you can see in multiprocessing. 

Necessary Conditions for Deadlock

There are basically four necessary conditions for deadlock as given below:

  • Mutual Exclusion
  • Hold and Wait
  • No Pre-emption
  • Circular Wait or Resource Wait

25. What do you mean by Belady’s Anomaly?

In the Operating System, process data is loaded in fixed-sized chunks and each chunk is referred to as a page. The processor loads these pages in the fixed-sized chunks of memory called frames. Belady’s Anomaly is a phenomenon in which if we increase the number of frames in memory, then the number of page faults also increases. It is generally experienced when we use FIFO (First in First out) page replacement algorithm. 

26. Code Snippet: Simple C Program demonstrating Fork in Unix-like OS

#include <stdio.h>
#include <unistd.h>

int main() {
    pid_t pid = fork();

    if (pid == 0) {
        // Child process
        printf("Hello from Child!");
    } else if (pid > 0) {
        // Parent process
        printf("Hello from Parent!");
    } else {
        // Fork failed
        fprintf(stderr, "Fork failed!");
        return 1;

    return 0;

27. Online Resources:

Published On: 2024-01-31