Operating Systems Senior
Compare Monolithic Kernels and Microkernels. What are the tradeoffs regarding performance, modularity, and system stability?
Select the correct answer
Both kernels run all their services in user space, so they differ only in scheduling policy rather than in stability or speed.
Monolithic kernels run most services in kernel space for speed, while microkernels isolate services in user space for stability.
Monolithic kernels offer better modularity and stability, while microkernels always outperform them due to far fewer context switches.
Microkernels run most services in kernel space for speed, while monolithic kernels isolate services in user space for stability.
What is the conceptual difference between a Virtual Machine and a Container, focusing on the OS mechanisms like Namespaces and Cgroups that enable containerization?
Select the correct answer
Containers and VMs both emulate hardware, differing only in whether cgroups or namespaces are used to manage memory.
Containers share the host kernel, using namespaces for isolation and cgroups for resource limits; VMs run full guest OSes.
VMs share the host kernel using namespaces and cgroups, while containers each boot their own full guest OS kernel.
Containers boot a full guest kernel per instance, while VMs use namespaces and cgroups to share the single host kernel.
How do OS-level Namespaces and Cgroups enable the isolation required for containers?
Select the correct answer
Cgroups isolate what a process can see, while namespaces limit the resources a process group can consume.
Both namespaces and cgroups isolate the filesystem view, but neither one controls CPU or memory usage limits.
Namespaces isolate what a process can see, while cgroups limit the resources a process group can consume.
Namespaces emulate virtual hardware, while cgroups provide each container with its own separate guest kernel.
Explain the difference between a Type-1 and Type-2 hypervisor. How do containers using namespaces/cgroups differ conceptually from Virtual Machines?
Select the correct answer
Type-1 and Type-2 both run on a host OS; containers replace the kernel entirely with namespaces and full hardware emulation.
Type-1 uses containers and Type-2 uses namespaces; both of these approaches boot a separate guest kernel per application.
Type-1 runs on a host OS and Type-2 runs on bare metal; containers virtualize hardware instead of sharing the host kernel.
Type-1 runs on bare metal and Type-2 runs on a host OS; containers share the host kernel instead of virtualizing hardware.
Compare layered, modular, and hybrid kernel architectures.
Select the correct answer
Layered kernels place everything in one block, modular kernels use strict levels, and hybrid kernels run all services as user processes.
Layered kernels load drivers on demand, modular kernels run entirely in user space, and hybrid kernels remove all layering for pure speed.
Layered kernels stack ordered levels, modular kernels load components at runtime, and hybrid kernels mix monolithic speed with modularity.
Layered kernels run as microkernels, modular kernels compile statically, and hybrid kernels isolate every service in a separate address space.
What exactly happens during a System Call? Walk through the transition from user space to kernel space.
Select the correct answer
A software trap switches the CPU to kernel mode, runs the handler via the syscall table, then returns to user mode.
The CPU stays in user mode, jumps directly to the kernel function, and returns without any mode switch or trap.
The process is terminated and restarted in kernel mode, where the handler runs before spawning a fresh user process.
A hardware interrupt saves registers to disk, loads the kernel, and copies it into the calling process address space.
What is Priority Inversion, and how does Priority Inheritance mitigate it?
Select the correct answer
A medium-priority task preempts the scheduler queue; inheritance suspends all lower tasks until the medium one fully completes execution
Two equal tasks deadlock on a shared lock; inheritance swaps their priorities so one can proceed and release the contested resource
A high-priority task starves a low-priority one holding a lock; inheritance permanently lowers the high task's priority to restore balance
A low-priority task holding a lock blocks a high-priority one; inheritance temporarily raises the holder's priority to release it sooner
Explain the readers-writers problem and the trade-offs between reader-preference and writer-preference solutions.
Select the correct answer
Only one reader and one writer may proceed at a time; reader-preference improves throughput while writer-preference eliminates all waiting
Many readers may share access but writers need exclusion; reader-preference can starve writers, and writer-preference can starve readers
Many writers may share access but readers need exclusion; reader-preference always deadlocks, while writer-preference guarantees fairness
Readers and writers must strictly alternate turns; reader-preference reduces latency, while writer-preference removes the need for locks
Explain the difference between Deadlock Prevention and Deadlock Avoidance. How does the Banker's Algorithm ensure a Safe State?
Select the correct answer
Prevention relies on timeouts to recover; avoidance rolls back threads, and Banker's grants a request strictly in arrival order.
Prevention allocates all resources upfront; avoidance kills processes early, and Banker's grants a request only to the oldest process.
Prevention breaks a necessary condition; avoidance uses runtime info, and Banker's grants a request only if a safe sequence remains.
Prevention detects cycles after they form; avoidance ignores resources, and Banker's grants a request only after preempting a holder.
How does the Banker's Algorithm determine if a system is in a Safe State?
Select the correct answer
It grants requests only when total demand is below the free physical memory.
It checks whether a sequence exists in which every process can finish safely.
It denies any request that would leave a single resource type fully allocated.
It detects cycles in the resource graph and then rolls a chosen process back.
How does deadlock detection and recovery work when the OS allows deadlocks to occur?
Select the correct answer
The OS prevents every cycle up front by strictly ordering all resource requests.
The OS runs a detection algorithm periodically and recovers by killing or preempting.
The OS ignores the condition and reboots whenever the whole system becomes slow.
The OS requires each process to declare its maximum needs before it can start.
Explain Belady's Anomaly. Why does it occur in FIFO page replacement but not in LRU?
Select the correct answer
Adding more frames always decreases page faults; FIFO suffers thrashing only, while LRU avoids it entirely because it evicts the least frequently referenced page.
Removing frames can decrease page faults; FIFO tracks load order, but LRU uses reference counts and therefore avoids the paradox by counting every page access.
Adding more frames can increase page faults; FIFO evicts by recency, but LRU keeps the oldest pages resident so its resident set always grows with more frames.
Adding more frames can increase page faults; FIFO ignores usage, but LRU is a stack algorithm whose resident set for n frames is a subset of that for n+1.
Compare the LRU and FIFO page replacement algorithms, and what is Belady's Anomaly?
Select the correct answer
LRU evicts the oldest-loaded page and can show Belady's Anomaly, where more frames raise faults; FIFO evicts the least-recently-used page and never exhibits it.
FIFO evicts the oldest-loaded page and can show Belady's Anomaly, where more frames raise faults; LRU evicts the least-recently-used page and never exhibits it.
Both FIFO and LRU evict the least-recently-used page; Belady's Anomaly is the case where adding more frames unexpectedly reduces the number of page faults.
FIFO evicts the most-recently-used page and LRU the oldest; Belady's Anomaly is when both algorithms fault on the same reference string regardless of frame count.
What is a Page Table, and why do modern systems use Multi-level Page Tables instead of a single flat table?
Select the correct answer
It maps physical frames to virtual pages; multi-level tables exist chiefly to store extra permission bits that a flat table has no room to represent at all.
It maps virtual pages to physical frames; multi-level tables are used purely to make address translation faster by reducing the number of memory lookups.
It maps virtual pages to physical frames; multi-level tables allocate only the portions actually used, avoiding one huge contiguous table for the whole space.
It maps disk blocks to physical frames; multi-level tables are needed so several processes can safely share a single global table without any locking overhead.
Explain the Working Set Model. How is the working set window used to estimate the degree of multiprogramming?
Select the correct answer
The working set is the pages loaded at startup; the window sets how many frames each process is given.
The working set is the pages a process will reference next; its window fixes the overall page-fault rate.
The working set is the pages modified since load; the window limits the number of dirty pages retained.
The working set is the pages referenced in a recent window; summing their sizes estimates total memory demand.
What is an inverted page table, and what problem does it solve compared to a per-process page table?
Select the correct answer
A two-level table that caches recent translations so the TLB miss penalty is greatly reduced overall.
A single table with one entry per virtual page, shared by all processes to speed address translation.
A single table with one entry per physical frame, shared by all processes to cut table memory use.
A per-process table indexed by frame number that stores each page's disk location for faster swapping.
How do you compute the Effective Access Time in a paged system with a TLB?
Select the correct answer
EAT = h×mem + (1−h)×(TLB + 2×mem), where h is the TLB hit ratio.
EAT = h×TLB + (1−h)×(TLB + 2×mem), where h is the TLB hit ratio.
EAT = h×(TLB + 2×mem) + (1−h)×(TLB + mem), where h is the TLB hit ratio.
EAT = h×(TLB + mem) + (1−h)×(TLB + 2×mem), where h is the TLB hit ratio.
How do LFU and MFU page-replacement algorithms work, and what are their drawbacks?
Select the correct answer
LFU replaces the page with the smallest use count; MFU replaces the one with the highest count.
LFU replaces the page unused for longest; MFU replaces the page most recently accessed here.
LFU replaces the largest resident page; MFU replaces the smallest resident page in memory.
LFU replaces the oldest resident page; MFU replaces the most recently loaded page in memory.
What is the Page-Fault Frequency (PFF) scheme for controlling thrashing?
Select the correct answer
It measures each process's fault rate and swaps out the one showing the lowest rate observed.
It counts total faults per second and halts new process creation once a threshold is crossed.
It fixes a constant number of frames per process and blocks any process exceeding its rate.
It sets upper and lower fault-rate bounds, adding frames when high and removing them when low.
How does the OS decide how many frames to allocate to each process (global vs local allocation)?
Select the correct answer
Global lets a process take frames from any process; local restricts it to its own frame set.
Global fixes frames at process creation; local adjusts them dynamically based on fault rates.
Global divides frames equally among all processes; local gives frames based on process priority.
Global assigns frames by process size; local assigns them by each process's arrival order.
What is the purpose of Journaling in a file system, and how does it help with recovery after a system crash?
Select the correct answer
It periodically snapshots the whole disk, so the file system can roll back to the last saved image.
It logs pending changes before committing them, so the log can be replayed to restore consistency.
It caches all writes in memory until shutdown, so pending changes are flushed only when it is safe.
It mirrors every disk block to a backup device, so lost data can be copied back after a crash.
Compare contiguous, linked, and indexed file allocation methods. Which one is most efficient for random access?
Select the correct answer
All three offer identical random-access speed; only their disk fragmentation behavior differs strongly overall.
Linked gives the fastest random access; contiguous suits sequential only; indexed wastes the most disk space.
Indexed gives the worst random access; contiguous needs no index; linked avoids all fragmentation issues here.
Contiguous gives the fastest random access; linked suits sequential only; indexed allows it with overhead.
Explain the concept of a Virtual File System (VFS) layer.
Select the correct answer
A cache holding recently accessed disk blocks to speed up all file read operations
A partition table describing where each mounted file system resides on the disk
A tool that converts one on-disk file system format into another compatible format
An abstraction layer providing a uniform interface to many different file system types
What is a Real-Time Operating System (RTOS), and how does its scheduler differ from a standard OS?
Select the correct answer
An RTOS prioritizes predictable response; its scheduler is preemptive and priority-driven to guarantee deadlines
An RTOS prioritizes maximum throughput; its scheduler dynamically ages processes to boost long-waiting background jobs
An RTOS prioritizes user interactivity; its scheduler uses round-robin time slices to share the CPU evenly across all
An RTOS prioritizes energy savings; its scheduler batches tasks together and defers them to reduce total context switches
Explain the Access Matrix model of protection. How do ACLs and Capability Lists represent different views of this matrix?
Select the correct answer
Rows are objects and columns are domains; ACLs store each row, while capability lists store each column of the matrix
Rows are processes and columns are threads; ACLs store the whole matrix, while capability lists store a hashed summary
Rows are domains and columns are objects; ACLs store each column, while capability lists store each row of the matrix
Rows are users and columns are files; ACLs store the diagonal entries, while capability lists store off-diagonal entries