LogoLogo

Operating System INTERVIEW QUESTIONS

Prasun Das| October 24, 2022 at 10:02 AM | 11 minutes Read

Operating Systems is one of the core subjects for a computer science student. As such a lot of important questions are asked on this subject in interviews. Let’s take a look at some of the most important questions on OS for interviews.


If you want to learn about OS before going through its interview questions here is a resource for you: Operating System Cheatsheet



1. What do you understand about operating systems? Give 10 examples of OS.

Ans: An operating system is a software that helps the users to interact with the computer’s hardware while simultaneously acting as the interface between the user and the hardware. Without the OS, the computer system would just be another dumb hardware machine. The OS deals with all other application programs in the PC and makes things easier for the user.


Examples: Microsoft Windows, Mac OS, Ubuntu, Fedora, Linux, Solaris, Debian, CentOS, Free BSD, Chrome OS.


2. State some basic functions of the OS?

Ans: 


  • To enable users to run applications.
  • For memory management.
  • For the operation of all hardware and software coherently.
  • For resource utilisation and resource allocation.
  • For other essential purposes like device management, file management, etc.
  • For managing and scheduling processes.


3. State the different types of OS.

Ans: 


  • Single process OS.
  • Batch processing OS.
  • Multiprogramming OS.
  • Multiprocessing OS.
  • Distributed OS.
  • Real time OS.


4. What are the advantages of a multiprocessing operating system?

Ans: 


  • Enhanced performance in systems which are dealing with multiple programs simultaneously.
  • Completes a larger number of tasks in unit time period.
  • Improves the reliability of the computer system.
  • Enables hardware sharing among CPUs.
  • Higher throughput and responsiveness.


5. What is kernel? 

Ans: Kernel is basically the core component of an OS which acts as the bridge between the applications and the data processing being done at hardware level. Kernel is the interface between the hardware and the applications.


6. Differentiate between Kernel and OS.

Ans: 




7. Differentiate between microkernel and monolithic kernel.

Ans: 



8. What is Thrashing?

Ans: Thrashing is the situation when the performance of the computer system collapses. This occurs when the system spends more time processing page faults than executing transactions. Thrashing inhibits the majority of the application-level processing that eventually causes computer performance to degrade.


9. What is a Thread?

Ans: A thread can be described as a flow of execution through the process code, with its own program counter that keeps track of which instruction to execute next. Threads allow the utilisation of multiprocessing architectures and provide concurrency within a process. A thread can be classified into -

User level threads,

Kernel level threads.


10. How can we handle thrashing?

Ans: We can handle thrashing by -


  • Working Set Model :

Working set model is based on the concept of Locality Model. It refers to a set of pages in a recent T time. The pages that have completed their T amount of time in the working set are then automatically dropped from it. Thus the accuracy depends on the value of T chosen. It is efficient in avoiding thrashing and in keeping the degree of multiprogramming as high as possible.

 


  • Page Fault Frequency:

It is known that in thrashing there are fewer frames, and in the opposite situation(when it is not thrashing) it implies there is an excess of frames, based on this data an upper and lower bound is assigned for the desired page fault rate. Then, according to the page fault rate we allocate and remove pages. If the page fault rate is more than the upper bound; several pages are allocated to the system. Similarly if the number of pages is lower than the lower bound then pages are removed, the suspended process is restarted later on. By implementing this technique we can handle thrashing.



11. Difference between a process and a thread.

Ans:


12. When does a page fault occur?

Ans: A page fault occurs when a program tries to access a code or data that is in its address space but absent in the system RAM.


13. What is a deadlock?

Ans: A Deadlock is a typical situation where each of the computer processes waits for a resource which is being assigned to some other process. In this situation, none of the processes gets executed as the resource it requires is being held by some other process which is also waiting for some other resource to be released.


14. Is it possible to have a deadlock involving only a single process?

Ans: No it isn’t possible.

A deadlock situation occurs when all the four conditions hold simultaneously in the system -


  • Mutual exclusion
  • Hold and wait
  • No preemption
  • Circular wait

