Operating System Interview Questions And Answers

Top 100+ Operating System Interview Questions and Answers

Top 100 Operating System Interview Questions and Answers:

Recently asked Operating System Interview Questions and Answers are as follows-

1) What is an operating system?

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

2) What is the main purpose of an operating system?

There are two main purposes of an operating system:

  • It is designed to make sure that a computer system performs well by managing its computational activities.
  • It provides an environment for the development and execution of programs.

3) What are the different operating systems?

  • Batched operating systems
  • Distributed operating systems
  • Timesharing operating systems
  • Multi-programmed operating systems
  • Real-time operating systems

4) What is a socket?

A socket is used to make connection between two applications. Endpoints of the connection are called socket.

5) What is a real-time system?

Real-time system is used in the case when rigid-time requirements have been placed on the operation of a processor. It contains a well defined and fixed time constraints.

6) What is kernel?

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

7) What is monolithic kernel?

A monolithic kernel is a kernel which includes all operating system code is in single executable image.

8) What do you mean by a process?

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

  • Operating System Processes
  • User Processes

9) 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

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

11) 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:

  • The program code cannot modify itself.
  • The local data for each user process must be stored separately.

12) What is the difference between process and program?

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

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

14) What is the concept of demand paging?

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

15) What is the advantage of a multiprocessor system?

As many as processors are increased, you will get the considerable increment in throughput. It is cost effective also because they can share resources. So, the overall reliability increases.

16) What is virtual memory?

Virtual memory is a very useful memory management technique which enables processes to execute outside of memory. This technique is especially used when an executing program cannot fit in the physical memory.

17) What is thrashing?

Thrashing is a phenomenon in virtual memory schemes when the processor spends most of its time swapping pages, rather than executing instructions.

18) What are the four necessary and sufficient conditions behind the deadlock?

These are the 4 conditions:

1) Mutual Exclusion Condition: It specifies that the resources involved are non-sharable.

2) Hold and Wait Condition: It specifies that there must be a process that is holding a resource already allocated to it while waiting for additional resources that is currently being held by other processes.

3) No-Preemptive Condition: Resources cannot be taken away while they are being used by processes.

4) Circular Wait Condition: It is an explanation of the second condition. It specifies that the processes in the system form a circular list or a chain where each process in the chain is waiting for a resource held by next process in the chain.

19) What is a thread?

A thread is a basic unit of CPU utilization. It consists of a thread ID, program counter, register set and a stack.

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

21) What is SMP?

SMP stands for Symmetric MultiProcessing. It is the most common type of multiple processor system. In SMP, each processor runs an identical copy of the operating system, and these copies communicate with one another when required.

22) What is RAID? What are the different RAID levels?

RAID stands for Redundant Array of Independent Disks. It is used to store the same data redundantly to improve the overall performance.

Following are the different RAID levels:

RAID 0 – Stripped Disk Array without fault tolerance

RAID 1 – Mirroring and duplexing

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

23) What is deadlock? Explain.

Deadlock is a specific situation or condition where two processes are waiting for each other to complete so that they can start. But this situation causes hang for both of them.

24) 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 ) ].

Note: This condition implies the hold-and-wait condition, but it is easier to deal with the conditions if the four are considered separately.

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

26) What is the difference between logical address space and physical address space?

Logical address space specifies the address that is generated by CPU. On the other hand physical address space specifies the address that is seen by the memory unit.

27) What is fragmentation?

Fragmentation is a phenomenon of memory wastage. It reduces the capacity and performance because space is used inefficiently.

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

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

30) What is the difference between internal commands and external commands?

Internal commands are the built-in part of the operating system while external commands are the separate file programs that are stored in a separate folder or directory.

31) 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:

  • Binary semaphores
  • Counting semaphores

32) What is a binary Semaphore?

Binary semaphore takes only 0 and 1 as value and used to implement mutual exclusion and synchronize concurrent processes.

33) What is Belady’s Anomaly?

Belady’s Anomaly is also called FIFO anomaly. Usually, on increasing the number of frames allocated to a process virtual memory, the process execution is faster, because fewer page faults occur. Sometimes, the reverse happens, i.e., the execution time increases even when more frames are allocated to the process. This is Belady’s Anomaly. This is true for certain page reference patterns.

34) What is starvation in Operating System?

Starvation is Resource management problem. In this problem, a waiting process does not get the resources it needs for a long time because the resources are being allocated to other processes.

35) What is aging in Operating System?

Aging is a technique used to avoid the starvation in resource scheduling system.

36) What are the advantages of multithreaded programming?

A list of advantages of multithreaded programming:

  • Enhance the responsiveness to the users.
  • Resource sharing within the process.
  • Economical
  • Completely utilize the multiprocessing architecture.

37) What is the difference between logical and physical address space?

 

