OS Interview Questions and Answers

Top 50 Most Asked OS Interview Questions

Find the most asked operating system interview questions and answers on this page. Prepare for your interview with PrepInsta.

Page Highlights:

  • What is Operating Systems?
  • Top 50 OS Interview Questions
Important Operating Systems Interview Questions

Introduction to Operating Systems

Operating Systems is the interface between the computer hardware and the user. OS carries out tasks implemented by end users or supporting tasks to provide functionality to end user with the help of computation power and support provided by hardware of the system.

Popular Operating Systems include:- Windows, Mac, Linux, Android

Top 50 Operating System Interview Questions

What is Operating System?

The operating system is a software program that facilitates computer hardware to communicate and operate with the software applications and it acts as an interface between the user and the computer hardware. It is the most important part of a computer system without it computer is just like a box.

What is Deadlock?

Deadlock is a situation when two or more processes wait for each other to finish and none of them ever finish. Consider an example when two trains are coming toward each other on same track and there is only one track, none of the trains can move once they are in front of each other. Similar situation occurs in operating systems when there are two or more processes hold some resources and wait for resources held by other(s).

What is Time-sharing system?

In a Time-sharing system, the CPU executes multiple jobs by switching among them, also known as multitasking. This process happens so fast that users can interact with each program while it is running.

Define Thoroughput.

Throughput – number of processes that complete their execution per time unit. Turnaround time – amount of time to execute a particular process. Waiting time – amount of time a process has been waiting in the ready queue. Response time – amount of time it takes from when a request was submitted until the first response is produced, not output (for time-sharing environment).

What are the functions of operating system?

The operating system controls and coordinates the use of hardware among the different processes and applications. It provides the various functionalities to the users. The following are the main job of operating system.

– Resource utilization
– Resource allocation
– Process management
– Memory management
– File management
– I/O management
– Device management

What Are Real-time Systems?

Real-time systems are used when rigid time requirements have been placed on the operation of a processor. It has well defined and fixed time constraints.

Explain the concept of Reentrancy?

It is a useful, memory-saving technique for multiprogrammed timesharing systems. A Reentrant Procedure is one in which multiple users can share a single copy of a program during the same period. Reentrancy has 2 key aspects: The program code cannot modify itself, and the local data for each user process must be stored separately. Thus, the permanent part is the code, and the temporary part is the pointer back to the calling program and local variables used by that program. Each execution instance is called activation. It executes the code in the permanent part, but has its own copy of local variables/parameters. The temporary part associated with each activation is the activation record. Generally, the activation record is kept on the stack.
Note: A reentrant procedure can be interrupted and called by an interrupting program, and still execute correctly on returning to the procedure.

What is multi-programming, and what are the advantages?

A multiprogramming operating system is one that allows a process where multiple programs execute over one CPU. If your interviewer asks OS questions on multiprogramming, you can highlight key differences between a multiprogramming OS and other systems.

One way to display that you understand the benefits of multi-programming is to use a real-life example. By offering an instance when you used multi-programming to receive such benefits, you are displaying hands-on knowledge of a system that might be important to the interviewer.

What is virtual memory?

Virtual memory is a memory management method that helps to execute the process using the primary and secondary memory. Though the program gets executed using the main memory, the resources and pages load from the secondary memory.

What is Thrashing?

Thrashing is a situation when the performance of a computer degrades or collapses. Thrashing occurs when a system spends more time processing page faults than executing transactions. While processing page faults is necessary to in order to appreciate the benefits of virtual memory, thrashing has a negative affect on the system. As the page fault rate increases, more transactions need processing from the paging device. The queue at the paging device increases, resulting in increased service time for a page fault.

What is the difference between micro kernel and macro kernel?

Micro kernel: micro kernel is the kernel which runs minimal performance affecting services for operating system. In micro kernel operating system all other operations are performed by processor.

Macro Kernel: Macro Kernel is a combination of micro and monolithic kernel.

Enumerate the different RAID levels.

RAID 0 – Non-redundant striping
RAID 1 – Mirrored Disks
RAID 2 – Memory-style error-correcting codes
RAID 3 – Bit-interleaved Parity
RAID 4 – Block-interleaved Parity
RAID 5 – Block-interleaved distributed Parity
RAID 6 – P+Q Redundancy