It is impossible to have a circular wait condition with only a single process. This implies that we can’t have a deadlock involving only a single process.


15. What is starvation?

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


16. What is aging in OS?

Ans: Aging is a technique that is used to overcome the problem of starvation. It simply increases the priority of processes that wait in the system for resources for a long period of time. Aging ensures that low-level processes complete their execution.


17. What are semaphores? List some of their advantages.

Ans: A semaphore is a mechanism used to implement the synchronisation of tasks. They always hold a non negative integer variable value.

Advantages:


  • They are machine independent in nature.
  • They are easy to implement.
  • They do not waste any resources.
  • They can have multiple critical sections with different semaphores.


18. What is Banker’s algorithm?

Ans: Banker’s algorithm is used for avoiding a deadlock situation. Just like a bank never allocates available cash in an incoherent manner such that it fails to satisfy customer demands, this algorithm allocates resource in a manner to avoid possible deadlocks.


19. What is a Zombie Process?

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


20. What is memory management?

Ans: Memory Management is the most common way of controlling and organising PC memory, appointing segments known as blocks to different running projects to advance the general execution of the framework. It assists processes with moving back and forward between the primary memory and execution circle. It assists the OS with monitoring each memory area, irrespective of whether it is distributed to some interaction or it stays free.


21. What is paging?

Ans:  Paging is generally a memory management technique that allows the 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. 


22. Differentiate between segmentation and paging.

Ans:


23. What is turn around time?

Ans: Turn around time is basically the interval between the submission of a job and its completion.


24. What is response time?

Ans: Response time is the time interval between the submission of request and the first response to that particular request.


25. State the differences between multiprocessing and multitasking in OS.

Ans: 


26. What is a scheduling algorithm?

Ans: Scheduling algorithms are those algorithms which schedule processes on the processor in an efficient manner. They actually help in maximizing the CPU output by increasing thoroughput.


27. What do you understand about Belady's Anomaly?

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


28. Differentiate between main and secondary memory.

Ans: 

Examples of main memory: RAM, ROM.

Examples of secondary memory: Hard disk, Magnetic tapes.


29. What are the methods for handling deadlock?

Ans: The three methods for handling deadlocks are -



  1. Deadlock prevention: The idea is to prevent the system from entering the deadlock state.
  2. Deadlock detection and recovery: Let deadlock occur, then do a preemption to handle it after it has occurred.
  3. Ignore the deadlock: If the deadlock is very rare, ignore it altogether - let it happen and reboot the system.


30. What do you understand by the terms “critical section” and “remainder section”?

Ans: Critical section - The portion of the code in the program where the shared variables are accessed and/or updated is known as the critical section.

Remainder section: The remaining part of the program excluding the critical section is termed as the remainder section.


31. What do you understand by spooling?

Ans: Spooling is a process in which the data is temporarily gathered to be used and executed by a device, program or the system. It is generally associated with printing. When different applications send output to the printer at the same time, spooling keeps

these all jobs into a disk file and queues them accordingly for the printer to execute.



32. Explain the three variable partition schemes of memory management.

Ans: The three variable partition schemes are -


  1. First Fit: The arriving process is allotted the first hole of memory in which it can fit completely.
  2. Best Fit: The arriving process is allotted the memory hole in which it fits the best by leaving the minimum memory empty.
  3. Worst Fit: The arriving process is allotted the hole of memory in which it leaves the maximum gap.


33. Write a short note on different types of page replacement algorithms.

Ans: 


  • First In First Out: This is the simplest page replacement algorithm. In this algorithm, the operating system keeps track of all pages in the memory in a queue,wherein the oldest page is in the front of the queue. Whenever a page needs to be replaced, the page in the front of the queue is selected for removal.



  • Optimal Page Replacement: In this algorithm, pages are replaced which have been unused for the longest duration of time in the future. Optimal page replacement is perfect, but not possible in actual practice as an operating system cannot determine each and every future requests. The purpose of Optimal Page replacement is to set up a benchmark so that other replacement algorithms can be analysed against it.



  • Least Recently Used:  Least Recently Used (LRU) algorithm is basically a Greedy algorithm where the page to be replaced is least recently used.