Logical Address is generated by CPU while a program is running. The logical address is virtual address as it does not exist physically, therefore, it is also known as Virtual Address. This address is used as a reference to access the physical memory location by CPU. The term Logical Address Space is used for the set of all logical addresses generated by a program’s perspective. The hardware device called Memory-Management Unit is used for mapping logical address to its corresponding physical address.

 

Physical Address identifies a physical location of required data in a memory. The user never directly deals with the physical address but can access by its corresponding logical address. The user program generates the logical address and thinks that the program is running in this logical address but the program needs physical memory for its execution, therefore, the logical address must be mapped to the physical address by MMU before they are used. The term Physical Address Space is used for all physical addresses corresponding to the logical addresses in a Logical address space.

38) What are overlays?

Overlays makes a process to be larger than the amount of memory allocated to it. It ensures that only important instructions and data at any given time are kept in memory.

39) When does trashing occur?

Thrashing specifies an instance of high paging activity. This happens when it is spending more time paging instead of executing.

40) What are the different scheduling algorithms
First-Come, First-Served (FCFS) Scheduling.
Shortest-Job-Next (SJN) Scheduling.
Priority Scheduling.
Shortest Remaining Time.
Round Robin(RR) Scheduling.
Multiple-Level Queues Scheduling.

41) Describe the objective of multiprogramming.

The main objective of multiprogramming is to have a process running at all times. With this design, CPU utilization is said to be maximized.

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

42) What is SMP?

SMP is a short form of Symmetric Multi-Processing. It is the most common type of multiple-processor systems. In this system, each processor runs an identical copy of the operating system, and these copies communicate with one another as needed.

43) What is asymmetric clustering?

In asymmetric clustering, a machine is in a state known as hot standby mode where it does nothing but to monitor the active server. That machine takes the active server’s role should the server fails.

44) What is RR scheduling algorithm?

RR (round-robin) scheduling algorithm is primarily aimed for time-sharing systems. A circular queue is a setup in such a way that the CPU scheduler goes around that queue, allocating CPU to each process for a time interval of up to around 10 to 100 milliseconds.

45) What are overlays?

Overlays are used to enable a process to be larger than the amount of memory allocated to it. The basic idea of this is that only instructions and data that are needed at any given time are kept in memory.

46) How does swapping result in better memory management?

During regular intervals that are set by the operating system, processes can be copied from main memory to a backing store, and then copied back later. Swapping allows more operations to be run that can fit into memory at one time.

47) What is Direct Access Method?

Direct Access method is based on a disk model of a file, such that it is viewed as a numbered sequence of blocks or records. It allows arbitrary blocks to be read or written. Direct access is advantageous when accessing large amounts of information.

48) When does thrashing occur?

Thrashing refers to an instance of high paging activity. This happens when it is spending more time paging instead of executing.

49) What is root partition?

Root partition is where the operating system kernel is located. It also contains other potentially important system files that are mounted during boot time.

50) What are device drivers?

Device drivers provide a standard means of representing I/O devices that maybe manufactured by different companies. This prevents conflicts whenever such devices are incorporated in a systems unit.

51) What are the primary functions of VFS?

VFS, or Virtual File System, separate file system generic operations from their implementation by defining a clean VFS interface. It is based on a file-representation structure known as vnode, which contains a numerical designator needed to support network file systems.

52) What is multitasking?

Multitasking is the process within an operating system that allows the user to run several applications at the same time. However, only one application is active at a time for user interaction, although some applications can run “behind the scene”.

53) Explain the pros and cons of a command-line interface?

A command-line interface allows the user to type in commands that can immediately provide results. Many seasoned computer users are well accustomed to using the command line because they find it quicker and simpler.

However, the main problem with a command line interface is that users have to be familiar with the commands, including the switches and parameters that come with it. This is a downside for people who are not fond of memorizing commands.

54) What is caching?

Caching is the processing of utilizing a region of fast memory for a limited data and process. A cache memory is usually much efficient because of its high access speed.

55) What is spooling?

Spooling is normally associated with printing. When different applications want to send an output to the printer at the same time, spooling takes all of these print jobs into a disk file and queues them accordingly to the printer.

56) What is an Assembler?

An assembler acts as a translator for low-level language. Assembly codes written using mnemonic commands are translated by the Assembler into machine language.

57) What are interrupts?

Interrupts are part of a hardware mechanism that sends a notification to the CPU when it wants to gain access to a particular resource. An interrupt handler receives this interrupt signal and “tells” the processor to take action based on the interrupt request.

58) What is GUI?

GUI is short for Graphical User Interface. It provides users with an interface wherein actions can be performed by interacting with icons and graphical symbols. People find it easier to interact with the computer when in a GUI especially when using the mouse. Instead of having to remember and type commands, users click on buttons to perform a process.

59) What is preemptive multitasking?

Preemptive multitasking allows an operating system to switch between software programs. This, in turn, allows multiple programs to run without necessarily taking complete control over the processor and resulting in system crashes.

60) What is plumbing/piping?

It is the process of using the output of one program as an input to another. For example, instead of sending the listing of a folder or drive to the main screen, it can be piped and sent to a file, or sent to the printer to produce a hard copy.

61) What is NOS?

NOS is short for Network Operating System. It is a specialized software that will allow a computer to communicate with other devices over the network, including file/folder sharing.

62) Differentiate internal commands from external commands.

Internal commands are built-in commands that are already part of the operating system. External commands are separate file programs that are stored in a separate folder or directory.

63) Explain why Ubuntu is safe and not affected by viruses?

It does not support malicious e-mails and contents, and before any e-mail is opened by users it will go through many security checks

Ubuntu uses Linux, which is a super secure O.S system

Unlike other O.S, countless Linux users can see the code at any time and can fix the problem if there is any

Malware and viruses are coded to take advantage of the weakness in Windows

64) 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

65) Explain Booting the system and Bootstrap program in operating system.

The procedure of starting a computer by loading the kernel is known as booting the system.
When a user first turn on or booted the computer, it needs some initial program to run. This initial program is known as Bootstrap Program. It is stored in read-only memory (ROM) or electrically erasable programmable read-only memory (EEPROM). Bootstrap program locates the kernel and loads it into main memory and starts its execution.

66) Explain Process.

A process is a program that is running and under execution. On batch systems, it is called as a “job” while on time sharing systems, it is called as a “task”.

67) Explain the basic functions of process management.

Important functions of process management are:

– Creation and deletion of system processes.
– Creation and deletion of users.
– CPU scheduling.
– Process communication and synchronization.

68) What are the various IPC mechanisms?

IPC – Inter Process Communication.

Various IPC mechanisms are:

a. Sockets
b. Pipes
c. Shared memory
d. Signals
e. Message Queues

69) What is a semaphore?

– A semaphore is a hardware or a software tag variable whose value indicates the status of a common resource.
– Its purpose is to lock the common resource being used. A process which needs the resource will check the semaphore to determine the status of the resource followed by the decision for proceeding.
– In multitasking operating systems, the activities are synchronized by using the semaphore techniques.

70) What kind of operations are possible on a semaphore?

Two kind of operations are possible on a semaphore – ‘wait’ and ‘signal’.

71) What is context switching?

– Context is associated with each process encompassing all the information describing the current execution state of the process
– When the OS saves the context of program that is currently running and restores the context of the next ready to run process, it is called as context switching.
– It is important for multitasking OS.

72) What is the basic difference between pre-emptive and non-pre-emptive scheduling.

Pre-emptive scheduling allows interruption of a process while it is executing and taking the CPU to another process while non-pre-emptive scheduling ensures that a process keeps the CPU under control until it has completed execution.

73) What are read-write locks?

– Read – write locks provide simultaneous read access to many threads while the write access stays with one thread at a time. They are especially useful in protecting the data that is not frequently written but read simultaneously by many threads.
– They are slower than mutexes.

74) List the basic functions of OS file management.

Answer: 

  • Create and delete directories and files.
  • Use secondary storage for creating backup files.
  • Map file in secondary storage.
  • Give support to the file modification.

75) What is the Bootstrap program?
Answer: It is a program that resides in the Kernel of an Operating system, and when we boot the system, it is the first program that executes and stores the read-only memory (ROM).

76) What are the main functions of a kernel in an operating system?
Answer:

  • Process management
  • Resource management
  • Disk management
  • Memory management
  • Device management
  • Communicate between hardware and software.

77) What is starvation?
Answer: When a program is in process, and it does not get all the resources to execute, because other processes are using the same resources, this problem of not getting all needed resources is known as starvation.

78) What is race condition?
Answer: It is a situation that occurs when different operations performed on the same data simultaneously, and the outcome of the execution depends on the order of the operations performed on the data. The race condition can provide an undesirable outcome.

79) Explain PCB.

Answer: PCB stands for Process Control Block, and it an Operating System data structure, which can collect and store the information about the processes. It is also known by process Descriptor.

80) What is IPC?
Answer: IPC stands for Inter-Process Communication, and it is a mechanism, in which various processes can communicate with each other with the approval of the Operating system.

81) Name the Various IPC mechanisms.
Answer:

  • Sockets
  • Pipe
  • Shared Memory
  • Signals
  • Message Queues

82) What is process scheduling?

Answer: It is a routine followed by the process manager of the system. In this, the process manager can use different methods and strategies to remove a particular running process or select another process for the CPU.

83) What is a page in OS?

Answer: A page can be defined as the smallest unit of data, and it is a fixed-length contiguous block of virtual memory.

84) Explain page frames.