Is it possible to have a deadlock involving only one process? Explain your answer.

Deadlock with one process is not possible. Here is the explanation. A deadlock situation can arise if the following four conditions hold simultaneously in a system.
  • Mutual Exclusion.
  • Hold and Wait.
  • No Preemption.
  • Circular-wait.
It is not possible to have circular wait with only one process, thus failing a necessary condition for Circular wait. There is no second process to form a circle with the first one. So it is not possible to have a deadlock involving only one process.

How Are Server Systems Classified?

Server systems can be classified as either computer-server systems or file server systems. In the first case, an interface is made available for clients to send requests to perform an action. In the second case, provisions are available for clients to create, access and update files.

List the Coffman’s conditions that lead to a deadlock.

  1. Mutual Exclusion: Only one process may use a critical resource at a time.
  2. Hold & Wait: A process may be allocated some resources while waiting for others.
  3. No Pre-emption: No resource can be forcible removed from a process holding it.
  4. Circular Wait: A closed chain of processes exist such that each process holds at least one resource needed by another process in the chain.

Describe how to boot an operating system.

The word “boot” is short for “bootstrap,” which is the name of the program that prompts the operating system at startup. Booting occurs when you start a computer from the kernel. This usually happens when you start it for the first time. It may also occur when the computer malfunctions and you have to put it in safe mode or reboot it as though it were a new CPU.

Booting an operating system is an essential function that applies to many varied work environments. If you have a workplace with computers, it’s highly likely you will have to boot new and existing computers as an IT professional. The answer to this question offers the interviewer a read on your fundamental skills with regards to operating systems.

What is demanding Paging?

Demanding pages is a concept used by the virtual machine. Only a part of the process needs to be present in the main memory to execute some process, which means that only a few pages will only be present in the main memory at any time, and rest will be kept in the secondary memory.

What is Banker’s algorithm?

Banker’s algorithm is used to avoid deadlock. It is the one of deadlock-avoidance method. It is named as Banker’s algorithm on the banking system where bank never allocates available cash in such a manner that it can no longer satisfy the requirements of all of its customers.

Give an example of a Process State.

  • New State – means a process is being created
  • Running – means instructions are being executed
  • Waiting – means a process is waiting for certain conditions or events to occur
  • Ready – means a process is waiting for an instruction from the main processor
  • Terminate – means a process is stopped abruptly

What is a pipe?

  • A traditional pipe is unnamed and can be used only for the communication of related process. If unrelated processes are required to communicate – named pipes are required.
  • It is a pipe whose access point is a file available on the file system. When this file is opened for reading, a process is granted access to the reading end of the pipe. Similarly, when the file is opened for writing, the process is granted access to writing end of the pipe.
  • A named pipe is also referred to as FIFO or named FIFO.

Explain the main purpose of an operating system?

There are two main purposes of Operating systems :
  • One is that it is designed to make sure a computer system performs well by managing its computational activities.
  • Another is that it provides an environment for the development and execution of programs.

What are the advantages of a multiprocessor system?

With an increased number of processors, there is a considerable increase in throughput. It can also save more money because they can share resources. Finally, overall reliability is increased as well.

What is kernel?

A kernel is the core of every operating system. It connects applications to the actual processing of data. It also manages all communications between software and hardware components to ensure usability and reliability.

What are real-time systems?

Real-time systems are used when rigid time requirements have been placed on the operation of a processor. It has well defined and fixed time constraints.

What do you mean by a process?

 An executing program is known as a process. There are two types of processes:
  • Operating System Processes
  • User Processes

What is time- sharing system?

In a Time-sharing system, the CPU executes multiple jobs by switching among them, also known as multitasking. This process happens so fast that users can interact with each program while it is running.

OS Interview Questions for Experienced

What are the different states of a process?

  • New Process
  • Running Process
  • Waiting Process
  • Ready Process
  • Terminated Process

What is the difference between process and program?

