Interview Questions

OS (Operating System) Viva Questions & Answers

An Operating System is system software that communicates directly with your computer’s hardware. It manages the hardware, software resources, and provides you access to the best possible user interface. If you have a career aspiration in the operating systems arena and checking out the best prospects available for you, here are a few top-end interview questions with answers to make it easy for you.

From, what are the different types of operating systems to MCQs Questions on Linux and a few questions based on disk management in Linux.

OS (Operating Systems) Interview Questions with Answers

OS Viva Questions and Answers

What are the primary purposes of an Operating System?
Operating System as the name says is responsible for operating the computer system in a whole. It’s primary purpose is to communicate with the hardware directly to avail services for application software programs to run properly. Moreover, it has various other tasks as well.
What is Reentrancy?

Reentrancy is a concept used for the purpose of multiprogramming time-sharing systems. This is a memory saving technique and lets multiple users share the single copy of a program during the same period.

The significant aspect that a Reentrancy concept needs to focus on is to check that the program code does not modify itself and the local data of each of the users is managed and maintained separately.

What is a Deadlock?

A Deadlock is a condition where two or more processes wait for the other process to finish, and none of them is able to finish. This can happen when two or more processes hold up some resources and do not release them. It makes the other processes to wait for the resources to be released.

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

The primary necessary conditions that can constitute a deadlock can include mutual exclusion, No pre-emption, Hold and wait and circular wait.

  • Mutual Exclusion – This would happen when there is a resource that both the services or processes cannot use.
  • Hold and Wait – A process holds a resource and waits for another resource. The other resource is held by the other process and waiting for the process held by the first process.
  • No pre-emption – A particular resource cannot be taken back by a process as long as the process gives it back.
  • Circular wait – A lot of processes are waiting for their turn in a circular form.
What are the different types of operating systems?

There are five types of operating systems –

Batch Operating System – The jobs are submitted in one go and are executed without any sort of pre-emption. No further job is taken up without the completion of these jobs.

Multiprogramming Operating System – They are an extension of the batch operating system. The memory can have access to several jobs in one go. They will be executed in a particular order at a specific time.

Multitasking Operating System – The name itself should indicate that this is an operating system that executes multiple tasks on a single processor. The processor switches the processes at a faster pace.

Real-time Operating System – A specified time is allotted for each of the jobs and handled independently of other operations. This can help you in areas such as military operations and satellites.

Multiprocessing Operating System – The operating system involves the use of multiple processors. Multiple processors are handled by the multiple processors. This will make use of more than one processor at a time.

What is Belady’s Anomaly?
The Belady’s Anomaly is also referred to as FIFO Anomaly. Ideally, an increase in the number of frames allocated to a process virtual memory helps us in the faster execution of a process. This is done to ensure that the page faults would be extremely lower. However, there are situations where the number of increased frames would increase the number of page faults. This is precisely what is called a Belady’s Anomaly.
What are the different scheduling algorithms?

Some important and widely used scheduling algorithms would include:

  • First-Come, First-Served (FCFS) Scheduling.
  • Shortest-Job-Next (SJN) Scheduling.
  • Priority Scheduling.
  • Shortest Remaining Time.
  • Round Robin(RR) Scheduling.
  • Multiple-Level Queues Scheduling.
What is Thrashing?
If the performance of a computer degrades over time, this is called Thrashing. This can happen when a computer needs to spend more time in addressing the faults than in executing the transactions. The faults make more processes to be addressed at the paging device. As the queue at the paging device goes on increasing, the service time for the page fault further increases.
What is starvation in an Operating System?
Starvation is a scenario in an operating system where a resource management is affected. When the starvation occurs in an operating system, a process that has been waiting for a resource does not get it for a longer period of time. This happens because of the resources ae allocated to the other processes.
What is a Banker’s Algorithm?
The Banker’s Algorithm is used for the sake of addressing a deadlock and avoiding it. The algorithm is named Banker’s Algorithm because it never allocates the cash until it meets the needs of all its customers.
Why is Ubuntu a safer operating system?

There are several reasons that make Ubuntu a safer operating system. Some of them can be

  • It does not suffer from malicious emails. Each of the emails goes through several security checks.
  • It makes use of Linux, which has been considered to be the secure operating system.
  • A vast number of Linux users can check the code and fix the faults if any.
What are the different types of CPU registers in a typical operating system design?

Here are a few different types of CPU registers in an operating system –

  • Accumulators
  • Index Registers
  • Stack Pointer
  • General Purpose Registers
What is fragmentation, and what are the types of fragmentation available?

Fragmentation is where a memory wastage occurs. Space is used is a very inefficient manner, and that is precisely what would make it provide a reduced performance and capacity.

There are two types of fragmentations –

Internal fragmentation occurs with the systems that have fixed size allocation limits

External fragmentation occurs with the systems that have a variable allocation unit.

What are different types of Kernels?

There are three major types of Kernels –

  1. Monolithic Kernel is a full-fledged kernel that provides support for all the services that are running.
  2. MicroKernel is a limited kernel that lets only a few essential services to run.
  3. Hybrid Kernel is the one that combines the properties of both monolithic kernel and microkernel.
What are the Pros and Cons of an Operating System?
A Command Line interface is what would help you enter the commands so that you can get access to immediate results. Advanced computer experts use a command-line interface as they find it rather easier and quicker. However, you would need to have a familiarity with the commands.

