Operating System Interview Question
1) What are the different states of a process?
A list of different states of process:
New Process
Running Process
Waiting Process
Ready Process
Terminated Process
2) What is the concept of reentrancy?
It is a very useful memory saving technique that is used for multi-programmed time sharing
systems. It provides functionality that multiple users can share a single copy of program during the same
period.
It has two key aspects:
o The program code cannot modify itself.
o The local data for each user process must be stored separately.
3) What is the use of paging in operating system?
Paging is used to solve the external fragmentation problem in operating system. This technique
ensures that the data you need is available as quickly as possible.
4) What is FCFS?
FCFS stands for First Come, First Served. It is a type of scheduling algorithm. In this scheme, if a
process requests the CPU first, it is allocated to the CPU first. Its implementation is managed by a FIFO
queue.
5) Which are the necessary conditions to achieve a deadlock?
There are 4 necessary conditions to achieve a deadlock:
o 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.
o 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.
o 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.
o 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 ) ].
6) What is spooling?
Spooling is a process in which data is temporarily gathered to be used and executed by a device,
program or the system. It is 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 to the printer.
7) What is semaphore?
Semaphore is a protected variable or abstract data type that is used to lock the resource being
used. The value of the semaphore indicates the status of a common resource.
There are two types of semaphore:
o Binary semaphores
o Counting semaphores
8) What are the advantages of multithreaded programming?
A list of advantages of multithreaded programming:
o Enhance the responsiveness to the users.
o Resource sharing within the process.
o Economical
o Completely utilize the multiprocessing architecture.
9) What is a System Call in Operating Systems?
Programs can communicate with the operating system by making a system call. When a computer
application requests anything from the kernel of the operating system, it performs a system call. System
call uses Application Programming Interfaces(API)to deliver operating system services to user programs
10) What is Process Control Block (PCB)?
A data structure called a Process Control Block houses details about the processes connected to it. The
term "process control block" can also refer to a "task control block," "process table entry," etc.
As data structure for processes is done in terms of the Process Control Block (PCB), it is crucial for
process management. Additionally, it describes the operating system's present condition.
11) What is Context Switching?
Context switching is a technique or approach that the operating system use to move a process from one
state to another so that it can carry out its intended function using system CPUs.
When a system performs a switch, it maintains the status of the previous operating process in the form of
registers and allots the CPU to the new process to carry out its operations.
The old process must wait in a ready queue while a new one is running in the system. At the point when
another process interrupted it, the old process resumes execution.
It outlines the features of an operating system that supports numerous workloads at once without the use
of extra processors by allowing several processes to share a single CPU.
12) What is a Peterson's Solution?
Peterson's solution to the critical section issue is a traditional one. The critical section problem makes
sure no two processes or job salter or modify the value of a resource at the same time.
13) What are the methods of Handling Deadlocks?
The methods of handling deadlock are:
1. Deadlock Prevention
2. Deadlock Detection and Recovery
3. Deadlock Avoidance
4. Deadlock Ignorance
14) How can we detect and recover the Deadlock occurred in Operating System?
First, what we need to do is to allow the process to enter the deadlock state. So, it is the time of
recovery.
We can recover the process from deadlock state by terminating or aborting all deadlocked processes one
at a time.
Process Pre Emption is also another technique used for Deadlocked Process Recovery.
15) What is paging in Operating Systems?
Paging is a storage mechanism. Paging is used to retrieve processes from secondary memory to primary
memory.
The main memory is divided into small blocks called pages. Now, each of the pages contains the process
which is retrieved into main memory and it is stored in one frame of memory.
It is very important to have pages and frames which are of equal sizes which are very useful for mapping
and complete utilization of memory.