Online Tutorials & Training Materials | STechies.com
Register Login

Top 20 OS Interview Questions and Answers

|| 0

Top 20 OS Interview Questions and Answers
Stechies

Explain what is operating system and its types?

An operating system is computer software that works as a bridge between the user and the computer hardware and other software. It is a combination of programs that help in managing and executing different resources of the computer. There are different types of operating systems. They are:

  • Multiprocessing operating system
  • Distributed operating system
  • Batch operating system
  • Network operating system
  • Real-time operating system
  • Mobile operating system

What are the different operating systems?

The different operating systems are as follows:

  • Windows
  • Apple iOS
  • Google Android OS
  • LINUX/ UNIX
  • Apple Mac OS

What is the function of the kernel of an operating system?

The kernel is any operating system works as a communicator between the software and hardware. When a system boots, this is the first program that is loaded into the memory. It forms the foundation layer of the operating system, manages the resources and interacts with the hardware.

It also performs important low-level functions such as:

  • Memory management
  • Device management
  • I/O communication
  • It handles interrupts

What is the difference between microkernel and monolithic kernel?

Microkernel:

Microkernel is a type of kernel that makes use of both userspace and kernel space to execute processes of the system. It divides the kernel into different processes called services. This loads the kernel services and user services in separate address spaces.

It uses system calls to manage threads, handle inter-process communication and managing the memory.

Monolithic:

A monolithic kernel is a single program. This is used for loading the OS services in the kernel space. Here unlike microkernel, the kernel and user services are placed in the same address space. It offers functions like CPU scheduling and file management by using system calls.

What is an RTOS (Real-Time Operating System)?

An RTOS is an operating system that is capable of performing multiple tasks quickly. Here operations and programs are processed very fast. The processes are executed in real-time and the responses are also managed quickly.

They are used in air traffic control systems, defense systems like RADAR and airline reservation systems.

What is deadlock?

A deadlock is a situation where two processes want to access the same resource but are unable to do so. For example, Process 1 has a resource R 1. Process 2 is holding resource R 2. There might be a situation where Process 1 is requesting for R 2, that is held by Process 2. Similarly, Process 2 might be waiting for R1, that Process 1 has. This situation creates a deadlock.

What is Process in OS?

A program that is currently being executed is called a process. A process is considered an active entity. For example, if we write code in a text file and run it, it is converted into a process. After a program is loaded into the memory, it can be divided into 4 parts:

  • Stack
  • Heap
  • Text
  • Data

What are the different states of a process in an OS?

The different states of a process in any OS are as follows:

  • New– Creation of process
  • Ready– It is ready and waiting for execution
  • Running –Execution of instructions take place
  • Waiting – Process waits for an event
  • Terminated – Process is terminated or killed

What is a thread in an Operating System?

In a process code, a thread represents the flow of its execution. It is also called a lightweight process and they are executed one by one. Threads share certain information like code segments and open files with other peer threads. Each thread has three parts:

  • Program counter
  • A stack
  • Register

Explain the Inverted Page Table?

In any operating system, an Inverted Page Table is a global page table that is built for all the processes. As there is only one table, any additional information about pages has to be stored in this table. This will be useful for identifying the page entries for the different processes.  

What is virtual memory in an operating system?

Virtual memory is a storage process through which the OS compensates for the lack of memory by sending some data from the RAM to the disk. The RAM’s active memory and the hard disk’s inactive memory is combined to form address spaces for storing data. The RAM is emulated by the virtual memory by utilizing a section of the hard drive.      

In this process, virtual addresses are mapped to physical addresses in the RAM.

What is a command interpreter?

In operating systems, a command interpreter is used for accepting the user’s instructions or commands. These are usually text-based interfaces where these instructions are executed. It is also called a shell in some operating systems.

These interfaces were used when GUI interfaces were not introduced.

What is a zombie process in Linux OS?              

In Linux, when a process’s execution gets over, it is called a zombie process. But these processes still exist in the process table. If the parent process has not yet read the child’s exit status, these processes are formed. When such a process dies, the parent process is notified using a SIGCHILD signal.

How to Kill a Zombie process?

A zombie process is already dead and cannot be killed. However, if there are too many zombie processes, the parent process can be killed to clear them all

Therefore to kill the parent process use the following command

– kill -s SIGCHLD pid 
  • Here replace pid with the id of parent process

Note: The pid of the parent process can be determined using the pstree command.

$ pstree -vai

Explain pre-emptive and non pre-emptive scheduling?

In pre-emptive scheduling, the process can switch from running state to a ready state. It can also switch from waiting to the ready state. Resources are assigned for a limited time to a particular process.

When a process gets terminated, non pre-emptive scheduling comes to play. It is also used when the process changes from running to waiting state.

What is compaction in an OS?

Compaction in an operating system is the process of collecting free memory spaces from a big block of memory. This is done to make room for some processes. Here, the free partitions within the memory are ordered in a contiguous manner. Loaded partitions are gathered together.

What is a single-tasking operating system?

A single-tasking operating system is a type of OS that is able to execute only one program at a time. Here a user can perform a single action like playing a song at a particular time. Example – Palm OS

What is Cache memory?

Cache memory is very fast and acts as a buffer between the CPU and the RAM. It is used to store data and instructions that are frequently requested by the user.

Using cache memory, the CPU can access or retrieve the data easily and fast. 

What is primary storage and secondary storage?

  • Primary storage consists of RAM that is volatile in nature. So the data is lost when the system is shut down. It also has ROM where data is retrieved even if the system is shut down.
  • Secondary storage devices like USB and hard disk drives are used to store data for the long term. These are devices that are not part of the system and usually external components.

What is Throughput, Turnaround time, Waiting Time and Response Time in Operating System.

  • Throughput is the performance of tasks in a system. It is a measure of the amount of work done in a period of time.
  • Turnaround time is the period from when the process is submitted and when it is completed.
  • Waiting time is the time period a process is the time difference between the bust time and turnaround time.
  • Response time is the time spent between the submission of a request and when the response is obtained.