34. Explain different types of disk scheduling algorithms in short.

Ans: 


  • FCFS: FCFS is the simplest of all. In First Come First Serve algorithm, the requests are addressed in the order they arrive in the disk queue.



  •  SSTF: In SSTF (Shortest Seek Time First), the requests having the shortest seek time are given priority in execution. So, the seek time of every request is calculated in advance in a queue and then they are scheduled according to their calculated seek time. Hence, the request near the disk arm will get executed first.



  •  SCAN: In SCAN(elevator algorithm) the disk arm moves into a particular direction and then services the requests coming in its path and after reaching the end of the disk, it reverses its direction and again services the request arriving in its path. This mimics the motion of an elevator thus the name - elevator algorithm.



  • CSCAN: The CSCAN algorithm is a modified version of the SCAN algorithm and deals with the inefficiency of SCAN algorithm.  Like SCAN, C-SCAN moves the head from one end servicing all the requests to the other end- thus servicing requests more uniformly. However, as soon as the head reaches the other end, it immediately returns to the beginning of the disk without servicing any requests on the return trip and subsequently starts servicing again once it reaches the beginning.



  • LOOK: It is similar to the SCAN disk scheduling algorithm except for the difference that the disk arm in spite of going to the end of the disk goes only to the last request to be serviced in front of the head and then immediately reverses its direction from there only. Thereby preventing the extra delay which occurred due to unnecessary traversal to the end of the disk.



  • CLOOK: As LOOK is similar to SCAN algorithm, CLOOK is similar to CSCAN disk scheduling algorithm. In CLOOK, the disk arm in spite of going to the end goes only to the last request to be serviced in front of the head and then from there goes to the other end’s last request. This is the only difference between CLOOK and LOOK. Thus, it can be said that CLOOK also prevents the extra delay which occurred due to unnecessary traversal to the end of the disk.



35. What do you understand about Re-entrancy?

Ans: Often used for multi programmed time sharing systems, Re-entrancy enables multiple users to share a single copy of a program in the same time period. Note that, the program code cannot modify itself and the local data for each user process must be stored separately in these scenarios.


36. What does demand paging specify?

Ans: Demand paging specifies that if an area of memory is not currently being used,it is swapped to the disk to make room for an application's need.


37. What do you mean by a process?

Ans: A Process is basically a program in execution. Unlike the program, a process is said to be an active entity.


38. State the differences between a program and a process.

Ans: 



39. What is the difference between internal commands and external commands?

Ans: 


40. Differentiate between Logical and Physical address space.

Ans: 


41. What is GUI?

Ans: GUI stands for Graphical User Interface. It is a visual representation of communication presented to the user for easy interaction with the machine. The actions in a GUI are performed through direct manipulation of various graphical elements like buttons, icons, windows, etc. Communication in GUI is performed by interacting with these icons rather than the usual text-based or command-based communication.



42. Explain Round Robin scheduling algorithm.

Ans: Round Robin scheduling algorithm can be said to be a preemptive version of the first come first serve scheduling process.  The Algorithm focuses on Time Sharing wherein every process gets executed in a cyclic way. A certain time slice is defined in the system which is called time quantum. Each process present in the ready queue is assigned to the CPU for that time quantum, if the execution of the process is completed during that time then the process will terminate else the process goes back to the ready queue awaiting the next turn to complete its execution. Note that higher the time quantum, higher will be the response time in the system - deciding the perfect time quantum value is extremely difficult.



43. Explain the pros and cons of a command line interface.

Ans: 

Pros- 


  • CLI is generally faster and more efficient if one knows the commands well.
  • CLI requires comparatively less memory for use than other interfaces. For instance, GUI uses more memory than CLI thereby slowing down the computer.
  • CLI can work even without Windows with the help of low resolution monitors as it is a text based interface.
  • CLI can work even with slow processors unlike other user interfaces.


