Here are the top 50 commonly asked questions in operating system interviews. Whether you’re just starting your preparation or need a quick refresher, these questions and answers will help you tackle your interview with confidence.
Basic OS Interview Questions with Answers
1. What is an operating system?
An operating system is an interface between user and computer hardware. It is the software that manages computer hardware and provides services for software applications. It handles tasks like allocating resources, managing processes, controlling memory, handling files, managing devices, and providing user interfaces. Examples include Windows, macOS, Linux, iOS, and Android.
2. What is exec() system call in operating system?
To change the memory space of a newly created process (using a fork() system call), exec() system call is used. The file having the program is provided as a parameter.
3. What is wait() system call in operating system?
When a parent process calls the wait() system call, its execution is suspended until the child process execution gets terminated. Once the child process terminates, the PID and exit status of the child process is returned to the parent process.
4. What are the services provided by an operating system?
Operating system services include process management, memory management, resource management, storage management, protection and security.
5. What is kernel in operating system?
The words operating system and kernel are used interchangeably. Kernel is an infinite program which runs at all times on the computer.
6. What is the goal of an operating system?
The primary goal of an operating system is convenience. The secondary goal of an operating system is efficiency.
7. What is an open source operating system?
Those operating systems which are available in source code format i.e. their code can be accessed and modified are known as open source operating systems.
8. What are some open source operating systems?
Open source operating systems include GNU Linux and BSD UNIX.
9. What are system calls in operating system?
System calls are the requests made by the user program in order to get any kind of service from the operating system. System calls are thus a medium to use the services provided by an operating system.
10. How is operating system loaded into memory?
As the power is turned on, the CPU fetches BIOS instructions from the ROM into the main memory which starts the bootstrap program. It then finds the kernel, loads it into memory and transfers control to the operating system.
11. What is distributed operating system?
Users can share resources among physically separate hosts connected by a computer network in distributed systems. The two models of distributed systems are client–server model and peer–peer model.
12. What are the advantages of multiprocessor operating systems?
Multiprocessor operating systems have increased throughput, increased reliability and are economical.
13. What is an operating system trap?
Operating system trap or interrupt shifts the operation from user mode to kernel mode. It is either caused by an error or by a request from a process for some service from operating system.
14. How does an operating system manage memory?
Memory management includes keeping a record of parts of memory and the processes using them. It also includes swapping and allocating frames.
15. How does an operating system manage storage?
Operating system manages storage by keeping files and directories in a file system. It is also responsible for managing free space on the disk.
16. How does an operating system ensure correct operation of the computer system?
Operating systems ensure correct operation of computer system with the help of dual mode operation (user and kernel mode), privileged instructions (executed only in kernel mode) and timer interrupts.
17. How does an operating system manage processes?
Operating system helps in the creation of processes, deletion of processes, inter process communication, scheduling and synchronization of processes.
18. What is the utility of real-time operating systems?
A major utility of real-time operating systems is in embedded systems like consumer devices, automobiles and robotics.
19. How does an operating system provide convenience to the user?
Operating system provides a user interface and performs program execution, I/O operations, file system manipulation and error detection which makes using a computer convenient for a user.
20. How does an operating system ensure efficiency?
Operating system performs functions like resource allocation, accounting, protection and security which ensure efficiency.
Intermediate OS Interview Questions with Answers
21. What is a process?
A process is a program under execution i.e. the program in main memory executing on the CPU. A process is active and dynamic.
22. What is a thread?
A light weight process, which shares all the resources except stack and registers is called as thread.
23. What are frames and pages?
In paging, the physical address space is divided into equal sized parts called frames and the logical or virtual address space is divided into equal sized parts called pages. The page size is equal to the frame size.
24. How can a deadlock be avoided?
Deadlock can be avoided by using banker’s algorithm. Whenever a request for resources is made by a process, banker’s algorithm grants the request immediately only if the system is in a safe state after granting the request. Otherwise, the process is made to wait.
25. What is the purpose of multilevel paging?
In paging, when the page size is large (so the number of memory accesses required increases), to reduce the effective memory access time, multilevel paging is used.
26. What is a dispatcher responsible for?
Dispatcher is responsible for loading the selected process (by the short-term scheduler) onto the CPU and performing context switch.
27. What is internal fragmentation?
In fixed partition memory management techniques (like contiguous memory allocation with fixed partitions and paging), the process doesn’t always fit exactly into the partition. Some space is wasted due to fixed size of partitions. This is called internal fragmentation.
28. What is external fragmentation?
In contiguous memory management techniques (fixed and variable partition scheme), the situation when the total free space available is greater than or equal to the process size, but is not contiguous so cannot be allocated to the process, is known as external fragmentation.
29. What is race condition?
When the output depends on the order of execution of several processes (or speed of execution), it is termed as race condition. It can only occur when the processes are coordinating and not independent.
30. What is a critical section?
The section of a process in which it accesses shared variables or shared resources is known as critical section. To ensure proper execution, only one process, at a time, should be executing in its critical section.
31. What is the need of synchronization?
Synchronization of coordinating processes is necessary for proper execution. Absence of synchronization may lead to problems like loss of data, unexpected output and deadlock.
32. What is a context switch?
In multiprogramming OS, when a process scheduled onto CPU leaves the CPU for I/O or its time quantum expires, to be able to continue the execution from the exact point later, the context (values of registers like PC) are saved into PCB of the process and the context of another process is loaded onto CPU. This is called context switch.
33. What is address binding?
Association of program instructions and data with the actual physical addresses is known as address binding. Address binding could be compile-time, load-time or execution-time.
34. When is a process termed as orphan?
The resources of a child process are deallocated when it completes its execution but its entry in the process table is not deleted until the parent process calls the wait() system call. If the parent terminates without calling wait(), the child process is termed as orphan.
35. What is the goal of virtual memory?
Virtual memory makes it possible for the program size to be larger than the size of the main memory. Parts of the large program are swapped in and out of the main memory into the virtual memory space.
36. What conclusion can be drawn if the resource allocation graph with only single instance type resources has a cycle?
Resource allocation graph can be used for deadlock detection. When a resource allocation graph with only single instance type resources has a cycle, it implies that deadlock has occurred.
37. What are semaphores?
Semaphores are integer variables, whose values once initialized, can be modified only by two atomic operations, wait() (or P() or down()) and signal() (or V() or up()). Counting semaphores can take any integer value while binary semaphores can take only two values, 0 and 1. Semaphores, when used properly, lead to synchronization of the processes.
38. What does a long-term scheduler do?
A long-term scheduler, or job scheduler, selects a good mix of I/O bound processes and CPU bound processes from new state to load into main memory in the ready state.
39. What is the job of a short-term scheduler?
A short-term scheduler, or CPU scheduler, selects one process from the ready state, to execute on the CPU, according to the scheduling algorithm.
40. What is medium-term scheduler responsible for?
When there is a lack of resources, some processes are suspended and swapped from main memory into secondary memory. This is done by the medium-term scheduler.
41. What is a solution to the problem of external fragmentation?
Compaction is a solution to the problem of external fragmentation in which all the memory partitions which are occupied are moved towards one end of the memory so that contiguous free space is created at the other end. It is not always possible and adds a time overhead.
42. How is security ensured using dual mode of operation?
To ensure security, dual mode (user and kernel mode) of operation is used. The privileged instructions execute only in the kernel mode while the non-privileged instructions execute in the user mode.
43. What is convoy effect?
When a longer process is scheduled before short processes, the overall device and CPU utilization is lower than what it could have been if the shorter processes were scheduled first. This is termed as convoy effect. It can occur in the FCFS CPU scheduling algorithm.
44. What is Belady’s anomaly?
Belady’s anomaly is possible in the FCFS and random page replacement algorithms. It is the situation when on increasing the number of frames, the number of page faults also increase.
45. When is the request of a process immediately granted while using banker’s algorithm?
Safe sequence is the sequence in which the remaining need of all the processes can be satisfied. If at least one safe sequence exists, the system is said to be in a safe state and the request of the process is granted.
46. What is a solution to the problem of starvation in process scheduling algorithms?
Aging is used to overcome starvation problem in priority scheduling algorithms. As the waiting time of a process increases, its priority is also increased. In this way, the waiting time is not indefinite and starvation is not possible.
47. What is a multicore processor?
In multicore processors, multiple processing cores are placed on the same chip. They are faster and consume less power.
48. What is preemptive multiprogramming?
In preemptive multiprogramming, a process executing on the CPU can be preempted if a higher priority process arrives in the ready queue or if the time quantum expires.
49. What is non-preemptive multiprogramming?
In non-preemptive multiprogramming, when a process is scheduled to execute on the CPU, another process will be scheduled only when the process currently executing either terminates or blocks for I/O.
50. What is PTBR?
PTBR or page table base register stores the base address of the page table of the process. It is stored in PCB (process control block).
Useful Resources: