1. What is the primary role of an operating system (OS)?
Difficulty: EasyType: MCQTopic: OS Basics
- To provide user applications only
- To manage hardware and software resources for efficient execution
- To replace all application software
- To provide only a graphical interface
The operating system acts as the intermediary between hardware and application software. It manages resources like CPU, memory, and I O so applications can run efficiently and correctly.
Correct Answer: To manage hardware and software resources for efficient execution
2. Which of these is a type of operating system?
Difficulty: EasyType: MCQTopic: OS Basics
- Batch operating system
- Spreadsheet operating system
- Database operating system
- Office operating system
Operating systems can be classified by how they manage tasks: batch, time-sharing, real-time, etc. A batch operating system schedules jobs without manual intervention.
Correct Answer: Batch operating system
3. What is the role of a kernel in an OS?
Difficulty: MediumType: MCQTopic: OS Basics
- It provides user interface only
- It manages core system resources and services
- It runs only user applications
- It is an optional component of the OS
The kernel is the heart of the OS. It handles resource management, process scheduling, memory control, device I O and communication between hardware and software.
Correct Answer: It manages core system resources and services
4. Explain the difference between a process and a thread.
Difficulty: MediumType: SubjectiveTopic: Process Mgmt
A process is an independent program in execution. It has its own memory space, resources, address space. A thread is a smaller unit of execution within a process. Threads share the same address space and resources of their parent process but have their own program counter and stack. Using threads is lighter weight, faster to switch between, and useful for concurrency inside a process, but you must handle synchronization carefully.
5. Which of the following is *not* a typical state in a process lifecycle?
Difficulty: EasyType: MCQTopic: Process Mgmt
- Running
- Ready
- Blocked
- Interrupted
Typical process states are running (using CPU), ready (waiting for CPU), waiting or blocked (waiting for I O or event). "Interrupted" is not normally listed as a standard state in the lifecycle model.
Correct Answer: Interrupted
6. What is a system call and why is it important?
Difficulty: MediumType: SubjectiveTopic: System Calls
A system call is the mechanism by which a user program requests a service from the kernel of the operating system. It allows safe transition from user mode to kernel mode to execute privileged operations like file I O, process control or creating threads. It is important because it enforces protection, isolates user code from kernel code, and enables resource management.
7. What is multiprogramming in operating systems?
Difficulty: MediumType: MCQTopic: CPU Scheduling
- Running multiple programs at exactly the same time on one CPU
- Running a single program at a time
- Having multiple operating systems on one machine
- Switching between programs so CPU is always busy
Multiprogramming is the technique where the OS keeps multiple programs in memory and switches between them so the CPU is busy when one program waits for I O. It improves utilization of the CPU.
Correct Answer: Switching between programs so CPU is always busy
8. Explain what a time-sharing system is.
Difficulty: EasyType: SubjectiveTopic: CPU Scheduling
In a time-sharing system the CPU switches among many users’ interactive tasks rapidly, giving the illusion that each user has their own machine. The OS allocates short time slices to tasks and context switches quickly. It improves responsiveness for many users.
9. Which of these is *not* an inter-process communication (IPC) mechanism?
Difficulty: HardType: MCQTopic: Process Mgmt
- Message passing
- Shared memory
- Pipes
- Virtual memory
IPC mechanisms include message passing, shared memory, pipes, sockets etc. Virtual memory is a memory management technique, not a communication mechanism between processes.
Correct Answer: Virtual memory
10. What is a Process Control Block (PCB) and what information does it store?
Difficulty: MediumType: SubjectiveTopic: Process Mgmt
A PCB is a data structure used by the OS to keep track of each process. It stores process identifier (PID), process state, program counter, register values, memory limits, list of open files, scheduling information and more. The OS uses the PCB to resume and manage processes.
11. What is a bootstrap program in an OS context?
Difficulty: MediumType: MCQTopic: OS Basics
- A program that runs user tasks after login
- The code that loads the kernel when the computer boots
- A process scheduler
- A virus scanning utility
The bootstrap program is the initial code run when a machine starts (after BIOS or firmware). It loads the operating system kernel into memory and starts execution of the OS.
Correct Answer: The code that loads the kernel when the computer boots
12. What is a zombie process and how does it arise?
Difficulty: HardType: SubjectiveTopic: Process Mgmt
A zombie process is a process that has finished execution (exit) but still has an entry in the process table because its parent has not yet read its exit status (via wait). It arises when the child ends but the parent hasn’t yet called wait, so the OS cannot release the PCB until the parent does so.
13. Which statement correctly describes the main difference between a process and a thread?
Difficulty: EasyType: MCQTopic: Process Mgmt
- A process shares its address space with other processes; a thread has its own address space
- A thread is a separate program in execution; a process is part of another program
- A process has its own memory and resources; a thread shares memory with its parent process
- Processes and threads are identical in how they use system resources
A process is an independent execution unit with its own address space and resources. A thread is a lightweight unit within a process that shares that address space and resources but has its own stack and program counter. This enables threads to communicate more easily and switch faster, but also means we must handle synchronization carefully when using threads.
Correct Answer: A process has its own memory and resources; a thread shares memory with its parent process
14. What is a Process Control Block (PCB) and what key information does it hold?
Difficulty: MediumType: SubjectiveTopic: Process Mgmt
A Process Control Block, or PCB, is a data structure used by the operating system to store all information about a process. It holds the process identifier (PID), process state (such as ready, running, waiting), CPU register values, memory limits, list of open files, scheduling information like priority or quantum, and pointers to parent and children processes. The OS uses the PCB when it needs to switch into or out of a process, resume the process later, or manage its resources.
15. Which of the following is *not* typically considered a direct state in the process lifecycle?
Difficulty: EasyType: MCQTopic: Process Mgmt
- Running
- Ready
- Waiting
- Suspended
Standard process states are Running (executing on CPU), Ready (waiting for CPU), and Waiting/Blocked (waiting for I/O or event). "Suspended" is used in some systems as an additional state when the process is swapped out, but it is not part of the classic simple lifecycle model.
Correct Answer: Suspended
16. What are the main goals of CPU scheduling in an operating system?
Difficulty: MediumType: SubjectiveTopic: CPU Scheduling
CPU scheduling aims to optimise several metrics so the system runs efficiently and fairly. These goals include maximising CPU utilization (keeping the CPU as busy as possible), maximising throughput (number of processes completed per unit time), minimising turnaround time (time from submission to completion), minimising waiting time (time a process waits in the ready queue), and minimising response time (time from request submission to first response) especially in interactive systems. An operating system must balance these often-competing goals when choosing its scheduling algorithm.
17. Which scheduling algorithm can lead to starvation of a process if implemented without safeguards?
Difficulty: HardType: MCQTopic: CPU Scheduling
- First-Come-First-Served (FCFS)
- Shortest Job First (SJF) non-preemptive
- Round Robin (RR)
- Priority scheduling without aging
In priority scheduling, if processes with low priority keep arriving, then a low priority process might never get CPU time. Without an aging mechanism (which increases priority over time), starvation becomes possible. FCFS and non-preemptive SJF will eventually serve everyone; Round Robin gives each process a time slice so starvation is less likely.
Correct Answer: Priority scheduling without aging
18. Describe what a context switch is and why minimizing context‐switch time is important.
Difficulty: MediumType: SubjectiveTopic: CPU Scheduling
A context switch is the process of saving the state of the currently running process (such as register values, stack pointer, program counter) into its PCB and then loading the state of another process so it can run on the CPU. This lets the OS switch the CPU from one process to another. Minimising context switch time is important because each switch incurs overhead—saving and loading registers, updating memory maps, flushing translation lookaside buffers (TLB), and switching caches. High context‐switch overhead reduces CPU efficiency and can degrade overall system performance.
19. What does multiprogramming in an operating system aim to achieve?
Difficulty: MediumType: MCQTopic: CPU Scheduling
- Execute a single program at a time with full CPU access
- Run multiple programs simultaneously on multiple CPUs only
- Keep the CPU busy by switching among programs when I/O waits occur
- Allow only I/O bound programs to execute
Multiprogramming allows multiple programs to be in memory at once. When one program is waiting for I/O, the CPU switches to another program so the CPU stays busy. This improves utilization of the CPU and overall throughput in a system with serial I/O operations.
Correct Answer: Keep the CPU busy by switching among programs when I/O waits occur
20. Explain the difference between preemptive and non-preemptive CPU scheduling with examples.
Difficulty: HardType: SubjectiveTopic: CPU Scheduling
In preemptive scheduling the operating system can interrupt a running process (for example when its time slice expires or a higher priority process arrives) and switch to another process. For instance, Round Robin and priority with preemption are preemptive algorithms. Non-preemptive scheduling means once a process starts running it will continue until it finishes or blocks for I/O; the OS does not forcibly take the CPU away. First-Come-First-Served (FCFS) and non-preemptive SJF are examples. Preemptive gives better responsiveness but adds overhead from context switches; non-preemptive is simpler but may lead to worse response times and poor handling of interactive tasks.
21. Which of the following is *not* a classic inter‐process communication (IPC) mechanism?
Difficulty: HardType: MCQTopic: Process Mgmt
- Shared memory
- Message queue
- Semaphore
- Virtual memory
Classic IPC mechanisms include shared memory, message queues, pipes, sockets and semaphores. Virtual memory is a memory management technique, not an inter‐process communication channel.
Correct Answer: Virtual memory
22. What is the role of the dispatcher in process scheduling?
Difficulty: MediumType: SubjectiveTopic: CPU Scheduling
The dispatcher is the component of the operating system that gives control of the CPU to the process selected by the scheduler. It performs the context switch, switching from kernel mode to user mode, and jumps to the correct place in the user program to restart it. Its responsibilities include switching context, jumping to user code, and switching to user mode. The time the dispatcher takes (dispatch latency) affects how quickly a ready process begins execution, and therefore influences system responsiveness.
23. What data structure typically holds processes that are ready to execute on the CPU?
Difficulty: EasyType: MCQTopic: CPU Scheduling
- I/O queue
- Ready queue
- Waiting queue
- Termination queue
The ready queue is the data structure or list maintained by the operating system where all processes that are ready and waiting for CPU time reside. The scheduler picks one from this queue to run next. Other queues include waiting (blocked) queue for I/O, and termination queue for completed processes.
Correct Answer: Ready queue
24. In memory management, what is the difference between a logical address and a physical address?
Difficulty: EasyType: MCQTopic: Memory Mgmt
- Logical address is generated by hardware; physical address is generated by user program
- Logical address is the address seen by the process; physical address is the actual location in main memory
- Logical address is always larger than physical address; physical address is used in virtual memory only
- Logical address is used in paging; physical address is used only in segmentation
A logical address is the address that a process uses in its code. It is mapped by the memory management unit to a physical address which is the actual location in RAM. This mapping enables features like virtual memory, memory protection and isolation between processes. :contentReference[oaicite:0]{index=0}
Correct Answer: Logical address is the address seen by the process; physical address is the actual location in main memory
25. Which type of fragmentation occurs when free memory is broken into small pieces and cannot satisfy a process's request even though total free memory is sufficient?
Difficulty: MediumType: MCQTopic: Memory Mgmt
- Internal fragmentation
- External fragmentation
- Logical fragmentation
- Physical fragmentation
External fragmentation happens when the free memory is split into small non-contiguous blocks and so a large request cannot be met although the sum of free memory would suffice. Internal fragmentation is wasted space inside an allocated block. Understanding fragmentation is key to memory management design. :contentReference[oaicite:1]{index=1}
Correct Answer: External fragmentation
26. Explain contiguous memory allocation and discuss its pros and cons.
Difficulty: MediumType: SubjectiveTopic: Memory Mgmt
In contiguous memory allocation a process is allocated one single contiguous block of memory addresses. This makes address translation very simple and fast because the OS just adds an offset to a base address. The major advantage is low overhead in translation and good spatial locality. However the drawbacks include difficulty in fitting processes into memory when free blocks are fragmented (external fragmentation), and limited flexibility—process size must be known ahead and cannot easily grow dynamically. For interview success you can mention techniques like compaction which the OS may use to reduce external fragmentation.
27. Which statement about paging in memory management is true?
Difficulty: HardType: MCQTopic: Virtual Memory
- Paging divides memory into variable sized blocks called segments
- Paging always eliminates both internal and external fragmentation
- Paging allows non-contiguous allocation of physical memory for a process
- Paging does not use a page table to map addresses
Paging divides processes and memory into fixed-sized pages and frames. A process’s pages may reside in non-contiguous frames, which reduces external fragmentation and simplifies allocation. However internal fragmentation may still happen because a page may not be fully used. Paging relies on a page table to map logical pages to physical frames. :contentReference[oaicite:2]{index=2}
Correct Answer: Paging allows non-contiguous allocation of physical memory for a process
28. What is segmentation in memory management and how does it differ from paging?
Difficulty: HardType: SubjectiveTopic: Memory Mgmt
Segmentation divides a process’s memory into logical segments such as code, data, stack or other modules. Each segment may be of variable size and can grow or shrink independently. The key difference from paging is that segments are logical units meaningful to the program, while pages are fixed size and meaningless to the program’s logic. Segmentation can suffer from external fragmentation because segments are variable sized. On the other hand paging reduces external fragmentation but may suffer from internal fragmentation, and segments require more complex management. :contentReference[oaicite:3]{index=3}
29. Which of these best describes virtual memory?
Difficulty: MediumType: MCQTopic: Virtual Memory
- Memory that only exists in secondary storage
- Technique that gives an illusion of larger main memory by using disk and RAM
- Memory that cannot be accessed by user programs
- Memory reserved for kernel only
Virtual memory allows processes to execute even if they are partially in physical RAM by using disk space as an extension and swapping pages in and out. This gives the illusion that the system has more memory than physically present, enables more processes to run, and simplifies memory management. :contentReference[oaicite:4]{index=4}
Correct Answer: Technique that gives an illusion of larger main memory by using disk and RAM
30. Describe demand paging and how it affects system performance.
Difficulty: HardType: SubjectiveTopic: Virtual Memory
Demand paging is a technique where the operating system loads a page into physical memory only when it is needed (that is, when a page fault occurs). This reduces the initial load time of processes and lowers memory usage because only required pages are brought in. However frequent page faults can degrade performance significantly, because loading pages from disk is slow. Too many page faults may lead to thrashing. When designing systems and answering interview questions you should mention trade-offs: reduced memory footprint vs potential high page-fault overhead. :contentReference[oaicite:5]{index=5}
31. In the context of page replacement algorithms, which strategy would replace the page that has not been used for the longest time?
Difficulty: HardType: MCQTopic: Virtual Memory
- First‐In First‐Out (FIFO)
- Least Recently Used (LRU)
- Optimal
- Most Recently Used (MRU)
The Least Recently Used algorithm replaces the page that has been idle longest based on past usage. It approximates the optimal algorithm and helps reduce page faults. FIFO is simpler but may cause more faults; optimal is theoretical; MRU is usually worse in general. Interviewers expect you to know the trade-offs in overhead and complexity. :contentReference[oaicite:6]{index=6}
Correct Answer: Least Recently Used (LRU)
32. What is thrashing in memory management and how can it be prevented?
Difficulty: HardType: SubjectiveTopic: Virtual Memory
Thrashing occurs when the system spends the majority of time swapping pages in and out of memory instead of executing actual processes. It happens when too many processes are active and there are insufficient frames to hold their working sets. As a result the CPU utilisation drops. Prevention techniques include reducing the degree of multiprogramming, using working set model to determine how many pages a process needs, allocating enough frames, or implementing local page replacement rather than global. Recognising thrashing and advocating prevention shows maturity in interview responses. :contentReference[oaicite:7]{index=7}
33. Which memory allocation strategy picks the first block that is large enough to satisfy the request?
Difficulty: MediumType: MCQTopic: Memory Mgmt
- Best-Fit
- Worst-Fit
- First-Fit
- Next-Fit
In first-fit allocation the OS searches the free list and allocates the first block that is large enough. It is simple and fast but may leave many small leftover blocks (external fragmentation). Best-fit tries to find the smallest adequate block but can suffer from many tiny unusable fragments; worst-fit picks the largest block leaving larger smallest leftover. These trade-offs are common interview topics. :contentReference[oaicite:8]{index=8}
Correct Answer: First-Fit
34. Explain internal and external fragmentation and give examples of each.
Difficulty: MediumType: SubjectiveTopic: Memory Mgmt
Internal fragmentation happens when a process is allocated a memory block larger than it needs, leaving wasted space inside it. For example, if a block of size 100 units is given to a process needing 90, the 10 units inside are wasted. External fragmentation happens when free memory is available overall but split into small blocks so no single block is large enough to satisfy a request. For instance if free blocks of size 10,15,5 units exist but a process requests 20 units, it fails even though total free space is 30. Knowing both types helps you talk about memory management pitfalls in interviews. :contentReference[oaicite:9]{index=9}
35. What is a file system in the context of an operating system?
Difficulty: EasyType: MCQTopic: File Systems
- A software that only manages processes
- A method to store, organise and retrieve files on a storage device
- A hardware component responsible for disk scheduling
- A user-level application for editing files
A file system is the subsystem of an operating system that manages how data is stored and retrieved on storage media. It handles naming, directories, metadata, allocation and free-space management. Understanding this is key for placement interviews. :contentReference[oaicite:0]{index=0}
Correct Answer: A method to store, organise and retrieve files on a storage device
36. Which file allocation method stores file blocks in links so each block points to the next block?
Difficulty: MediumType: MCQTopic: Memory Mgmt
- Contiguous allocation
- Linked allocation
- Indexed allocation
- Hybrid allocation
In linked allocation, each file is a linked list of disk blocks and the directory holds a pointer to the first block. This method avoids external fragmentation but random access is slow because you must traverse links. It’s one of the basic allocation strategies asked in interviews. :contentReference[oaicite:1]{index=1}
Correct Answer: Linked allocation
37. Explain what an inode is in a Unix-style file system and what information it holds.
Difficulty: MediumType: SubjectiveTopic: File Systems
An inode is a data structure used in many Unix-style file systems to represent a file or directory. It holds metadata such as the owner, permissions, file size, creation/modification/access times, and pointers to the data blocks where the file’s contents reside. The inode number is an index into an inode table used by the OS. Knowing inodes helps you understand underlying file system implementations. :contentReference[oaicite:2]{index=2}
38. In a hierarchical file system, which directory typically contains configuration files in a Linux system?
Difficulty: EasyType: MCQTopic: File Systems
In Linux system directories, /etc is the standard directory where system configuration files are kept. This question tests familiarity with file system structure, which often shows up in interviews. :contentReference[oaicite:3]{index=3}
Correct Answer: /etc
39. Describe two common free-space management techniques in file systems and their trade-offs.
Difficulty: MediumType: SubjectiveTopic: File Systems
Free-space management is how a file system tracks which blocks are free for allocation. Two common techniques are a free-list (linked list of free blocks) and a bitmap (array of bits where each bit indicates free or used). The free-list is simple and efficient for sequential allocation but may fragment and traverse slowly for large free lists. A bitmap allows quick access and compact representation, and supports efficient block allocation decisions, but requires scanning and may incur overhead for very large disks. Highlighting trade-offs is important in interview responses.
40. Why do many modern file systems use journaling?
Difficulty: HardType: MCQTopic: File Systems
- To increase disk size automatically
- To speed up read operations significantly
- To maintain crash consistency and reduce recovery time
- To avoid permissions checking
Journaling file systems record metadata (and sometimes data) changes in a log before applying them. If a crash happens, the system can replay the journal to restore consistency quickly. This technique is widely used in modern file systems like ext4 and XFS. :contentReference[oaicite:4]{index=4}
Correct Answer: To maintain crash consistency and reduce recovery time
41. What is an extent-based allocation in a file system and why is it preferred for large files?
Difficulty: HardType: SubjectiveTopic: File Systems
Extent-based allocation assigns a file one or more large contiguous regions (extents) of disk blocks rather than many small scattered blocks. This reduces fragmentation, improves I/O performance for large sequential reads/writes, and simplifies block mapping. Many modern file systems such as XFS and ext4 use extents for scalability and performance. Demonstrating knowledge of extents can impress interviewers. :contentReference[oaicite:5]{index=5}
42. In a Unix file system, which permission set allows a user to remove files from a directory?
Difficulty: MediumType: MCQTopic: File Systems
- Directory has write permission but not execute
- Directory has execute permission but not write
- Directory has write and execute permissions
- Only directory read permission is needed
In Unix-style systems, to remove files from a directory the user must have write permission (to modify the directory contents) AND execute permission (to access the directory). A directory without execute bit might prevent access. Knowledge of file and directory permissions is a common interview topic.
Correct Answer: Directory has write and execute permissions
43. What does mounting a file system mean and what role does the mount point play?
Difficulty: MediumType: SubjectiveTopic: File Systems
Mounting is the process by which the operating system makes a file system accessible at a certain directory (the mount point) in the directory tree. The mount point is the directory where the root of the new file system is attached. After mounting, users and programs can access files on that file system by traversing the directory tree. In interviews it’s useful to mention unmounting, mount flags (read-only, noexec) and how mount points tie multiple storage devices into one hierarchical namespace.
44. Which scheduling algorithm attempts to reduce disk arm movement by servicing requests in the direction of the arm until it reaches the end and then reversing?
Difficulty: HardType: MCQTopic: IO Systems
- FCFS
- SSTF
- SCAN
- Priority scheduling
The SCAN disk-scheduling algorithm (also called elevator algorithm) moves the disk arm in one direction servicing all pending requests until it hits the end then reverses direction. This reduces seek time by preventing arm starvation and back-and-forth movement. Understanding disk scheduling links file system and device management topics. :contentReference[oaicite:6]{index=6}
Correct Answer: SCAN
45. How does the file-system consistency check (fsck) utility work and when is it used?
Difficulty: HardType: SubjectiveTopic: File Systems
The fsck (file system check) utility is used to check and repair inconsistencies in file-system metadata after a crash or improper shutdown. It scans file-system structures like inode tables, bitmaps, directory entries and free lists to identify orphaned inodes, dead links, incorrect block counts or mismatches. Then it repairs by clearing or reconnecting entries. Explaining when it runs (boot time, manually) and how it helps restore integrity shows deeper OS knowledge. :contentReference[oaicite:7]{index=7}
46. Which of the following is a block device in operating system terms?
Difficulty: EasyType: MCQTopic: IO Systems
- Keyboard
- Hard disk drive
- Printer
- Mouse
A hard disk drive is considered a block device because data is transferred in fixed-size blocks and any block can be accessed directly. Devices like keyboard or mouse are character devices since they transfer data one character or small stream at a time.
Correct Answer: Hard disk drive
47. Explain programmed I O, interrupt-driven I O and direct memory access (DMA).
Difficulty: MediumType: SubjectiveTopic: IO Systems
Programmed I O is the simplest I O method where the CPU repeatedly checks device status and then transfers data, causing the CPU to be busy with I O. Interrupt-driven I O improves efficiency: the device signals the CPU when it is ready and the CPU handles the transfer only then. Direct Memory Access (DMA) is the most efficient: the device controller or DMA hardware moves data between memory and device without busy CPU, freeing the CPU for other tasks. The trade-off is added complexity in hardware and handling synchronization of memory and bus access.
48. What does spooling in operating systems refer to?
Difficulty: MediumType: MCQTopic: IO Systems
- Allocating memory to processes while I O is blocked
- Simultaneous peripheral operations online by queuing jobs for slower devices
- A way of caching frequently used I O data in main memory
- An interrupt handler that handles multiple I O devices
Spooling stands for Simultaneous Peripheral Operations On-Line. It uses an intermediate buffer or queue so that data destined to a slower device is stored temporarily and the system can move on. This improves efficiency for devices like printers.
Correct Answer: Simultaneous peripheral operations online by queuing jobs for slower devices
49. What is an interrupt in the context of I O, and how does it differ from polling?
Difficulty: MediumType: SubjectiveTopic: IO Systems
An interrupt is a signal from a device to the CPU indicating that it requires service. When the interrupt occurs, the CPU stops the current execution, saves state, and jumps to the interrupt service routine (ISR) to handle the device. In polling (or programmed I O), the CPU repeatedly checks the device’s status in a loop, which wastes CPU cycles. Interrupts allow more efficient use of the CPU since it can perform other work until a device signals. However interrupts add complexity in context switching and latency management.
50. Which disk scheduling algorithm treats the disk arm like an elevator, servicing requests in one direction until reaching the end then reversing?
Difficulty: HardType: MCQTopic: IO Systems
- FCFS
- SSTF
- SCAN
- Priority scheduling
The SCAN algorithm (sometimes called the elevator algorithm) moves the disk arm in one direction, servicing all requests until it reaches the end, then reverses. This reduces back-and-forth movement and provides better uniform wait times. It is widely referenced in I O scheduling interview questions.
Correct Answer: SCAN
51. What is Direct Memory Access (DMA) and what advantages does it provide over other I O methods?
Difficulty: HardType: SubjectiveTopic: IO Systems
Direct Memory Access (DMA) permits devices to transfer data to or from main memory directly without continuous CPU intervention. A dedicated DMA controller requests control of the system bus, transfers a block of data, and then returns control to the CPU. The major advantages are: the CPU is freed from busy waiting for I O, overall system efficiency increases, large data transfers are more efficient, and I O throughput improves. The trade-off is increased complexity in the I O subsystem, handling of bus arbitration and ensuring coherence of data between CPU caches and memory.
52. Which statement correctly describes a device driver in an operating system?
Difficulty: MediumType: MCQTopic: IO Systems
- It is a hardware chip that manages I O devices
- It is application software that performs high-level user tasks
- It is the kernel module or software component that controls and manages a specific hardware device
- It is the memory management component that allocates buffers
A device driver is software (often part of the OS kernel or loaded module) that abstracts hardware specifics and provides a uniform interface for higher layers of the OS. It handles initialization, data transfer, interrupts and cleanup for a device. This is often asked in interviews to test understanding of I O subsystems.
Correct Answer: It is the kernel module or software component that controls and manages a specific hardware device
53. What is buffering in the context of I O systems? Explain its purpose and trade-offs.
Difficulty: MediumType: SubjectiveTopic: IO Systems
Buffering is the technique where a temporary memory area (buffer) is used to hold data while it moves between two devices or between device and main memory. The purposes include: decoupling producer and consumer speeds, reducing number of I O operations, and smoothing out bursts of data. The trade-offs are: using additional memory, possible latency for filling buffer, and complexity in flushing or synchronising buffer contents. For example print spooling uses a buffer queue to accumulate print jobs before the printer handles them.
54. How does spooling differ from buffering in I O systems?
Difficulty: HardType: MCQTopic: IO Systems
- Spooling writes data directly to device; buffering waits for device readiness
- Spooling holds jobs in queue for a device and allows other tasks meanwhile; buffering holds data temporarily between transfers
- Buffering always uses disk storage; spooling uses memory only
- Buffering is used only for block devices; spooling is used only for character devices
While both buffering and spooling use temporary storage, buffering typically refers to holding data to smooth or decouple data flow between two entities, and spooling refers to queuing jobs or data for a slower device so that the main system can continue working. This nuanced difference is often discussed in deeper I O questions.
Correct Answer: Spooling holds jobs in queue for a device and allows other tasks meanwhile; buffering holds data temporarily between transfers
55. Differentiate cache versus buffer in the context of I O and memory systems.
Difficulty: HardType: SubjectiveTopic: IO Systems
A cache is a small fast memory that stores copies of frequently accessed data or instructions to reduce access latency, often between CPU and main memory. A buffer is a temporary storage area used when data is moving between two devices or between device and memory, often to accommodate speed mismatch. The key difference is purpose: caching aims for reducing access time by exploiting locality, buffering aims for smoothing data transfer. In I O systems you might buffer disk writes and also cache disk reads; distinguishing these roles and trade-offs shows thorough understanding in interviews.
56. Which mechanism helps ensure that only authorised processes access I O devices safely in an operating system?
Difficulty: MediumType: MCQTopic: OS Security
- Memory paging
- Access control on device files/drivers
- CPU scheduling algorithms
- File allocation tables
Operating systems protect I O devices and device data by controlling access via device files (in Unix) or driver interfaces, ensuring user processes cannot perform illegal I O instructions directly. This is an important security and resource management concept.
Correct Answer: Access control on device files/drivers
57. What is a deadlock in an operating system?
Difficulty: EasyType: MCQTopic: Concurrency
- A process stuck in infinite loop
- Two or more processes wait indefinitely for resources held by each other
- A process terminated unexpectedly
- Multiple threads waiting on the same lock but eventually proceeding
A deadlock occurs when two or more processes are unable to proceed because each is waiting for a resource held by another process in the set. None can continue. This is a fundamental concurrency issue.
Correct Answer: Two or more processes wait indefinitely for resources held by each other
58. What are the four necessary conditions for a deadlock to occur? Explain each one.
Difficulty: MediumType: SubjectiveTopic: Concurrency
There are four classic conditions that must simultaneously hold for a deadlock: mutual exclusion (resources cannot be shared and only one process may use a resource at a time), hold and wait (a process holds at least one resource and is waiting to acquire additional resources held by others), no preemption (resources cannot be forcibly taken from a process; they must be released voluntarily), and circular wait (a closed chain of processes exists where each process holds a resource needed by another process in the chain). If you break any one of these, you can prevent deadlock.
59. Which of these is a common method for detecting deadlock in a system with multiple resource instances?
Difficulty: MediumType: MCQTopic: Concurrency
- Time-sharing algorithm
- Banker’s algorithm safety check
- Disk scheduling algorithm
- Paging algorithm
The Banker’s algorithm can be used for deadlock avoidance via safety checks by simulating allocations to see if system remains in a safe state. Though originally for avoidance, the concept underpins detection of safe/unsafe states.
Correct Answer: Banker’s algorithm safety check
60. How can an operating system prevent deadlock? Describe at least two techniques with trade-offs.
Difficulty: HardType: SubjectiveTopic: Concurrency
An OS can prevent deadlock by ensuring at least one of the four necessary conditions never holds. Two common techniques are: 1) Resource ordering – assign a global ordering to resources and require all processes to request resources in that order, thereby avoiding circular wait. 2) Preemption – allow the OS to preempt a resource from a process (breaking the no-preemption condition). For example, if a process holds some resources and requests others and cannot get them, the OS may force it to release its held resources. The trade-offs: ordering can be rigid and complex for many resource types; preemption can lead to wasted work or inconsistent state if resources are forcibly removed. In interviews, stating trade-offs shows deeper understanding.
61. Which of the following is *not* a requirement for a correct solution to the critical-section problem?
Difficulty: MediumType: MCQTopic: Concurrency
- Mutual exclusion
- Progress
- Bounded waiting
- Infinite waiting
A correct solution to the critical-section problem must satisfy mutual exclusion (only one process at a time), progress (decide which process enters if none is in critical section) and bounded waiting (each process must wait only a bounded number of times). Infinite waiting (starvation) is not acceptable. This is a standard concurrency property.
Correct Answer: Infinite waiting
62. Explain the difference between a mutex and a semaphore.
Difficulty: MediumType: SubjectiveTopic: Concurrency
A mutex (mutual exclusion) is a locking mechanism that allows only one thread or process to access a critical section at a time. A semaphore is a signalling mechanism that can allow multiple threads (if count >1) or one thread (binary semaphore) to access a shared resource. A semaphore also supports operations like wait (P) and signal (V). Using semaphores you can implement various synchronization patterns including producer-consumer, but you must take care of issues like deadlock or priority inversion. Understanding this distinction is common in interviews.
63. What does the term ‘aging’ refer to in scheduling/concurrency context?
Difficulty: HardType: MCQTopic: CPU Scheduling
- Increasing priority of long-waiting processes to prevent starvation
- Decreasing priority of processes that recently executed
- Forcing preemption after a fixed time
- Allowing threads to monopolize resources
Aging is a technique used in scheduling and concurrency to gradually increase the priority of a process that has been waiting for a long time so as to prevent starvation. This ensures fairness. Interviewers expect you to know both starvation risk and aging mitigation.
Correct Answer: Increasing priority of long-waiting processes to prevent starvation
64. What is the reader-writer problem, and how might an OS handle it? Include considerations for read-heavy vs write-heavy workloads.
Difficulty: HardType: SubjectiveTopic: Concurrency
The reader-writer problem is a classic concurrency scenario where multiple threads/processes can read a shared data resource simultaneously, but writes must be exclusive. The OS or synchronization library must ensure that while writers are active no readers read, and vice versa, or else consistency might break. For read-heavy workloads you might favour many concurrent readers and delay writers (reader-preference), but this risks writer starvation; for write-heavy you might favour writers or use priorities. Solutions include read/write locks, semaphores, or monitors. In interviews, showing awareness of trade-offs (fairness vs performance) is valuable.
65. In a resource allocation graph, what does a cycle indicate if each resource has only one instance?
Difficulty: MediumType: MCQTopic: Concurrency
- System is in safe state
- System has a resource leak
- Deadlock has occurred
- All processes are terminated
In a resource allocation graph where each resource has a single instance, a directed cycle implies that a set of processes are waiting in a circular chain for resources held by each other — this indicates a deadlock condition. Recognising graph-based detection is a common interview point.
Correct Answer: Deadlock has occurred
66. What is a livelock? How is it different from a deadlock? Give an example.
Difficulty: HardType: SubjectiveTopic: Concurrency
A livelock is a situation where processes or threads continuously change their state in response to one another but none makes progress. Unlike deadlock (complete standstill because of waiting), livelock is active but unproductive. For example, two processes repeatedly yield to each other’s resource requests but neither gets the resource. In interviews mentioning contrast with deadlock, detection difficulty and prevention strategies adds depth.
67. Which synchronization primitive ensures both mutual exclusion and prevents data race in a multithreaded program?
Difficulty: MediumType: MCQTopic: Concurrency
- Semaphore without binary counting
- Mutex lock
- Barrier
- Spin-lock
A mutex lock is designed to provide mutual exclusion by allowing only one thread to hold the lock and enter a critical section at a time, thus preventing data races on shared data. Barriers wait for all threads, spin-locks busy-wait and semaphores may allow more than one holder unless used as binary; so understanding the subtle differences is important for interviews.
Correct Answer: Mutex lock
68. Which access control model enforces that subjects cannot read up and cannot write down, typically used in high-security systems?
Difficulty: MediumType: MCQTopic: OS Security
- Discretionary Access Control (DAC)
- Role-Based Access Control (RBAC)
- Mandatory Access Control (MAC)
- Attribute-Based Access Control (ABAC)
In Mandatory Access Control systems the OS enforces a central policy that limits how subjects (processes) can access objects based on security labels. The classic Bell-LaPadula model states ‘no read up’ and ‘no write down’ to preserve confidentiality. MAC is commonly discussed in OS security contexts.
Correct Answer: Mandatory Access Control (MAC)
69. Explain the difference between kernel mode and user mode in an operating system and why the distinction matters for security.
Difficulty: EasyType: SubjectiveTopic: OS Security
In an operating system the CPU can operate in at least two modes: user mode and kernel mode. In user mode applications execute with limited privileges and cannot execute critical instructions or access sensitive hardware directly. In kernel mode the OS core and trusted code run with full privileges and can manage hardware, memory, interrupt handling and system resources. This separation is important for security because it prevents user‐level code (which may be malicious or buggy) from harming the system, accessing other processes’ memory or performing privileged operations. By restricting risky operations to kernel mode the OS reduces its attack surface.
70. Which principle states that a process or user should be given no more access than necessary to perform its job?
Difficulty: MediumType: MCQTopic: OS Security
- Principle of Least Privilege
- Separation of Duties
- Fail‐safe Defaults
- Economy of Mechanism
The Principle of Least Privilege means that every process, user or system component should be granted only the privileges needed to complete its work and no more. Applying this principle leads to fewer unwanted side‐effects, less malware risk and better containment of faults. Interviewers often ask this to check security awareness in OS design.
Correct Answer: Principle of Least Privilege
71. What is the W^X (Write XOR Execute) policy in operating systems and how does it enhance security?
Difficulty: HardType: SubjectiveTopic: OS Security
The W^X (Write XOR Execute) policy means that memory pages are never both writable and executable at the same time. In other words a page is either writable (data) or executable (code), but not both. This mitigates a class of attacks where malicious code writes into a memory region and then executes it (such as buffer‐overflow shellcode). Many modern OS kernels and user code runtimes enforce W^X, making it harder for attackers to exploit memory corruption vulnerabilities.
72. What is the purpose of kernel patch protection (KPP) as implemented in some operating systems?
Difficulty: HardType: MCQTopic: OS Security
- To allow dynamic loading of any kernel module without checks
- To prevent user applications from reading kernel memory
- To prevent unauthorized patching or modification of kernel code while the system is running
- To allow the kernel to patch itself automatically without reboot
Kernel Patch Protection (such as PatchGuard in 64-bit Windows) periodically checks critical system structures to detect unauthorized modifications of the kernel. If tampering is detected, the OS may trigger a bug check or shut down to protect integrity. This defense elevates OS security by blocking rootkits and kernel-level malware.
Correct Answer: To prevent unauthorized patching or modification of kernel code while the system is running
73. What is a rootkit and how can operating system design help defend against it?
Difficulty: HardType: SubjectiveTopic: OS Security
A rootkit is a stealthy type of malicious software that embeds itself deep inside the operating system — often at kernel level — to gain elevated privileges, hide itself, intercept system calls or manipulate kernel data structures. Defending against rootkits requires OS features like integrity checking of kernel code and data, secure boot to verify initial code, memory protection (e.g., W^X), mandatory access control, module signing and monitoring suspicious behaviour. Also, isolating kernel modules and reducing trusted code (trusted computing base) limits the risk. Explaining how OS architecture helps mitigate rootkits shows strong interview understanding.
74. Which term describes a secure area of a main processor that provides isolated execution for code and data, even from higher-privileged code on the system?
Difficulty: MediumType: MCQTopic: OS Security
- Virtual machine monitor (VMM)
- Trusted Execution Environment (TEE)
- Hypervisor
- Sandbox
A Trusted Execution Environment (TEE) is a hardware-supported secure area of a processor that ensures confidentiality and integrity of code and data inside it, shielding them from even higher privilege software like the OS kernel. TEEs represent modern OS security extensions and show up in advanced interview discussion.
Correct Answer: Trusted Execution Environment (TEE)
75. Why is the Principle of Least Common Privilege important in operating system security and how would you implement it in OS design?
Difficulty: MediumType: SubjectiveTopic: OS Security
The Principle of Least Common Privilege (often called Least Privilege) states that processes, users or system components should operate using the minimum privileges necessary. In OS design it means separating functionality into modules, isolating drivers, reducing kernel mode code, limiting permissions of user processes, and enforcing strong access controls (e.g., MAC). This reduces the risk that a compromised component causes widespread system damage. Implementing it might involve microkernel architecture, sandboxing, containerization or capability-based security models. Showing this design mindset adds depth in interviews.
76. What does secure boot in modern operating systems ensure?
Difficulty: HardType: MCQTopic: OS Security
- That only signed user applications can run after OS loads
- That the OS kernel and bootloader code are verified and trusted before execution
- That the system boots faster than normal
- That the BIOS cannot access the hardware directly
Secure boot is a security standard that ensures that only firmware or software signed by trusted authorities runs during boot time. It verifies the bootloader and kernel before handing control over, helping prevent rootkits or boot-time malware from compromising the system. Mentioning secure boot in OS security interviews shows awareness of end-to-end protection. Many OS security lore sources list this.
Correct Answer: That the OS kernel and bootloader code are verified and trusted before execution
77. Which of the following best describes virtualisation?
Difficulty: EasyType: MCQTopic: Virtualization
- Running multiple physical machines from one operating system
- Creating a virtual version of a resource such as hardware, operating system or network
- Having one operating system manage a single hardware device
- Using the cloud only for storage
Virtualisation is the process of creating virtual instances of physical resources — for example servers, storage or networks — so that you can run multiple separate environments on the same hardware. This improves resource utilisation and flexibility.
Correct Answer: Creating a virtual version of a resource such as hardware, operating system or network
78. What is the key difference between a Type 1 and a Type 2 hypervisor?
Difficulty: MediumType: MCQTopic: Virtualization
- Type 1 runs on top of a host OS; Type 2 runs directly on hardware
- Type 1 runs directly on hardware; Type 2 runs on top of a host OS
- Type 1 supports only containers; Type 2 supports full virtual machines
- Type 1 uses software emulation; Type 2 uses hardware-assisted virtualization
In virtualisation architectures a Type 1 (bare-metal) hypervisor runs directly on the host machine’s hardware, offering better performance and efficiency. A Type 2 hypervisor runs on a host operating system as an application layer, and then hosts guest operating systems. Knowing this distinction is a common interview point.
Correct Answer: Type 1 runs directly on hardware; Type 2 runs on top of a host OS
79. Explain the difference between a container and a virtual machine and mention typical use-cases for each.
Difficulty: MediumType: SubjectiveTopic: Virtualization
A virtual machine includes a full guest operating system and virtualised hardware, so each VM is isolated and runs independently. It uses a hypervisor to manage resources. A container, by contrast, shares the host OS kernel but isolates the user-space environment; containers are lighter weight, start faster and use fewer resources. Use-cases: VMs are good when full isolation and different OSs are needed (for instance running Windows and Linux on one host). Containers are ideal for microservices, rapid deployment and when many similar processes need to run in isolation but share host resources. Mentioning the trade-offs (isolation vs lightweight, flexibility vs overhead) is important for interviews.
80. What is live migration of a virtual machine?
Difficulty: HardType: MCQTopic: Virtualization
- Migrating a powered-off VM from one host to another
- Migrating a running VM from one physical host to another with minimal downtime
- Cloning a VM snapshot for backup purposes
- Converting a container to a VM without shutdown
Live migration enables moving a virtual machine that is currently running from one physical host to another with minimal or no downtime. It is used for load balancing, maintenance, high availability. Interview questions often test how and why this works.
Correct Answer: Migrating a running VM from one physical host to another with minimal downtime
81. What is OS-level virtualisation and what are its advantages and limitations?
Difficulty: HardType: SubjectiveTopic: Virtualization
OS-level virtualisation is the technique where multiple isolated user-space instances (containers or zones) run on a single operating system kernel, sharing that kernel and underlying hardware. For example, technologies like Solaris Zones or OpenVZ implement OS-level virtualisation. Advantages include lightweight operation, near-native performance, fast startup, efficient resource use. Limitations include less isolation compared to full virtual machines (since kernel is shared), and inability to run different OS kernels or completely different operating systems. Demonstrating both sides (advantages and limitations) is key for interview depth.
82. In a virtualised environment what does resource over-commit mean?
Difficulty: MediumType: MCQTopic: Virtualization
- Assigning fewer virtual resources than physical ones
- Assigning more virtual resources than physical hardware actually supports
- Restricting virtual machines so they cannot use full hardware resources
- Running only one VM per physical machine
Resource over-commit means that the hypervisor or virtualisation platform allows virtual machines collectively to hold more CPUs, RAM or storage allocations than the underlying physical host provides, relying on the fact that not all VMs will use their maximum at the same time. This improves utilisation but also introduces risk of contention and performance degradation. Knowing this risk-vs-benefit is useful in interviews.
Correct Answer: Assigning more virtual resources than physical hardware actually supports
83. What is nested virtualisation and what challenges does it introduce?
Difficulty: HardType: SubjectiveTopic: Virtualization
Nested virtualisation occurs when a virtual machine itself hosts another virtualisation layer (a VM inside a VM). This can be useful for development, testing or cloud provider architectures. Challenges include increased overhead, more complex hardware and hypervisor support (CPU extensions like VT-x/AMD-V must be forwarded), more layers of translation (guest to host), greater resource contention and reduced performance. Discussing real-world scenarios or trade-offs strengthens your answer in interviews.
84. Which of the following statements is true when migrating many VMs for maintenance in a data-centre?
Difficulty: MediumType: MCQTopic: Case Studies
- You should power off all VMs before migration to avoid complexity
- Live migration avoids downtime and maintains active services during host maintenance
- Migration always improves performance because you move VMs to newer hardware
- You cannot migrate VMs between hosts with different CPU types
In practice live migration is used to move running workloads off a host for maintenance without stopping services. While hardware compatibility matters, the key interview point is that migration enables high availability and service continuity. Explaining host compatibility, shared storage, network dependencies adds depth.
Correct Answer: Live migration avoids downtime and maintains active services during host maintenance
85. Discuss security concerns unique to virtualised operating systems and how an OS design or admin can mitigate them.
Difficulty: HardType: SubjectiveTopic: Virtualization
Virtualised environments introduce security concerns such as VM escape (guest breaking out of its sandbox), hypervisor attacks, sharing of resources causing side-channel leaks, and mis-configuration of virtual networks or snapshots. To mitigate these, OS and virtualisation platform designers adopt measures such as strict isolation between VMs (via hardware support like IOMMU, VT-d), secure hypervisor design, patching and minimal trusted computing base, network segmentation, secure boot, and proper access control. In interviews referencing container vs VM isolation differences and real-world mitigation steps shows your understanding.
86. What is one major performance overhead in virtualised systems compared to native systems?
Difficulty: MediumType: MCQTopic: Modern OS
- Faster I/O because virtualised hardware is optimized
- No need for memory translation
- Extra layer of abstraction causing increased CPU/memory overhead
- Reduced network latency always
Virtualisation introduces additional layers (hypervisor, emulated hardware, translation) which can reduce performance versus native. Overheads include CPU context switches, I/O translation, memory management, device emulation, and increased latency. Recognising these trade-offs is beneficial in interviews.
Correct Answer: Extra layer of abstraction causing increased CPU/memory overhead
87. What are typical challenges when migrating virtual machines in large-scale systems and how can they be addressed?
Difficulty: MediumType: SubjectiveTopic: Virtualization
When migrating VMs at scale, challenges include compatibility of CPU features between source and target hosts, needing shared storage or having to transfer large amounts of memory state, network connectivity and IP continuity, performance hit and downtime, dependency on hypervisor versions, resource contention during migration and ensuring minimal service disruption. Mitigation includes live migration planning, using abstraction layers, homogeneous hardware clusters or CPU feature masking, shared storage or replication, and scheduling migration during low-utilisation windows. Mentioning real-world constraints and steps to address them enhances your answer.
88. Which scheduling algorithm treats the disk arm like an elevator moving in one direction servicing requests then reversing?
Difficulty: MediumType: MCQTopic: IO Systems
- FCFS
- SSTF
- SCAN
- Priority scheduling
The SCAN algorithm (also called the elevator algorithm) moves the disk arm in one direction, servicing requests as it goes, until it hits one end of the disk, then reverses direction. This approach reduces arm movement and can offer better average wait times than simple methods. In interview settings, explaining the ‘elevator’ metaphor and its trade-offs (for example with SSTF) is valuable.
Correct Answer: SCAN
89. What is a device driver in an operating system and how does it interact with hardware and the kernel?
Difficulty: MediumType: SubjectiveTopic: IO Systems
A device driver is a software component (often part of the OS kernel or a loadable module) that provides an interface between the operating system’s generic I/O framework and the specific hardware device. It handles initialization of the device, data transfer, interrupt handling, power management and clean-up. The OS kernel calls driver APIs to perform I/O, route interrupts to the driver, and manage resources like DMA channels or device memory. For interviews it is useful to highlight how drivers provide abstraction, manage concurrency and ensure safe access to hardware.
90. What is Direct Memory Access (DMA) in the context of I/O systems?
Difficulty: HardType: MCQTopic: IO Systems
- A CPU strategy for polling devices for I/O
- A method where the device controller transfers data to/from memory without CPU involvement
- Another term for caching
- A driver-only software buffer for I/O data
DMA allows a hardware controller (the DMA engine) to move data between memory and a device without continuous CPU intervention. This frees the CPU to perform other tasks while large blocks of I/O are transferred. An OS using DMA must coordinate memory buffers, interrupt service routines and bus arbitration. Understanding DMA is often asked in system-level OS interviews because it touches hardware-software boundary.
Correct Answer: A method where the device controller transfers data to/from memory without CPU involvement
91. Explain buffering in I/O systems: why is it used and what are its trade-offs?
Difficulty: MediumType: SubjectiveTopic: IO Systems
Buffering is the technique of using a temporary memory area (buffer) to hold data while it is transferred between two devices or between device and memory. It helps decouple producer and consumer speeds (for example when a fast CPU writes to a slower peripheral). Buffering improves throughput, smooths bursts of data and reduces I/O invocation overhead. On the flip side, buffering consumes memory, can introduce latency (data waits in buffer), may cause inconsistency if not flushed correctly, and adds complexity (flush logic, overflow, memory management). Interviewers like it when you discuss both the benefit and trade-offs.
92. Compare interrupt-driven I/O with polling in terms of efficiency, overhead, and use-cases.
Difficulty: HardType: SubjectiveTopic: IO Systems
Polling (or programmed I/O) is when the CPU repeatedly checks (in a loop) a device status to see if it is ready, then performs the transfer. It wastes CPU cycles while waiting. Interrupt-driven I/O is when the device issues an interrupt when ready, and the CPU handles the request via ISR (Interrupt Service Routine). Interrupts reduce wasteful CPU polling but add overhead due to context switching, interrupt latency and complexity. Polling may be suitable for very fast or predictable devices. Interrupts are better for devices with unpredictable latency or that allow CPU to work on other tasks. In interviews, discuss trade-offs: timing, latency, complexity, context switch overhead, CPU utilisation.
93. Which statement correctly differentiates cache from buffer in the context of I/O and memory systems?
Difficulty: HardType: MCQTopic: IO Systems
- Cache holds data for deferred writing; buffer holds data for faster access
- Cache is user-space only; buffer is kernel-space only
- Cache is a small fast memory that stores frequently accessed data; buffer is a temporary holding area during data transfer between devices or memory
- Cache is only for CPUs; buffer is only for devices
A cache is aimed at reducing access latency by storing copies of frequently used data near the CPU or device; a buffer smooths data transfer by holding data temporarily between two entities with mismatched speeds. These are commonly confused in interview questions, so clearly stating the difference shows clarity.
Correct Answer: Cache is a small fast memory that stores frequently accessed data; buffer is a temporary holding area during data transfer between devices or memory
94. How does an operating system manage access to device resources when multiple processes need I/O simultaneously?
Difficulty: MediumType: SubjectiveTopic: IO Systems
When multiple processes need I/O or device access simultaneously the OS must coordinate resource sharing. It does so by maintaining queues (ready queue, I/O queue), using device-queues, scheduling I/O requests, applying locking or semaphores to protect device registers, managing priorities, and ensuring fairness and avoidance of starvation. For example, a print spooler may queue all print requests and let the driver service them one by one. The OS might also use priority or time-slicing for devices. In interviews mention trade-offs: fairness vs throughput, device contention, prevention of starvation, and impact on CPU scheduling.
95. Which of these features is essential for handling hot-plug devices in an OS?
Difficulty: MediumType: MCQTopic: IO Systems
- Static device enumeration only at boot time
- Kernel module loading and unloading at runtime
- Disallowing device removal at runtime
- Only user-space drivers
For an operating system to support hot-plug devices (such as USB drives or external peripherals) it must allow device drivers (often kernel modules) to load and unload dynamically at runtime. This ensures that the system recognizes new devices and removes them safely without rebooting. This topic demonstrates system internals knowledge in interviews.
Correct Answer: Kernel module loading and unloading at runtime
96. Describe how an OS might allocate devices (like network cards, GPUs) in a multi-tenant environment and what challenges arise.
Difficulty: HardType: SubjectiveTopic: IO Systems
In a multi-tenant or shared environment the OS must allocate devices fairly and securely among different virtual machines or processes. For example a hypervisor or OS may use IOMMU to partition DMA access, assign virtual functions (SR-IOV) for network cards, isolate GPUs via hardware virtualization, and use quotas or scheduling for access. Challenges include performance isolation (one tenant hogging device), security isolation (preventing DMA attacks or shared memory leakage), scheduling of I/O bandwidth, interrupt sharing, driver compatibility, and load balancing. In interview responses mention these challenges and how OS design or hypervisor can mitigate them — e.g., using hardware partitioning, IO-virtualization, and monitoring of usage.
97. Which statement correctly reflects the difference between a monolithic kernel and a microkernel architecture?
Difficulty: MediumType: MCQTopic: OS Design
- Monolithic kernel has fewer functions in kernel space; microkernel has most OS services inside kernel space
- Monolithic kernel runs most OS services in kernel space; microkernel moves many services to user space
- Microkernel architecture always uses more memory than monolithic kernel
- Microkernel does not support device drivers
In a monolithic kernel architecture many OS services (file system, network stack, device drivers) run in kernel space, giving high performance but larger trusted code base. A microkernel aims to keep the kernel minimal (basic services such as scheduling, IPC) and move other services to user space. This improves modularity, isolation and reliability but can incur overhead from message passing between services.
Correct Answer: Monolithic kernel runs most OS services in kernel space; microkernel moves many services to user space
98. What distinguishes a real-time operating system (RTOS) from a general-purpose operating system, and what are the trade-offs?
Difficulty: MediumType: SubjectiveTopic: Modern OS
A real-time operating system is designed to guarantee that tasks meet timing constraints (deadlines), not just logical correctness. In a hard RTOS missing a deadline is a failure. It typically offers deterministic scheduling, minimal latency, priority inversion protection, and often supports preemption of nearly any code. The trade-offs are that RTOS may sacrifice throughput or flexibility for predictability, may use static memory and simpler APIs, and often run fewer services. For interview answers mention examples (embedded systems, autopilot, medical devices) and contrast with general-purpose OS which target max utilisation, flexibility and feature-richness.
99. If a system uses demand paging and the working set of all processes is larger than physical memory, what state might the system enter?
Difficulty: HardType: MCQTopic: Case Studies
- Thrashing
- Context switching
- Paging optimal
- Idle state
When demand-paged processes each keep triggering page faults because their combined working sets exceed available physical memory frames, the system spends more time swapping pages in and out than doing productive work — this is thrashing. Recognising thrashing is a classic advanced OS interview topic. :contentReference[oaicite:0]{index=0}
Correct Answer: Thrashing
100. How do operating systems evolve in a cloud infrastructure environment? Mention at least two changes or optimisations.
Difficulty: HardType: SubjectiveTopic: Modern OS
In a cloud infrastructure environment operating systems evolve to support massively scalable workloads, multi-tenant isolation, live migration, and hardware abstraction. Two important optimisations are: 1) Lightweight virtual machines or containers as first-class citizens rather than full user desktops, reducing overhead and enabling fast deployment. 2) Live migration of VMs or containers between hosts to enable maintenance, load balancing, scaling without downtime. Additionally OS kernels often incorporate I/O vertical scaling (e.g., SR-IOV for network devices), NUMA awareness for large servers, and software-defined storage or network abstractions. Holding awareness of these modern OS trends strengthens interview responses.
101. In a multi-processor or multi-server OS architecture what is one major goal of load balancing?
Difficulty: MediumType: MCQTopic: Case Studies
- Ensure one server handles maximum load always
- Keep each server idle as much as possible
- Distribute workload to avoid hotspots and maximise resource utilisation
- Disable scheduling to rely purely on hardware
Load balancing in multi-processor or multi-server OS architectures aims to spread tasks so that no single node becomes a bottleneck, resources are utilised evenly, system throughput is maximised and performance stays predictable. This is particularly relevant to modern OS in data-centres and cloud settings.
Correct Answer: Distribute workload to avoid hotspots and maximise resource utilisation
102. Describe how an operating system would handle a kernel panic or fatal error in production, including the steps it might take to recover or minimise service impact.
Difficulty: HardType: SubjectiveTopic: Case Studies
When an OS encounters a kernel panic or fatal error the typical steps are: 1) Immediately halt or freeze further non-critical activities to prevent corruption. 2) Log diagnostic information (stack trace, register state, memory dump) so engineers can analyse root cause. 3) Attempt automatic recovery if supported (e.g., reboot to safe mode or use a redundant node in high availability systems). 4) For critical services the OS or platform might trigger fail-over to a standby system, preserve user sessions or state if possible, and restore service quickly. 5) On restart perform integrity checks (file system check, memory diagnostic) before resuming full operations. Mentioning high-availability OS patterns (redundant kernel, live patching) adds depth.
103. What does NUMA (Non-Uniform Memory Access) architecture imply in a multi-processor system?
Difficulty: HardType: MCQTopic: Modern OS
- All memory accesses have equal latency
- Each processor has its own local memory and may access remote memory at higher cost
- No shared memory at all between processors
- Memory is only accessible by one processor
In a NUMA architecture each processor has local memory which it can access more quickly; accessing another processor’s memory or a shared region may incur higher latency. Modern OS kernels must be NUMA-aware when scheduling tasks or managing memory to optimise performance on large servers. Recognising this shows advanced OS knowledge. :contentReference[oaicite:1]{index=1}
Correct Answer: Each processor has its own local memory and may access remote memory at higher cost
104. Why is observability important in modern operating systems and what OS-level metrics would you track in production?
Difficulty: MediumType: SubjectiveTopic: Modern OS
Observability in modern operating systems and platforms means having visibility into performance, reliability and resource usage at runtime so that operators can detect anomalies, diagnose faults and optimise behaviour. OS-level metrics to track include CPU utilisation, queue lengths of ready and I/O queues, memory usage, page fault rate, context-switch rate, interrupt rate, I/O latency, scheduler load, and for cloud OS also VM/container migration events, network packet drops and NUMA node imbalances. Referencing case studies of production OS helps you show applied knowledge in interviews.
105. When designing an operating system which trade-off is commonly encountered in scheduling policy design?
Difficulty: HardType: MCQTopic: OS Design
- Maximising response time vs throughput
- Maximising memory usage vs CPU usage
- Minimising number of cores vs threads
- Avoiding any context switches altogether
In OS scheduling and design trade-offs often include choosing between faster response time (good for interactive tasks) and higher throughput (good for batch tasks). A policy that favours one may hurt the other. Recognising trade-offs, as well as how real-world systems balance them, is a strong sign in interviews. :contentReference[oaicite:2]{index=2}
Correct Answer: Maximising response time vs throughput
106. What is live patching in operating systems and how does it support system uptime and maintenance?
Difficulty: HardType: SubjectiveTopic: Modern OS
Live patching is the ability to apply changes (patches) to a running kernel or OS components without rebooting. This is critical for high-availability systems where downtime must be minimised. It typically involves loading new code modules, redirecting function calls, ensuring state consistency, and monitoring for regressions. By enabling hotfixes, security updates or module upgrades without taking the system offline, live patching supports service continuity and maintenance windows. In interview discussion you might mention how OS ensures safe patching (symbol versioning, interrupt quiescence, duplication of code) and risks (memory leaks, inconsistent state).