OS Interview Questions

By | May 20, 2020
OS Interview Questions

If you are preparing for a Technical Interview, then we suggest you go through these Operating System Interview questions. In the Technical interviews, apart from your problem-solving skills, the interviewer may also test your knowledge on Operating systems. Every Software developer or IT student is supposed to have the knowledge and basic understanding of Operating Systems and its terminologies. Candidates who are going to appear for a system administrator job interview should also have an in-depth understanding of various operating systems.

Vamware

Best OS Interview Questions and Answers (Operating System)

In this article, we have provided the frequently asked Operating System Interview questions please go through these, so you do not go offhanded for the interview.

Question: What is an Operating System?
Answer: It is a program that provides an interface between the software and hardware of a computer. An Operating system offers an environment for the user to execute the software using the hardware.

Question: Name some functions of the Operating system.
Answer:

  • Memory management
  • Processor management
  • Device management
  • File management
  • Security
  • Job accounting
  • Control over system performance
  • Error detection
  • Communicate between user and software
  • Communication between software and hardware.

Question: Name the different Operating Systems.
Answer:

  • Batched Operating System
  • Interactive OS
  • Multi-processing Operating system
  • Multitasking Operative System
  • Distributed Operating System
  • Multi-programmed Operating Systems
  • Real-Time Operating System
  • Timesharing Operating System

 

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

 

Question: What is Booting?
Answer: It is a procedure of turning on the computer by loading the Kernel.

Question: 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).

Question: What is the use of an Operating System?
Answer: An operating system acts as a management system between the system software and hardware, and guides the hardware to act according to the provided software. It also controls the flow of the program and provides an environment so the software can communicate with system hardware.

Question: Define a multi-programming system.
Answer: In the multi-programming system, the system keeps the different program in different parts of the main memory simultaneously and execute each of those concurrently.

Question: Define multitasking systems.
Answer: In a multitasking system, programs are kept in the main memory so the system can execute them simultaneously.

Question: What are the time-sharing systems?
Answer: In time-sharing systems, multiple users can use a specific program from the different terminal at the same time.

Question: Give the advantages of the multiprocessor system.
Answer: Multi-processor, as its name says, it’s clear that it uses more than one processor with the increase in processor number; the processing capability of the system increases too.

Question: What is virtual memory?
Answer: Virtual memory is a memory management method that helps to execute the process using the primary and secondary memory. Though the program gets executed using the main memory, the resources and pages load from the secondary memory.

Question: What is Kernel in the Operating system?
Answer: It is an essential part of the Operating system, also known as the core of the Operating system. It is present in the main memory of the system and loads before any other part of the operating system. Every operating system consists of a kernel; for example, the Linux kernel is one of the famous kernels, and Android also uses this Kernel.

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

Question: Define the two most popular types of Kernels.
Answer: Though there are many types of kernels, only two of them considered in use.

  • Monolithic Kernel
  • MicroKernel

Monolithic Kernel: In this type of Kernel, all the User services and kernel services reside in the same memory space. The old operating system would use this type of Kernel. Some examples are Linux, Windows 95, 98, Unix, etc.

MicroKernel: This type of Kernel is small in size, and all the User and Kernel services reside in the different memory addresses. Operating systems like Mac OS X, windows use this type of Kernel.

Question: Give some disadvantages of Microkernel.
Answer:

  • Complex process management
  • Debugging the messaging is complex.
  • Loss in performance because of the requirement of more software.

Question: What is SMP?
Answer: It stands for Symmetric Multiprocessing (SMP), and it is an architecture that contains multiple processors to complete the process, all the processors share the single memory.

Question: What is Asymmetric clustering?
Answer: Asymmetric clustering occurs when the server running application finds some kind of cluster. In asymmetric clustering, one server tries to run the server application while others remain on standby mode.

Question: Explain thread?
Answer: It is a flow of execution through the process code; it deals with the instruction to be executed.

Question: What is demanding Paging?
Answer: Demanding pages is a concept used by the virtual machine. Only a part of the process needs to be present in the main memory to execute some process, which means that only a few pages will only be present in the main memory at any time, and rest will be kept in the secondary memory.

Question: What is the process?
Answer: A program in its execution mode is known as a process.

Question: Name all the state of a Process.
Answer:

  • New
  • Running
  • Waiting
  • Ready
  • Terminate

Question: How thread is different from the process?
Answer:

  • The process is independent, whereas a thread is not.
  • A thread can assist other threads, whereas the process is not.
  • If one thread stops, the next thread starts executing, but this is not a case in case of a process.

Question: What is a deadlock?
Answer: When two processes are trying to execute simultaneously, and they are waiting for each other to finish the execution as they are dependent on each other, this halt in execution is known as deadlock. When the deadlock occurs in the program, we can see the hang problem in our system.