Cons-


  • It is hectic to remember all the commands used in CLI.
  • CLI is not the best choice when it comes to user friendliness; a new user finds it confusing in the initial phase.
  • Most of the commands in the command line interface are not reversed or undone. So one needs to be very careful to use commands. In most cases, the execution of the command is not undone and its execution continues.



44. What is cache memory?

Ans: Cache memory is a high-speed memory, which is small in size but faster than the main memory (RAM). The CPU can access it more quickly than the primary memory. It generally stores the data and programs which are frequently used by the CPU - thereby making them instantly available to the CPU whenever required. In other words, it acts as a buffer between the RAM and CPU thereby speeding the CPU performance.



45. What is context switching?

Ans: Context Switching refers to the storing of the context or state of a process so that it can be reloaded when and where required and the execution is resumed from the earlier point. This is a feature of a multitasking operating system and allows a single CPU to be shared by multiple processes. 

Note: Context Switching is triggered by any of the three -


  • Multitasking.
  • Interrupt handling.
  • User and kernel mode switching.
#os#operating system#interview-questions#interview preparation#fundamental subject#fundamentals to learn
View Count:12.5k
4

Comments

Similar Articles

DSA Cheatsheet Curated list (Leetcode)

If you're looking to prepare for a job in the tech industry, Data Structures and Algorithms (DSA) are essential to master. Practising problems on plat......

Cover image

How to Start with DSA

Each and every programmer needs a strong grasp in DSA to write efficient and optimised codes. However, DSA has a reputation of being one of the most f......

Cover image

Campus Placement Roadmap for Batch 2024

Its that time round the calendar again, but different for you all as for the first time now. You all will be facing the on campus placement season.Wit......

Cover image

Busting myths about web3

WHAT IS WEB3?Web3 is the catch-all term for the vision of an upgraded version of the internet aimed at giving power back to the users. It is truly the......

Cover image

Cognizant previous year QnA and Interview Experience

Cognizant helps organizations remain ahead of the competition by modernizing technology, reinventing processes, and redefining customer experiences. I...

Cover image

Cloud Computing Cheatsheet

Getting started with cloud computing ?The words "cloud" and "web" will be interchangeable. What kind of business operates today without the internet? ...

Cover image

Software Engineering — SOFTWARE MAINTENANCE [Part-4]

SOFTWARE MAINTENANCE:Software Maintenance can be defined as the process of modifying a software product after its delivery. The main purpose of softwa...

Cover image

Software Engineering — Software Process Activities [Part - 3]

A quick summary upto what we did this far  from this series:Software EngineeringSoftware engineering is a discipline of engineering concerned wit...

Cover image

Capgemini Previous Year Questions with Study Materials

Capgemini is a global leader in consulting, digital transformation, technology, and engineering services. In the rapidly evolving world of cloud, digi...

Cover image

MINDTREE Interview Experience and Previous Year Questions Part 2

Technical Round :Candidates who pass the online test will be invited to the technical interview...

Cover image

MINDTREE Interview Experience and Previous Year Questions Part 1

About Mindtree:Mindtree Ltd, located in Bangalore, India, is a prominent Indian multinational information technology and outsourcing company. The&nbsp...

Cover image

TCS NQT Latest Questions and Answers

TCS NQT Interview kicks off with the aptitude test. The test follows the following pattern : TCS uses the TCS-iON software for their online aptit...

Cover image

INTERVIEW TIPS AND TRICKS FOR FRESHERS

Increased competition for fewer jobs in the current economy means that just being right for the role on paper, is not enough on its own anymore. You h...

Cover image

TCS NINJA INTERVIEW EXPERIENCE [2023]

About TCS NinjaTCS administers the NQT to select candidates for a variety of positions (National Qualifier Test). Tens of thousands of people apply fo...

Cover image