Answer: When the page transfer from the secondary memory to the main memory, then it requires a fixed-length of a continuous physical memory block, known as page-frame. It is the job of the operating system to map the pages in the page frames.

85) What is the page fault?

Answer: It is an error, occurs when the CPU tries to access a specific block of memory address that is not present in the physical memory (RAM).

86) What do you know about the library?

Answer: A library is a collection of files which contain subroutines, data and other objects that can be used by other programs.

87) What are the APIs?

Answer: APIs stands for Application Program Interface, and it is a collection of libraries and subprograms. APIs are used to set communication between two programs; API provides a general way of sending and receiving data between applications.

88) What is user space and kernel space?

These are two important region of a memory.

User space: It is a region of memory where normal user processes run (i.e. everything other than Kernel).

Kernel space: It is a region of memory where code of kernel resides and executes. It is considered to be privileged part of a memory invoked by system calls. It is also known as System space.

89) What is difference between a program and a process?

A program is a set of instructions that are to perform a designated task, whereas the process is an operation which accepts the given instructions and perform the task as per the code, called ‘execution of instructions’.

Thus a program is a passive entity residing at secondary memory and a process is an active entity residing in the main memory

90) What is fork ()?

Fork is a system call which is responsible for creating a copy of a current process. The current process is termed as parent process and the created process is termed as child process.

On success it returns pid of the child process to parents process and Zero is returned to child process.

91) What is system call?

It’s like a way by which any user level program ask for the services offered by a kernel.

It acts as an interface between a process and the operating system.

92) What are the different attributes of a process?

Some of the important attributes of a process are:

  • Process id (pid)
  • Parent process id (PPid)
  • Process state
  • Scheduling parameter
  • Program counter and different registers.

This is also referred as context of a process.

93) State the benefits of a thread?

Some of the common advantages associated with threads are:

Responsiveness: A process with thread are said to be more responsiveness than a process without thread because even if one thread is blocked or waiting for some resources the other thread still continue to function.

Lighter: A thread is considered to be lighter than a process in terms of resource sharing and run time overhead. Most of the resource of a process are shared by all its thread making it lighter.

Throughput: It improves the throughput of a multithreaded application, multiprocessor environment.

Economy: Creating and managing thread is much faster (context switching is faster) than performing same task for processes.

94) State the disadvantages associated with thread?

  • Robustness:

It’s not as robust as process since if any one thread is terminated abnormally, it leads to entire process termination.

Thus many RTOS (Real Time Operating System) application uses processed over threads.

  • Increased Complexity

It is more complex than a process in terms of synchronization overhead.

95) What is difference between a process and a threads?

Process Thread
The process is used for heavyweight task Threads are used for small task(lightweight)
Processes are less responsive than threads Threads are more responsive than process
Processes are more robust than threads Threads are less robust
Each process will have its own address space. Threads are within a process thus share same address space(memory)
Processes have less synchronization overhead since all have separate address space(memory) Since they share same address space, synchronization is more overhead than proces

96) What is scheduler?

It is one of the component of kernel responsible for scheduling that is deciding when to run which process.

97) What are different types of scheduler?

There are three types of scheduler:

  • Long Term scheduler:

It is also called job scheduler responsible for selecting processes from queue (job pool/secondary memory) and loading them to main memory for execution.

  • Short term scheduler:

It is also called CPU scheduler responsible for selecting a process among processes that are ready to execute and allocate CPU to one of them.

This is nothing but a change of state of process from ready to running state. It is also called dispatcher.

  • Medium term scheduler:

It is also called swapper responsible for swapping a process from main memory to secondary memory in case if some high priority process needs to be given chance for execution.

It reduces the degree of multiprogramming (many processes in main memory).

98) What are different performance metric for scheduler?

There are five performance metric for scheduler, those are as follows:

  • CPU Utilization: Percentage of time that the CPU is doing useful work (I.e. not being idle). 100% is perfect.
  • Wait time: Average time a process spends for its turn to get executed.
  • Throughput: Number of processes completed / time unit.
  • Response Time: Average time elapsed from when process is submitted until useful output is obtained.
  • Turnaround Time: Average time elapsed from when the process is submitted to when it has completed.

100) Differentiate between semaphore and mutex?

Below stated are some important difference held between mutex and semaphore

                         Semaphore                               Mutex
It is a synchronization mechanism It is a locking mechanism
A Semaphore controls access to a shared pool of resources. It provides operations to Wait () until one of the resources in the pool becomes available, and Signal () when it is given back to the pool. A Mutex controls access to a single shared resource.
The other process can also release the lock held by others The process which has acquired the lock can only release the lock

 

Related Posts:

For more Interview Questions And Answers click here

3 thoughts on “Top 100+ Operating System Interview Questions and Answers

  1. Pingback: Most Commonly Asked CPP Interview Questions And Answers - CloudNClear

Leave a Reply

Your email address will not be published.