20 operating interview questions (with answers):

Here are 20 most asked and important questions which will help everyone associated with the operating system working. Doesn’t matter whether you are taking an interview or giving an interview; just follow these questions to get the right candidate for the job or to get the job.

1. What do you mean by the operating system?

This is an inevitable question and you should prepare an answer in a way that covers the objective in brief.

Answer: The operating system is a software service that takes care of the software and hardware resources set to provide us the output for our problems.

2. Name and explain different types of the operating system.

Answer: There are two types of the operating system:

a. Batch Operating System: Under this type of OS, all the jobs are submitted at once and are later executed in the order of submission (no job among the submitted can be taken out until it is completed).

b. Multiprogramming Operating System: This is an extension batch OS where many jobs are in main memory at once and would be later executed in some order for a specific period. Further, this has three subdivisions:

  • Multitasking Operating System: Under this operating system more than one task is executed one after the other on a single processor machine. Under this OS, one process includes switching of CPU at a very sharp pace that it seems to be completed to the end-user.
  • Multiprocessing Operating System: Through this, the operating system executes one process after the other on a multi-processor machine. Completing this is a computer that requires more than one CPU at a time.
  • Real-time Operating System: This sort of operating system works on the time allotted for each job. Mostly used in Military, Satellite, etc;

3. What is understood by the term Kernel? Name some functions of Kernel.

Answer: The kernel is the central part of an operating system. It is responsible for handling the communication or change of command between software (user-level applications) and the hardware (CPU, disk memory, etc). Following are some main functions performed by Kernel:

a. Process Management

b. Device Management

c. Interrupt Handling

d. Memory Management

e. I/O Communication

f. File System and more

4. What are the different types of Kernel?

Answer: There are three types of Kernel:

  • Monolithic Kernel: It is a full-fledged kernel as it has all the service running.

For example UNIX

  • MicroKernel: This type of kernel has limited services. This runs important services.

For example QNX-real-time OS

  • Hybrid Kernel: This is the type of kernel that is derived from both- the monolithic and microkernel.

For example Microsoft NT kernel

5. How do you differentiate between user space and kernel space?

Answer: Similarity: Both of them are important regions of memory.

Difference:

User Space is a section of memory where normal user processes run. That is everything runs here except a kernel.

Kernel space is a section where the code of the kernel is present and later executed. This is a privileged part of memory raised by system calls. The other name for kernel space is system space.

6. Define the term process. What are the different types of the process?

Answer: An active program undergoing the execution or simply, a running program is called process. The process is created by the operating system to run the programs. In Linux, you can use the ps command to see the running process.

exe. in windows operating system is a process like skype.exe etc

Further following are the types of process:

a. Userspace process

b. Kernel space process

7. How is the program different from the process? How can you identify a process?

Answer: A program is a file of instructions that are used to perform the chosen task.

A process is an operation that accepts the given command and performs the task as per the code entered. The code used to provide the command to process is called the execution of instructions.

The process can be identified as id pid.

8. Explain the different states of a process.

Answer: A process goes through the following states:

a. NEW: This is the initial state of the process. This is stored in secondary memory.

b. READY: At this state, the process is all set to be assigned to the processor that is ready to execute.

c. RUNNING: At this state, the process is given to the processor and the instructions are executed.

d. WAITING: This state signifies that some resource is waiting for a file to become available.

e. TERMINATED: A process can be terminated both normally and abnormally.

  • Normal termination: The process has been completed.
  • Abnormal Termination: The process is incomplete and terminated in the way of execution.

The process: New > Ready > Run > Wait > Terminate

9. Name some important attributes of a process. Also, what are the different sections of a process?

Answer: Some important attributes of a process are as follows:

a. Process id (pid)

b. Parent process id (PPid)

c. Process State

d. Scheduling parameter

e. Program counter and different programs

There are 4 types of process sections:

a. Stack: This section has local variables and returns address.

b. Heap: Dynamically allocated memory with the help of malloc, calloc, and realloc

c. Data: Contains global and static variables

d. Coder or text: Contains code, contents in the register of the processor

10. What is a system call? And what do you understand fork ().

Answer: 

  • A system call is a way through which a user-level program asks for the services offered by the kernel. This can be best understood as an interface between a process and an operating system.
  • A fork is a type of system call which creates a copy of the current process. The current process is termed as parent process and once the process is created then it is termed as a child process.

11. Define the term inode.

Answer: The inode is a data structure used for holding the attributes of a file. The inode is also known as Index Number.

Attributes of the file held by Inode:

  • File type
  • Permission
  • File size
  • The time when it was last modified

12. What is thread and what are the types of thread? Differentiate between a process and thread.

Answer: The thread can be best understood as a simultaneous unit of execution within a process. A process is said to have multiple threads where each thread is assigned to perform tasks individually. Threads increase the efficiency of the process. Due to which process has one thread by default. That one thread is called the main thread which is executed at first.

There are two types of thread:

  • User-level thread: Java thread
  • Kernel level thread: POSIX thread
Process Thread
Performs heavyweight task Performs small task(lightweight)
less responsive more responsive
more robust than threads less robust
Each process has its own address space. present within a process thus share the same address space(memory)

13. What are the types of scheduling algorithms? Also, name some performance metrics for schedulers.

Answer: There are 4 types of a scheduler:

a. First come First Serve (FCFS)

b. Round Robin (RR)

c. Shortest job first (SJF)

d. Priority Scheduling (PS)

Talking about the metrics for the scheduler, there are 5 of such:

a. CPU utilization

b. Wait time

c. Throughput

d. Response time

e. Turnaround time

14. What are the different types of processes in Linux?

Answer: There are 3 types of process under Linux:

  • Interactive-Foreground
  • Batch
  • Daemon-Background

15. Define the term Deadlock and explain the conditions required for the deadlock to happen.

Answer: Deadlock is a situation where two threads share the same resources and prevent each other from accessing the resource effectively.

These four conditions when a deadlock can happen:

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

16. Define the Zombie process.

Answer: The zombie process is also known as a defunct process is the process that is done with its execution and is currently in the terminated state but has an entry in the process table. It is denoted by Z.

This simply means that resources in the process are yet to get free.

17. What is meant by synchronization? What are the different synchronization mechanisms?

Answer: The term used for defining the proper coordination among the processes while they are at running state.  Some of the common synchronization mechanisms are:

  • Semaphore: Used to control access to a common resource by multiple processes in a simultaneous system. Some types of Semaphore are: Binary and counting semaphore.
  • Mutex: Used to allow access to one process at a time.

18. What is a critical section of code?

A critical section is that part of code which has variables and different types of resources that are shared by two processes.

19. What is virtual memory and cache?

Answer: 

Virtual Memory: Memory management designed virtual memory to compensate for the shortage of physical memory.

Cache (memory): The memory in CPU for providing faster access to desired data.

20. What do you understand by IPC? State some IPCs.

Answer: IPC stands for the Inter Communication Process- a process to process notification and process synchronization which gives programmer freedom to combine activities among different program processes that can run simultaneously in an operating system.

Some types of IPCs:

a. Message Queue: This is maintained between processes used for exchanging messages and other important information.

b. Shared Memory: Memory is shared among the processes under user space and one process can write and others can read.

c. Pipe: A trick used for passing information from one program to another.

d. Signal: Signals can be either from process to processor from system to process. This is a kind of notification used to inform that an event has occurred.

Hope this article covers your concern.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.