Program is a set of instructions written to complete a task.Process is a program in execution.
Program is a passive/static entity.Process is an active/dynamic entity.
Program resides in secondary memory.A process in execution resides in Primary Memory.
Program has a longer life span.A process has a limited life span.
A program only requires memory space to store itself.Process needs execution time in CPU, I/O requirements, shared resources, files, memory addresses and more.
It has no significant overhead.Has a significant overhead.

What is the basic difference between pre-emptive and non-preemptive scheduling?

Pre-Emptive Scheduling Non Pre-Emptive Scheduling
CPU allocation is for a limited time. CPU allocation until the process is complete.
Execution of the process is interrupted in the middle. Execution of the process remains uninterrupted until it is completed.
The concept bears an overhead of switching between the tasks. No such overhead of switching between the tasks.
If the CPU receives continuous high priority tasks, a process may remain in the waiting state indefinitely. If the CPU is processing a program with the largest burst time, even a program with the smallest burst time may have to starve.
It allows flexibility to the processes which are in the waiting state allowing the high priority tasks to be executed first. This approach is also known as the rigid scheduling as it offers no flexibility to the processes irrespective of their urgency for execution.
Pre emptive scheduling needs to maintain the integrity of the shared data and to ensure no data loss occurs when processes are swapped from the waiting state to the ready state. The Non- pre-emptive Scheduling does not require to maintain data integrity as no processes are swapped from the waiting state to the ready state.

What are the deadlock avoidance algorithms?

A dead lock avoidance algorithm dynamically examines the resource-allocation state to ensure that a circular wait condition can never exist. The resource allocation state is defined by the number of available and allocated resources, and the maximum demand of the process. There are two algorithms:
  • Resource allocation graph algorithm
  • Banker’s algorithm
    • Safety algorithm
    • Resource request algorithm

What is CPU Scheduler?

Selects from among the processes in memory that are ready to execute, and allocates the CPU to one of them. CPU scheduling decisions may take place when a process:

  1. Switches from running to waiting state.
  2. Switches from running to ready state.
  3. Switches from waiting to ready.
  4. Terminates.

What is Dispatcher?

Dispatcher module gives control of the CPU to the process selected by the short-term scheduler; this involves:
  • Switching context
  • Switching to user mode
  • Jumping to the proper location in the user program to restart that program
  • Dispatch latency – time it takes for the dispatcher to stop one process and start another running.

Which are the necessary conditions to achieve a deadlock?

There are 4 necessary conditions to achieve a deadlock:

  • Mutual Exclusion: At least one resource must be held in a non-sharable mode. If any other process requests this resource, then that process must wait for the resource to be released.
  • Hold and Wait: A process must be simultaneously holding at least one resource and waiting for at least one resource that is currently being held by some other process.
  • No preemption: Once a process is holding a resource ( i.e. once its request has been granted ), then that resource cannot be taken away from that process until the process voluntarily releases it.
  • Circular Wait: A set of processes { P0, P1, P2, . . ., PN } must exist such that every P[ i ] is waiting for P[ ( i + 1 ) % ( N + 1 ) ].

How many types of fragmentation occur in Operating System?

There are two types of fragmentation:
  • Internal fragmentation: It is occurred when we deal with the systems that have fixed size allocation units.
  • External fragmentation: It is occurred when we deal with systems that have variable-size allocation units.

What is Memory-Management Unit (MMU)?

Hardware device that maps virtual to physical address. In MMU scheme, the value in the relocation register is added to every address generated by a user process at the time it is sent to memory. The user program deals with logical addresses; it never sees the real physical addresses

Advanced OS Interview Questions

Explain the different sections of a process.

Every process has a process memory, which is generally divided into 4, this is done to make the most efficient functioning as possible –
  • Stack – This houses all the temporary data and local variables like function parameters and addresses.
  • Heap – When the process is in its run time, for dynamic memory allocation, for operations such as new(), delete(), malloc(), etc heap is used for fastest access at the run time.
  • Text – Contains value of Program Counter and the contents of the processor’s registers which just the most low level instructions of the compiled program
  • Data – Has static and global variables.

What are the different types of scheduling algorithms?

This is the advanced OS Interview Questions which is asked in an interview. The different types of scheduling algorithms are as follows:

What are the difference between user level thread and kernel level thread?

