For job perusing persons, the interview plays a vital part. We may land on the job only based on how we answer the OS interview questions in a witty manner. The operating system is an important subject or part of the computer science engineering course. If you are looking for a job other than IT you must know OS pretty well.
So, in this article, we will discuss OS interview questions and how to crack those. Let’s do it! Here the questions are separated to the relevant topics and not to the accurate level.
First, let’s discuss the most fundamental and basic part and then we will dive deeper into the topics.
Basic OS Interview Questions
So, let’s start with simple definitions and purpose which are important to OS Interview Questions.
What is an OS?
The Operating System is a software program that facilitates computer hardware to operate and communicate with computer software. It is more like an intermediator. Without OS, the computer can’t function.
Main purpose of OS?
It has two main functions.
- It makes sure that the computer performs well by managing all the computational activities.
- Provides an environment for developing and executing programs.
What are the different OS available?
- Batched operating systems
- Distributed operating systems
- Timesharing operating systems
- Multi-programmed operating systems
- Real-time operating systems
Name some functions of the Operating system.
- Memory management
- Processor management
- Device management
- File management
- Job accounting
- Control over system performance
- Error detection
- Communicate between user and software
- Communication between software and hardware.
These are the very basic ones. Now let’s go for the next level.
What is a process?
An executing program is known as a process. Simply put it is an instance of a program. The different types of processes include user processes and operating system processes.
What are different states of a process?
- New State – means a process is being created
- Running – means instructions are being executed
- Waiting – means a process is waiting for certain conditions or events to occur
- Ready – means a process is waiting for an instruction from the main processor
- Terminate – means a process is stopped abruptly
What is a process table?
To keep track of all the process going on the operating system maintains a table known as process table.
Difference between process and program
A program is set a set of codes while process is that code being in executing state.
It is a single sequence stream within a process. It occurs simultaneously when a process is being executed. They are also called lightweight process. It is a great way of improving parallelism.
Components of thread
A thread consists of thread ID, program counter , register set and a stack.
What is a daemon?
It is a type of thread which runs automatically in system. This happens without the knowledge of the user.
Advantages of multi-threaded programming
- Enhance the responsiveness to the users.
- Resource sharing within the process.
- Completely utilize multiprocessing architecture.
What is SMP?
SMP stands for Symmetric Multi Processing. It is the most common type of multiple processor system. Each processor runs an identical copy of the operating system, and these copies communicate with one another when required.
What is a kernel?
Kernel is the most important aspect in an operating system. It provides the basic services for all parts of OS.
Describe monolithic kernel
It is just a kernel which provides all the operating system in single executable picture.
It is a kernel that runs minimal performances affecting the operating system services. In a micro kernel system, the process is done by the processor.
This is nothing but the combination of both micro and monolithic kernel.
What are the disadvantages of Microkernels?
The disadvantages are based on the below situations.
- Poor performance
- Fixing bugs is difficult.
What is deadlock?
Deadlock is a situation in which a process waits for another process to share the resource which in turn waits for another. This kind of situation leads the system to hang and crash. It is best to avoid and recover deadlock.
Condition to satisfy deadlock
There are four conditions which needs to be satisfied to get a deadlock.
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 are 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 the next process in the chain.
What is Banker’s algorithm?
This is an algorithm widely used for avoiding deadlock. It is also one of the deadlock avoidance methods. It is based on the banking system ang hence the name. The bank never allocates cash in a manner such that it can’t satisfy the customers. The idea for the algorithm is also the same.
Enumerate the different RAID levels.
- RAID 0 – Non-redundant striping
- ONE – Mirrored Disks
- TWO – Memory-style error-correcting codes
- THREE – Bit-interleaved Parity
- FOUR – Block-interleaved Parity
- FIVE– Block-interleaved distributed Parity
- SIX– P+Q Redundancy
What is CPU scheduling?
CPU scheduling is a process that determines which process should be assigned to the CPU and which process needs to be on hold.
Various scheduling algorithms
- FCFS – First Come First Serve
- Round Robin
- SJF -Shortest Job First
- SRTF – Shortest Remaining Time First
- Priority Scheduling
Describe about the scheduling in two lines
- FCFS -As the name suggests the process which arrives first, will be executed by the CPU. It can be both pre-emptive and non-pre-emptive.
- Round robin – This process takes place in a circular queue fashion. The process will be executed for a certain amount of time and then pre-empts to the queue and the next process carries in.
- SJF- The jobs are executed according to the size of the process. The shortest job gets executed first here. It is non-pre-emptive.
- SRTF – This is nothing but Shortest Job First with pre-emption. Here the CPU executes the shortest job first for 1 quantum of time, the process gets preempted and the next process comes into action.
- Priority – The CPU executes the process based on the priority of the process. In most OS, the lower the number higher the priority.
- Multilevel- Here the process is assigned into a separate queue. The process is assigned permanently to one queue based on the property of the process or memory size.
What is the difference between job and CPU scheduling?
- JOB scheduling – Decides which process should be brought to the ready queue.
- CPU scheduling – Decides which process should execute next and allocates to the CPU.
Definitions related to scheduling output
What is Throughput, Turnaround time, waiting time and Response time?
- Throughput – number of processes that complete their execution per time unit
- Turnaround time – amount of time to execute a particular process
- Waiting time – amount of time a process has been waiting in the ready queue
- Response time -amount of time it takes from when a request was submitted until the first response is produced, not output (for time-sharing environment)
What is time slice?
The timer in CPU is set to interrupt every N milliseconds. This n is the time slice. It is the time each user gets to execute before control is given to next user.
What is fragmentation?
It is nothing but a wastage of memory. It also reduces the capacity and performance of the system space are used in an inefficient manner.
Types of fragmentation
- Internal fragmentation – It occurs when we deal with a system that has fixed size allocations alone.
- External fragmentation – It occurs when we deal with a variable size allocation system.
Address and Memory Questions
What is virtual memory?
Virtual memory is a very useful memory management technique. It enables processes to execute outside of memory. This technique is especially used when an executing program cannot fit in the physical memory.
What is cache memory?
Cache memory is random access memory (RAM) that a computer microprocessor can access more quickly than it can access regular RAM. It is said to be the fastest memory in the system.
What is Direct Access Method?
Direct Memory Access(DMA) transfers blocks of data between memory and system without the use of the processor.
Difference between physical and logical address
- Logical address – This is the address generated by the CPU.
- Physical address – Specifies to the address which is seen by the memory unit.
What is Memory-Management Unit (MMU)?
A hardware device that maps virtual to a physical address. In the MMU scheme, the value in the relocation register is added to every address generated by a user process at the time it is sent to memory.
The user program deals with logical addresses; it never sees the real physical addresses.
What is paging?
Paging is a memory management scheme used by computers. It is for storing and retrieving data from secondary storage use in main memory.
What is the use of paging in operating system?
The use of paging is to solve the external fragmentation problem in the Operating System. This technique ensures that the data you need is available as quickly as possible.
What is the concept of demand paging?
This specifies if memory is not in use, then the memory is swapped to disk to make the space available for other applications.
What is trashing and when does it occur?
Thrashing specifies the instance of high paging activity. Thrashing occurs when the system spends more time on paging rather than executing.
When does page fault error occur?
It occurs when a page which is not in memory is accessed.
Other OS Interview Questions
some other most important OS Interview Questions
What are overlays?
Overlays make 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.
What is starvation in Operating System?
Starvation is a resource management problem. This occurs when a process does not get the requested resource as it is being used by another resource. This occurs in a waiting process when it waits for a long period of time.
What is aging ?
Aging is a technique for avoiding the starvation in resource scheduling system.
What is spooling?
Spooling is a process in which data is temporarily gathered for use and execution by a device, program, or system. It associates with printing. When different applications send output to the printer at the same time, spooling keeps these all jobs. This is done by moving the jobs into a disk file and queues them accordingly to the printer.
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 multiple users who can share a single copy of the program during the same period.
What is a socket?
A socket is a connection between two applications. Each endpoint of an application is a socket.
What is the difference between internal commands and external commands?
- Internal commands – These commands are an in-built part of the operating system.
- External commands – These commands are separate program files. They are stored in a separate folder or directory.
What is semaphore?
Semaphore is a protected variable or an abstract data type used for locking the resource which is currently in use. The value of the semaphore indicates the status of a common resource.
Types of semaphore
The two types are,
- Counting Semaphore
- Binary Semaphore
What is a binary Semaphore?
Binary semaphore takes only 0 and 1 as value and used to implement mutual exclusion and synchronize concurrent processes.
What is Belady’s Anomaly?
Belady’s Anomaly is also called the FIFO anomaly. Usually, on increasing the number of frames allocated to a process virtual memory, the process execution is faster. This is because fewer page faults occur. Sometimes, the reverse happens. 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.
What is a folder in Ubuntu?
There is no such concept in Ubuntu. Everything is stored in the form of file.
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 virus codes take advantage of the weakness in Windows.
Explain what is Unity in Ubuntu? How can you add new entries to the launcher?
Unity is the default graphic shell. In order to add new entries to the launcher, you can create a file name like .desktop and then drag the file on the launcher.
Explain how to access Terminal?
To access the terminal, you have to go under Application Menu -> Accessories -> Terminal.
Explain how you can reset Unity Configuration?
The simplest way to do is to hit open a Terminal or hit Atl-F2 and run the command # unity –reset.
What is the meaning of “export” command in Ubuntu?
Export is a command in Bash shell language. When you try to set a variable, it is visible or exported to any subprocess started from that instance of bash. The variable will not exist in the sub-process without the export command.
Interpreter and Compiler Questions
What is a command interpreter?
It is a program that interprets the command input through the keyboard. It also takes input through a command file. The interpreter helps the user interact with the OS.
- Control card interpreter
- Command-line interpreter
- Console command processor
What is a compiler?
A compiler is a program that takes a source code as an input and converts it into an object code.
Differentiate between Complier and Interpreter?
An interpreter reads one instruction at a time and carries out the actions implied by that instruction. It does not perform any translation. But a compiler translates the entire instructions.
What is a library?
It is a file which contains object code for subroutines and data to be used by the other program.
An assembler act as translators for low-level words. The Assembler translates assembly codes written using mnemonic authorities into mechanism language.
Simpler OS Interview Questions
Other OS Interview Questions
It stands for graphical user interface. It provides an environment for the easy interaction of the user and the system. An example is Windows are GIU based. When interact easily by just clicking the icons.
NOS is short for Network Operating System. It is dedicated software that will permit a computer to converse with other devices over the complex, including folder sharing.
What is the piping
It is the procedure of using the output of one plan as an input to another.
What is a trap and trapdoor?
The trapdoor is a secret undocumented entry point into a program used to grant access without normal methods of access authentication. A trap is a software interrupt, usually the result of an error condition.
What is plumbing?
Plumbing is just another term used instead of piping. Don’t get confused by such questions.
What is a Real Time System?
A realt ime process is a process that must respond to the events within a certain time period. A real time operating system is an operating system that can run real time processes successfully.
What is Asymmetric clustering?
Asymmetric clustering when the running server finds some cluster. In this situation, one server tries to run over the other when others remain idle or stand by mode.
What is Booting?
It is a procedure of turning on the computer by loading the Kernel.
What is the Bootstrap program?
The bootstrap program is the first program to be executed when we turn on or boot the computer. It resides in kernel. It stores only the read only memory (RAM).
What is the difference between Multitasking and Multi-processing ?
- In this, the system performs more than one task just by using a single processor.
- Takes moderate time to execute.
- The processor shift from one task to another making it look like executing multiple tasks. But it is not.
- Here the system performs more than one task using multiple processors.
- Takes a very small amount of time to execute.
- Here we have many processors, so many tasks can be executed.
Differentiate between paging and segmentation.
- Paging divides the virtual memory into physical memory.
- It divides memory in fixed length.
- Only loads information about the process.
- It is smaller than the segments.
- Segmentation divides the physical memory into logical memory.
- It divides memory according to the need.
- Loads the full logical section of the page.
- It is larger in size.
What is IPC?
IPC stands for Inter-Process Communication. It is a way in which many processes can communicate with each other.
Name the Various IPC mechanisms.
- Shared Memory
- Message Queues
What is Context Switch?
This is nothing but when the CPU switches from one process to another. It is best to avoid as many context switches as possible. Context refers to data in register.
What are interrupts?
These are signals coming from outside source to stop the ongoing activity. Interrupts use context switching.
As told first, this is one of the important parts of cracking the interview. Anyone can code and crack the programming section easily. But what makes you stand out in the interview is these types of core related knowledge. We have discussed OS Interview Questions. Hope this article helped and continues to help you even in the future. Never stop learning, Grow by learning, and happy coding!