Question: What are the necessary conditions for a deadlock?
Answer:

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

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

Question: What is a command interpreter?
Answer: It is a text field I/O interface between the user and the operating system. In the command interpreter, the user gives input through the keyboard using command lines. Command Prompt in windows and terminal in Linux & macOS are the examples of the command interpreter.

Question: What is the daemon
Answer: It stands for Disk and Execution monitor, and it is a long-running background process that acts on the request. The life cycle of daemon commences with the system booting until the system shuts down.

Question: From where the daemon originate and how we classified them?
Answer: The term daemon originated with UNIX. In UNIX, the daemon conventionally ends with ‘d’, for example ‘inetd’, ‘nfsd’, httpd’, and ‘lpd’.

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

Question: What is process synchronization?
Answer: When the race condition occurs, it can lead to an undesirable outcome, so to prevent the race condition, we follow a process known as synchronization. In synchronization, we ensure that only one process executes at a time.

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

As soon as a process gets created, the Operating System creates a corresponding PCB to store the process status and information. With each transition, OS update the PCB data structure.

Question: What is Semaphore?
Answer: It is a variable that is used to create a synchronized process. There are two types of semaphores one is counting semaphores another is Binary semaphore.

Counting semaphore can have positive integer values, and Binary can only have 1 and 0 as variables.

Question: Explain FCFS and what is the main problem it can cause.
Answer: It stands for First Come First Serve (FCFS), it is a scheduling algorithm. According to this algorithm, the CPU serves that process first, which approaches it first. FCFS can cause the starvation problem in which the process does not get the proper resources.

Question: Name the different RAID Levels.
Answer:

  • RAID 0 – Non-redundant striping
  • RAID 1 – Mirrored Disks
  • 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

 

Question: What is Cache memory?
Answer: It is a volatile computer memory directly attached to the register, which provides high-speed data access to the processor.

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

Question: Name the Various IPC mechanisms.
Answer:

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

Question: What is Context Switch?
Answer: Context can be referred to as the data in the register. A context switch is a procedure in which the CPU change from one task to another task.

Question: Give the difference between compiler and Interpreter.
Answer: A compiler first reads all the code at once then tries to execute it, whereas the Interpreter reads the code line by line and simultaneously executes it.

Question: What are Sockets?

Answer: Sockets are the Inter-process Communication mechanisms which are used to provide a point-to-point communication between two processes. Sockets are often utilized in client-server applications because many protocols such as FTP, SMTP and POP3 use sockets to implement the connection between server and client.

Question: What do you understand by Main Memory and Secondary Memory?

Answer: Main memory is directly connected to the computer processor, and it acts as a bridge between computer processors and secondary memory. The main objective of the main memory, to get the data from the secondary memory and fetch it to the processor so that the appropriate actions could be performed. RAM and ROM are the two main memories used by the System, whereas Hard-disk and other large-size memories are the part of secondary memory.

As compared to the secondary memory, it is straightforward and fast to access data from the main memory that’s why processors directly communicate with Main memory. Generally, Main memory does not store data permanently; it only holds data for a time and tries to give it to the processor for the further execution process.

Question: Can there be a deadlock situation with a single process?

Answer: No, to occur a deadlock situation, we need at least two dependent processes. A deadlock situation can only arise when there these four conditions coincide.

  • Hold and Wait
  • No Preemption
  • Mutual Exclusion
  • Circular wait.

Question: What are interrupts?

Answer: These are the signals generated by the external input devices to stop the ongoing active process of CPU.  Interrupts use context switching so the CPU can switch between the current process and the new signal generated by the external device. Interrupts help in prioritizing the process execution of CPU.

 

Question: What are zombie processes?

Answer: Formally, these processes are known as defunct processes. If a child process is still in the process table even after the parent process has been executed, this scenario could cause a zombie process. Even the kill commands do not have any effect on these processes.  If the Wait System Call read the exit status of the process, then the zombie process would remove from the process table.

Question: Explain pipe in OS?

Answer: Pipe is the method for exchanging information between processes. Generally, pipe forms a one-way communication, which means using a pipe a process can only send information such as output or other parameters of the process to another process.

For setting a two-way communication between two processes, we require two pipes for both the directions.

Question: What is the limitation of pipes for two way communication between two processes?

Answer: If both the processes are the child process of the same parent, then only two-way pipe communication could be set between the processes.

 

Question: What do you know about the named pipe?

Answer: Generally, we use the un-named pipe to set communication between the related process, but if we want to communicate unrelated processes, then we need to use named pipes. Like a traditional unnamed pipe, named pipe is also a part of IPC(Interprocess communication), and its life remains until the system is up.

 

