Operating Systems – Most frequently asked questions

operating systems

In this article we have listed questions ans answers from Operating Systems which are most frequently asked in technical round. These questions not only will help in interview but will also help in GATE exam.

Short Answer Questions:

Q: What is a deadlock?
A: 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).

Q: What are the necessary conditions for deadlock?
A: Mutual Exclusion: There is s resource that cannot be shared.
Hold and Wait: A process is holding at least one resource and waiting for another resource which is with some other process.
No Preemption: The operating system is not allowed to take a resource back from a process until process gives it back.
Circular Wait: A set of processes are waiting for each other in circular form.

Q: What is a process?
A: A process is an instance of program in execution. For example a Web Browser is a process, a shell (or command prompt) is a process.

Q: What is a Thread?
A: A thread is a single sequence stream within in a process. Because threads have some of the properties of processes, they are sometimes called lightweight processes.

Q: What is Virtual Memory?
A: Virtual memory creates an illusion that each user has one or more contiguous address spaces, each beginning at address zero. The sizes of such virtual address spaces is generally very high.

Q: What is a page fault?
A: In operating systems a page fault is a type of interrupt, raised by the hardware when a running program accesses a memory page that is mapped into the virtual address space, but not loaded in physical memory.

Q: Name some page replacement algorithms.
A: First In First Out (FIFO), Best Fit, Least recently used.

Long Answer Questions:

Q: What is Thrashing?
A: 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.

Q: Why do we need scheduling?
A: A typical process involves both I/O time and CPU time. In uni-programming operating systems like MS-DOS, time spent waiting for I/O is wasted and CPU is free during this time. In multi-programming operating systems, one process can use CPU while another is waiting for I/O. This is possible only with process scheduling.

Q: What are objectives of scheduling?
A: Objectives of process scheduling are listed below:
– Max CPU utilization [Keep CPU as busy as possible]
– Fair allocation of CPU.
– Max throughput [Number of processes that complete their execution per time unit]
– Min turnaround time [Time taken by a process to finish execution]
– Min waiting time [Time a process waits in ready queue]
– Min response time [Time when a process produces first response]

Q: What are different scheduling algorithms?
A: Different Scheduling Algorithms
First Come First Serve (FCFS): Simplest scheduling algorithm that schedules according to arrival times of processes.
Shortest Job First(SJF): Process which have the shortest burst time are scheduled first.
Shortest Remaining Time First(SRTF): It is preemptive mode of SJF algorithm in which jobs are schedule according to shortest remaining time.
Round Robin Scheduling: Each process is assigned a fixed time in cyclic way.
Priority Based scheduling (Non Preemptive): In this scheduling, processes are scheduled according to their priorities, i.e., highest priority process is schedule first. If priorities of two processes match, then schedule according to arrival time.
Highest Response Ratio Next (HRRN): In this scheduling, processes with highest response ratio is scheduled. This algorithm avoids starvation.

Multilevel Queue Scheduling: According to the priority of process, processes are placed in the different queues. Generally high priority process are placed in the top level queue. Only after completion of processes from top level queue, lower level queued processes are scheduled.
Multi level Feedback Queue Scheduling: It allows the process to move in between queues. The idea is to separate processes according to the characteristics of their CPU bursts. If a process uses too much CPU time, it is moved to a lower-priority queue.

Q: What do you know about semaphores?
A: Semaphores are synchronization tools. A semaphore is an integer variable that is accessed only through two atomic operations, wait () and signal (). An atomic operation is executed in a single CPU time slice without any pre-emption.
Semaphores are of two types:
Counting Semaphore: A counting semaphore is an integer variable whose value can range over an unrestricted domain.
Mutex: Binary Semaphores are called Mutex. These can have only two values, 0 or 1. The operations wait () and signal () operate on these in a similar fashion.


Read more about this subject at NPTEL site.

Read all technical subject’s most frequently asked questions here.

Recommended books for every B.tech student.

You may be interested in :

Sharing is caring:

Leave a Reply

Your email address will not be published. Required fields are marked *