User-Level Threads Multi-Threaded Model
User Threads are implemented by users. Kernel Threads are implemented by OS.
OS does not recognize user level threads. Kernel threads are recognized by OS.
Implemetation is easy. Implementation is complicated.
Context switch time is less. Context switch time is more.
Context switch-no hardware support. Hardware support is needed.
If one user level thread perform blocking operation then entire process will be blocked. If one kernel thread perform blocking operation then another thread can continue execution.

What is synchronization? What are the different synchronization mechanisms?

When several threads (or processes) share data, running in parallel on different cores, then changes made by one process may override changes made by another process running parallel. Resulting in inconsistent data. So, this requires processes to be synchronized, handling system resources and processes to avoid such situation is known as Process Synchronization.

Different synchronization mechanisms are:

What is the use of paging in operating system?

Paging is a memory-management scheme that permits the physical address space of a process to be non contiguous or in other words eliminates the need for contiguous allocation of physical memory.

  • That is we can have logically use memory spaces that physically lie at different locations in the memory.
  • This allows viewing memory spaces that physically lie at different locations in the hardware to be logically viewed as contiguous.

What is the Zombie process?

A zombie process is a process that has completed and in the terminated state but has its entry in the process table. It shows that the resources are held by the process and are not free.

When does the Belady’s anomaly occur?

In the Virtual memory system, all the processes are divided into fixed-sized pages. These pages are loaded into the physical memory using the method of demand paging. Under demand paging, during the execution of a particular process, whenever a page is required, a page fault occurs, and then the required page gets loaded into the memory replacing some other page. The page replacement algorithm specifies the choice of the page which is to be replaced. Now, Belady’s Anomaly is said to occur when the number of page faults increases significantly.

What is the basic difference between Segmentation and Paging?

Paging Segmentation
A page is a physical unit of information. A segment is a logical unit of information.
Frames on main memory are required. No frames are required.
No frames are required. The page is of the variable block size
It leads to internal fragmentation It leads to external fragmentation
The page size is decided by hardware in paging Segment size is decided by the user in segmentation
It does not allow logical partitioning and protection of application components It allows logical partitioning and protection of application components
Paging involves a page table that contains the base address of each page Segmentation involves the segment table that contains the segment number and offset

What are the different types of Kernel?

Kernels are basically of two types:

  • Monolithic Kernels In this architecture of kernel, all the system services were packaged into a single system module which lead to poor maintainability and huge size of kernel.
  • Microkernels – They follow the modular approach of architecture. Maintainability became easier with this model as only the concerned module is to be altered and loaded for every function. This model also keeps a tab on the ever growing code size of the kernel.

What is Starvation?

If the CPU gets the processes of the higher burst time at the front end of the ready queue then the processes of lower burst time may get blocked which means they may never get the CPU if the job in the execution has a very high burst time. This is called convoy effect or starvation.

  • In starvation resources are continuously utilized by high priority processes. Problem of starvation can be resolved using Aging.
  • In Aging priority of long waiting processes is gradually increased.

What is a safe state and what is its use of deadlock avoidance?

A state is safe if the system can allocate all resources requested by all processes ( up to their stated maximums ) without entering a deadlock state. System is in safe state if there exists a safe sequence of all processes. Deadlock Avoidance: Ensure that a system will never enter an unsafe state.

What are turn around time and response time?

The basic difference b/w the turn around time and response time is:-

  • Turn around time is the interval between the submission of a job and its completion.
  • Response time is the interval b/w the submission of the request, and the first response to that request.

What are the reasons for process suspension?

  1. Swapping
  2. Interactive User Request
  3. Timing
  4. Parent Process Reques

What are various scheduling queues?

Given below are the scheduling queues:-

  • Job Queue:- When a process enters the system it is placed in the job queue.
  • Ready Queue:- The processes that are residing in the main memory and are ready and waiting to execute are kept on a list called the ready queue.
  • Device Queue:- A list of processes waiting for a particular I/O device is called device queue.

Also Check:

FAQs on Operating System Interview Questions

Question: What are the 5 operating systems?


The 5 most common operating system include:-  Apple macOS, Apple iOS, Microsoft Windows, Google Android and Linux.