Question: Name the operations which are possible on a semaphore.

Answer: We can only perform two operations on a semaphore:

  1. wait
  2. signal

 

Question: What do you know about mutex?

Answer: It is an abbreviation for Mutual Exclusion. It is a userspace program object which helps multiple threads to access the same resource, but not simultaneously. The sole purpose of mutex to lock a thread with a resource so the other threads can not use the same resource until the first thread finish executing.

 

Question: What is a critical section?

Answer: The program will behave oddly if program parts perform concurrent access to the shared resources. So to protect the shared resources of a program, we create a protected section which is known as Critical Section or Critical region. A critical section can only execute one process at a time, and this eliminates the problems that can be caused by concurrent accessing resources.

 

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

 

Question: What is the difference between preemptive and non-preemptive scheduling?

Answer: Scheduling is divided into two categories, Preemptive and Non-Preemptive Scheduling.

Preemptive Scheduling Non-Preemptive Scheduling
In this process are allocated to CPU for a limited period. Here process remains in CPU till it gets entirely executed.
If there is a new process come with high priority, then the ongoing CPU process has to stop. Here the priority of the process does not matter. The new process has to wait until the first process is to finish executing.
There is a continuous switching between the running and ready state of the processes. It is not a case in non-preemptive
Preemptive schedule the process on their priority. Non-preemptive use the process burst time.
In preemptive, there is a high probability that the process with less priority will starve. Here process with less burst time will starve.

Question: Name the various Scheduling algorithms.

Answer:

  • First Come First Serve
  • Shortest Job First
  • Priority Scheduling
  • Round Robin Scheduling

First Come First Serve: It follows, the non-preemptive scheduling, and here the process request first gets the CPU.

Shortest job First: It could be a  Preemptive or non-preemptive scheduling algorithm. In this algorithm, that process gets CPU which is closest to its execution. Here CPU gives priority to those jobs which have low execution time.

Priority Based Scheduling: It is also a preemptive algorithm, and here CPU allocated to those processes first which have high priority.

Round Robin Scheduling: It is a preemptive scheduling algorithm, and here each process get equal time for execution.

Question: What are Condition variables?

Answer: These are the synchronization object which can set some condition for threads, and if the condition occurs then only the appropriate operations can be performed by the threads. If the situation does not raise, then the threads have to wait, for further execution. Condition variable often used with critical section and slim reader, where they help in binding and holding the threads.

 

Question: What is the reader-writer lock?

Answer: Reader-Writer lock is used to prevent data integrity. This lock allows the concurrent access to read operation, which means multiple threads can read data simultaneously. But it does not allow concurrent write, and if one thread is want to modify data via writing, then all the other threads will be blocked from reading or writing data.

Question: What are the different types of memory used by the system?

Answer: 

  • Main memory such as RAM, ROM
  • Secondary memory, such as Hard-disk, e-drives, etc.
  • Cache
  • Internal Process Memory, such as registers.

 

Question: What is compaction?

Answer: The free memory of the system get split into smaller pieces when a process load or removed from the memory. Compaction helps in accumulating these small loose pieces of memory into one substantial chunk so that more memory can be allocated to the other processes.

 

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

 

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

 

Question: What is the difference between logical and physical addresses?

Answer: 

Logical Address Physical Address
The CPU generates it. It is the real address of the program in the memory.
A user can access the logical address of the program. The physical address can be accessed directly.
CPU generates a logical address at execution time. It is generated by the Memory Management Unit(MMU) at creation time.

Question: What is the page fault?

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

Question: What is thrashing?

Answer: It is a scenario when continuous page fault and paging activities occur. Thrashing could lead to a program collapse and degrade the CPU performance.

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

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

Question: What is Belady’s anomaly?

Answer: It is a situation, occurs in the system when there is an increase in page faults by the CPU because additional memory has been introduced to the system, which results in increasing page frames.

Question: What do you know about cascading termination?

Answer: When a process is finish execution, then the OS terminates the process via the exit System call. Only the parent process can cause the termination of its child processes, so when the parent process gets entirely executed and terminated, then its child process also gets terminated automatically. This phenomenon of process triggering termination of another process is known as cascading termination.

Conclusion

Operating System is the core program for any computer; without it, a system is just a piece of hardware. A user will not be able to communicate or interact with the system if there is no Operating System. If you have an IT job interview in 2020, we suggest you read these Operating System interview questions and answer to refresh your knowledge on Operating System and its working. It does not matter if you are going for a developer job interview or some other technical support interview, you still supposed to have explicit knowledge of OS.

If you like this article or have any suggestions, please let us know, feel free to leave your comments in the comment box.

You might be also interested in:

One thought on “OS Interview Questions

Leave a Reply

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