You would also need to have access to the switches and other parameters related to the commands. Memorising the commands may not be a perfect option.

What is a Thread, and How Does it Differ from a Process?
A thread is a part of a process. In fact, a thread is a single sequence stream within a process. The threads have the properties of the entire process, and thus are referred sometimes as the lightweight processes as well. In case of a browser, for instance, a single tab is a thread of a more extensive process called the browser. A word processor as a process has different threads used for handling separate threads for formatting the text, processing the inputs and similar other processes.
What are the Different Sections of a Process?

A process has four main sections.

Stack – the section consists of local variables and will return the address.

Heap – This involves the dynamically allocated memory through malloc, realloc and calloc.

Data – this section will include global and static variables.

Code or Text – this section consists of code, program counter and content of processor’s register.

What is virtual memory, and how can it be implemented?
Virtual memory creates an illusion so that each of the users will have their own contiguous address space. The size of such virtual memory can be extremely high. The primary purpose of using the virtual memory is to use the disk space for extending the RAM. This will help running processes to get enough RAM for executing the functions.
What is a Zombie Process?
A Zombie process is the one that has completed its task and has already terminated. But it continues to have its entry in the process table. This holds up the resources, and thus they will not be available for other processes.

Recommended Reading – C# Interview Questions & Answers

This was regarding the different types of operating systems in general, now let us see a few disk management in Linux interview questions with answers.

Disk Management in Linux Interview Questions

What is the difference between LVM1 and LVM2?
This is one of the frequently asked questions in Linux Interview. LVM stands for Logical Volume Manager. It is a widely used volume manager in Linux. LVM1 and LVM2 are the two different versions of the volume manager. LVM1 was included in the 2.4 series kernels. The LVM2 was added in 2.6 series kernels.
What are the different RAID levels?

The different types of RAID levels can include

  • 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
What are the filesystem used in Rhel 5 and Rhel 6?
ext3 for RHEL 5 and ext4 for RHEL 6
What is the procedure you follow to extend an LVM partition?

The process will include the following procedure –

lvextend -L +1G /dev/VolGroup/LogVol1

This will extend the partition size by +1 GB

resize2fs /dev/VolGroup/LogVol1

What are the Linux specific partition types?

      0x82                     >          Linux swap

      0x83                     >          Linux

     0x8e                      >          Linux LVM

      0xfd                      >          Linux RAID auto

      0x5                        >          Extended

      0xf                         >          Windows partition

How many partitions are supported by Linux?

The maximum number of partitions supported by Linux Kernel is:

63 for IDE drives

15 for SCSI drives

How to create a filesystem in Linux?

The mkfs command is used to create the filesystem.

mkfs.ext2 / mkfs.ext3     >          To create ext2/ext3 filesystem

mkfs.minix                       >          minix filesystem

mkfs.msdos                      >          MS-DOS filesystem

Your technical interview may also consist of MCQs. Let us see a few Linux MCQ questions along with correct answers as an example.

Linux MCQ Questions with Answers

If you are attending an interview for the OS related job, some organizations also hold a written test that has Multiple Choice Questions or MCQs. Some such MCQs can be a great option to check out –

Q – What will command mknod myfifo b 4 16 execute?

a) Will create a block device if user is root

b) Will create a block device for all users

c) Will create a FIFO if user is not root

d) None of the mentioned

Answer – a 

Q – At the start of process execution, what do STDOUT & STDERR do?

a) Point to the current terminal device

b) Are closed

c) Point to special files on the system

d) None of the mentioned

Answer – a 

Q – What do wtmp and utmp files contain?

a) Temporary system data

b) User login-logout log

c) The user’s command execution log

d) The user’s su and sudo attempts

Answer – b 

Q – Which is the core of the operating system?

a) Shell

b) Kernel

c) Commands

d) Script

Answer – b 

Q – Applications communicate with the kernel by using-

a) System Calls

b) C Programs

c) Shell Script

d) Shell

Answer – a 

Q – Which of the following timestamps need not exist for a file on the traditional UNIX file system?

a) Access Time

b) Modification Time

c) Creation Time

d) Change Time

Answer – c

Q – Binary or executable files are:

a) Regular files

b) Device files

c) Special files

d) Directory files

Answer – a 

Q – Which of the following is not a valid file type on Linux?

a) Socket

b) Softlink

c) Inode


Answer – c 

Conclusion on OS (Linux & Other OS) Viva Questions

Well, those were a few questions and answers that should be helpful enough in answering your interviews with confidence. In fact, it may not be much easy to compile all the questions you may come across when preparing for an OS Viva interview. However, we assume the questions featured here should ideally provide you with enough idea into what types of questions can you expect other than those asked in personal round wherein you have to introduce yourself.

That way, you would be able to get access to the right type of preparation to crack the interview on OS Viva questions be it for disk management in Linux or any other OS.

About the author

Atish Ranjan

Hi there, I am Atish Ranjan! I have been into work and business for more than 11 years now; I have given and taken numerous interviews over the years.
Thus, I started to share my knowledge & experience with you! Hope you enjoy reading here.

About the Author

Hi there, I am Atish Ranjan! I have been into work and business for more than 11 years now; I have given and taken numerous interviews over the years. Thus, I started to share my knowledge & experience with you! Hope you enjoy reading here.