Understanding Time Complexity with Interview Examples

Introduction:Understanding time complexity of a function is imperative for every programmer to execute a program in the most efficient manner. Time co...

Cover image

Software Engineering — Software Development lifecycle and software process(Part 2)

 Software MethodologyA software methodology (which is also known as software process) is a set of related development Phases that leads to the pr...

Cover image

TCS Digital Interview Experience [2023]

About TCS DigitalTCS selects applicants for a variety of jobs by conducting the NQT (National Qualifier Test). About 10,000-15,000 job applicants subm...

Cover image

Software Engineering [Part 1] - Introduction

Software Engineering is a subject that requires when you are a software developer as well as when you are in your college preparing for a semester or ...

Cover image

SQL Interview Questions

Are you getting ready for your SQL developer job interview?You've come to the correct place.This tutorial will assist you in brushing up on your SQL s...

Cover image

SQL CHEATSHEET

Introduction: What is SQL?To understand SQL, we must first understand databases and database management systems (DBMS).Data is essentially a collectio...

Cover image

TCS NQT Technical Interview Questions

TCS Recruitment ProcessInterview RoundsInterview round 1:  TCS NQTTCS NQT (National Qualifier T...

Cover image

TCS NQT Aptitude Questions

TCS NQT Aptitude has three sections, namely the Numerical Ability, Verbal Ability, and Reasoning Abi...

Cover image

TCS NQT Interview Experience [2023]

About TCS NQTTCS NQTs, also known as TCS National Qualifier Tests or Tata Consultancy Services Natio...

Cover image

Computer Networking Cheatsheet (Last Minute Notes)

 Networking: Importance in real life!Using a computer for work, as well as for personal use, ha...

Cover image

Database Management System Last Minute Notes [Part - 2]

ER-DiagramWhat are ER Models ?An Entity Relationship Diagram (ERD) is a visual representation of dif...

Cover image

Database Management System Last Minute Notes [Part - 1]

What is actually DBMS?A Database Management System (DBMS) is system software used to manage the orga...

Cover image

Final year Placement Roadmap in India

Nowadays students tend to go more for off campus placements rather than on campus placements.One of ...

Cover image

C Cheatsheet

C CHEATSHEETINTRODUCTION:C programming language was developed by Dennis Ritchie of Bell Labs in 1972...

Cover image

C Interview Questions — 2022

C is a general purpose high-level language most popular amongst coders, it is the most compatible, e...

Cover image

Cognizant GenC Next Interview

What is GenC and GenC Next?GenC stands for Generation Cognizant. It basically means the fresher hiri...

Cover image

C++ STL Cheat Sheet

C++ programming language has templates which basically allows functions and classes to work with gen...

Cover image

C++ CHEAT SHEET

C++ was conceived in the late 1970s to overcome the limitations of C. It  is an extension of th...

Cover image

Python [Advanced] Interview Questions — 2022

Interview Questions are a great source to test your knowledge about any specific field. But remember...

Cover image

Basic Python [Core] Interview Questions for Freshers and Short Sample Answers — 2022

The most popular high-level, multipurpose programming language right now is Python.Python supports p...

Cover image

Python Cheat Sheet - Learn the basics of Python

IntroductionPython is a high-level programming language with dynamic binding and high-level inherent...

Cover image

Basic Java Interview Questions for Freshers and Short Sample Answers — 2022

Interview Questions are a great source to test your knowledge about any specific field. But remember...

Cover image

Java OOP Cheat Sheet — A Quick Guide to Object-Oriented Programming in Java

Object-Oriented Programming or better known as OOPs is one of the major pillars of Java that has lev...

Cover image

Learn Java: Basics to Advanced Concepts [Java Cheatsheet]

Java is a high-level programming language known for its robustness, object-oriented nature, enhanced...

Cover image

A Complete Roadmap for On-Campus Placements

Placements are an important part of engineering life, and while everyone hopes to be placed in a reputable company, only a few are successful. This is primarily due to a...

Cover image