Most Asked Operating System Interview Questions

Operating System Interview Questions and Answers

“Operating System Interview Questions and Answers” is available on this page.

Operating System is commonly known as OS. It is one of the difficult part of Technical study but it is commonly asked during the interviews. So you need to cover this topic very well.

PrepInsta will provide you all the updated information along with Operating System Interview Questions and Answers on this page so go through the page in detailed and don’t miss out any part.

operating system interview questions and answers

Operating System: Introduction

Operating system is one of the most important topic for Placement preparation. It asked in Placement Interviews and also as MCQ questions in various companies.
Operating System is the primary software of the system that manages interaction between the software and hardware system of the computer. Without an operating system, the user and system cannot interact. The operating system acts as an interface between these two. It enables the smooth functioning of the system.

NOTE:  If you are looking for a job then you need to prepare for Operating System 2020 Interview Questions . Here, we have prepared OS Questions with Answers which will help you during the interview.

Commonly Asked Operating System Interview Questions and Answers

Ques 1. What is an operating system?

Ans:The connecting interface between the hardware of the computer and the end user or his actions is called operating system.

Operating system carries out tasks asked to implement by end user, or supporting tasks to provide functionality to end user with the help of computation power and support provided by hardware of the system.

In simple words, Operating System is the primary software of the system that manages interaction between the software and hardware system of the computer.

Examples of popular operating systems are –

  • Windows
  • Mac
  • Linux
  • Android etc

Ques 2. What are its main functions?

Ans: The main functions of an OS are:

a. Process Management
b. Memory Management
c. Input/ Output Management
d. Storage/ File system management

Ques 3. What are the different operating systems?

Ans: There are diff types of Operating System:-

1. Batched operating systems

2. Multi-programmed operating systems

3. Time Sharing operating systems

4. Distributed operating systems

5. Real-time operating systems

6. Clustered System

Ques 4. What do you mean by a process?

Ans: An executing program is known as process. There are two types of processes:

Ques 5. What are the different states of a process?

Ans: A list of different states of process:

Ques 6. What is the difference between process and program?

Ans: A program while running or executing is known as a process.

Key Differences

ProcessProgram
A process is a program in executionA program is a set of instructions
A process is an active/dynamic entityA program is a passive/static entity
A process has a limited life span. It is created when execution starts and terminates when execution is finishedA program has a longer life span. It is stored on the hard disk in the computer.
A process contains memory address which is called address spaceA program requires memory space on disk to store all instructions

Ques 7. What is a boot-strap program?

Ans: A program that makes computer’s operating system start working.

1. A technique or device designed to bring about a desired state by means of its own action. 

2. That part of a computer program that may be used to establish another version of the computer program. 

3. The automatic procedure whereby the basic operating system of a processor is reloaded following a complete shutdown or loss of memory. 

4. A set of instructions that cause additional instructions to be loaded until the complete computer program is in storage. 

5. To initialize a system by means of a bootstrap.

Ques 8. What is the basic difference between pre-emptive and non-pre-emptive scheduling.

Ans: Key Differences

Pre-emptive SchedulingNon- 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.

For more detailed answer visit Preemptive Scheduling vs Non Preemptive Scheduling Page.

Ques 9. What is a deadlock?

Ans: Deadlock refers to the condition when 2 or more processes are waiting for each other to release a resource indefinitely. A process in nature requests a resource first and uses it and finally releases it.

It is a condition where a group of two or more waiting for the resources currently in use by other processes of the same group.

  • In this situation every process is waiting for an event to be triggered by another process of the group.
  • Since no thread can free up the resource a deadlock occurs and the application hangs.

Ques 10. What are the deadlock avoidance algorithms?

Ans:  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:

1. Resource allocation graph algorithm

2. Banker’s algorithm

a. Safety algorithm

b. Resource request algorithm

Ques 11. What is CPU Scheduler?

Ans:

->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.

->Scheduling under 1 and 4 is non-preemptive.

->All other scheduling is preemptive.

Ques 12. What is Dispatcher?

Ans: 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.

Ques 13. Which are the necessary conditions to achieve a deadlock?

Ans: 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 ) ].

Ques 14. How many types of fragmentation occur in Operating System?

Ans: 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.

Ques 15. What is Memory-Management Unit (MMU)?

Ans: 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

Visit Our Operating System Dasboard – Memory Management Page for Detailed Answer.

 

Few Advanced Operating System Interview Questions and Answers

Ques 1. Explain the different sections of a process.

Ans: 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.

Ques 2. What are the different types of scheduling algorithms?

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

Ques 3. What is kernel? What are the difference between user level thread and kernel level thread.

Ans: Kernel is the core and most important part of a computer operating system which provides basic services for all parts of the OS.

The Key differences b/w Kernel Level Thread and User Level Thread are:-

User Level Threads VS Multi-Threaded Model in OS Operating System

Ques 4. What is synchronization? What are the different synchronization mechanisms?

Ans: 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:

Ques 5. What is the use of paging in operating system?

Ans: 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.

Ques 6. What is thrashing?

Ans: In virtual memory system, thrashing is a high page fault scenario. It occurs due to under-allocation of pages required by a process.

  • The system becomes extremely slow due to thrashing leading to poor performance.

Cause of Thrashing:-

  1.  High degree of multiprogramming: -The CPU scheduler sees the decreasing CPU utilization and increases the degree of multiprogramming as a result. The new process tries to get started by taking frames from running processes, causing more page faults and a longer queue for the paging device. As a result, CPU utilization drops even further, and the CPU scheduler tries to increase the degree of multiprogramming even more
  2. Lack of frames:- If  a process has less number of frames then less pages of that process will be able to reside in memory and hence it would result in more frequent swaping. This may lead to thrashing. Hence sufficient amount of frames must be allocated .

Thrashing

Ques 7. What is the Zombie process?

Ans: 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.

Ques 8. When does the Belady’s anomaly occur?

Ans: 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.

Ques 8. When does the Belady’s anomaly occur?

Ans: 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.

Ques 9. What is the basic difference between Segmentation and Paging.

Ans: Key Differences are:-

PagingSegmentation
A page is a physical unit of information.A segment is a logical unit of information.
Frames on main memory are requiredNo frames are required
The page is of the fixed block sizeThe 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 pagingSegment size is decided by the user in segmentation
It does not allow logical partitioning and protection of application componentsIt allows logical partitioning and protection of application components
Paging involves a page table that contains the base address of each pageSegmentation involves the segment table that contains the segment number and offset

For detailed answer visit our Operating System- Difference b/w Segmentation and Paging Page.

Ques 10.What are the different types of Kernel?

Ans: Kernels are basically of two types:

a. 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.


b. 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.

Ques 11. What is Starvation?

Ans: 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.

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

Ans: 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.

Ques 13. What are turn around time and response time?

Ans: 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.

Ques 14. What are the reasons for process suspension?

Ans: Following are the reasons for process suspension:-

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

Ques 15. What are various scheduling queues?

Ans: 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.

IMPORTANT!!

Few Important pages to be checked

Check these pages to know more Technical Questions and prepare well for you Placements.