81. What is the difference between hard links and soft links (symbolic links) in Unix/Linux?
- Hard links are on hard drives; soft links are on solid-state drives
- A hard link is a directory entry pointing directly to the same inode as the original file; a soft link (symbolic link) is a separate file containing the path to the original file — soft links can cross file systems; hard links cannot
- Soft links are faster than hard links for all file access operations
- Hard links can only link to directories; soft links can only link to files
Answer : B Explanation: Hard Link: creates another directory entry pointing to the same inode. The original file and hard link are indistinguishable — they are the same file with two names. Deleting one doesn’t affect the other (file data persists until all hard links are removed). Cannot cross file system boundaries. Cannot link to directories (to prevent cycles). Soft Link (Symbolic Link): a separate file containing the path to the target. If the target is deleted, the symlink becomes dangling (broken). Can cross file systems. Can link to directories. Commands: ln file hardlink (hard link), ln -s file softlink (soft link). ls -l shows symlinks with → pointing to target.
82. What is the concept of multiprogramming in operating systems?
- Using multiple programming languages to write a single operating system
- Keeping multiple programs in memory simultaneously so the CPU can switch to another program when one blocks for I/O — maximizing CPU utilization by overlapping CPU and I/O operations
- Writing programs that can run on multiple different operating systems
- A programming technique where multiple programmers work on different parts of one program
Answer : B Explanation: Multiprogramming organizes multiple programs in memory so the CPU always has something to execute. When Program A blocks for I/O (disk read, network request), the OS switches the CPU to Program B, which runs while Program A waits. When Program A’s I/O completes, it becomes ready again. This overlapping of CPU and I/O operations dramatically increases CPU utilization — a single program leaves the CPU idle 80-90% of the time waiting for I/O; multiprogramming keeps the CPU busy. It is the foundation of modern computing — without it, interactive systems and servers would be impossibly inefficient.
83. What is an operating system’s role in I/O management?
- The OS only manages disk I/O; other I/O is handled directly by applications
- The OS provides a uniform interface for all I/O devices through device drivers, manages I/O requests, handles interrupts from devices, buffers data, and performs error handling — hiding hardware complexity from user programs
- The OS manages only input devices; output devices are managed by hardware directly
- I/O management is handled entirely by the CPU without OS involvement
Answer : B Explanation: I/O Management is a major OS responsibility. Key functions: Device Drivers — software modules that translate generic OS I/O commands to device-specific operations. Buffering — temporary storage of I/O data to smooth speed differences between fast CPU and slow devices. Caching — keeping frequently used data in fast storage (disk cache). Spooling — queuing I/O requests for devices that cannot handle concurrent requests (printers). Error Handling — detecting and recovering from I/O errors. I/O Scheduling — ordering I/O requests for optimal performance. The OS provides a standard I/O interface (read, write, open, close) that works for all devices — users don’t need to know whether they’re writing to a file, printer, or network socket.
84. What is the purpose of the wait() system call in Unix/Linux?
- A system call that pauses process execution for a specified number of seconds
- A system call used by a parent process to block until one of its child processes terminates, retrieve the child’s exit status, and allow the OS to clean up the child’s entry from the process table (preventing zombies)
- A system call that waits for a mutex lock to become available
- A system call that suspends a process until a specific file is available for reading
Answer : B Explanation: The wait() system call is essential for parent-child process coordination in Unix/Linux. When a parent calls wait(): it blocks until one of its children terminates, receives the child’s exit status (success or error code), and allows the OS to remove the child’s PCB entry from the process table. Without wait(), terminated children become zombie processes occupying process table space. waitpid(pid, &status, options) provides more control — wait for a specific child. exit status can be examined using WIFEXITED, WEXITSTATUS macros. The fork()-exec()-wait() pattern is the fundamental Unix process creation pattern: fork creates a child, exec loads a new program, wait collects the result.
85. What is the exec() system call family in Unix/Linux?
- A system call that executes a shell command and returns its output as a string
- A family of system calls that replace the current process’s memory image with a new program — the current process becomes the new program without creating a new process
- A system call that executes multiple processes simultaneously in parallel
- A system call that extends the current process’s memory allocation on demand
Answer : B Explanation: The exec() family (execl, execv, execle, execve, execlp, execvp) replaces the calling process’s program with a new program. Key behavior: the process ID stays the same — it is NOT a new process. The old program’s code, data, stack, and heap are completely replaced. Open file descriptors are typically preserved. On success, exec() never returns — the new program starts running from its main(). On failure, exec() returns -1. exec() is almost always used after fork(): the child calls exec() to load a new program while the parent continues. Together, fork() + exec() is the Unix way to create new processes running different programs (the shell uses this for every command).
86. What is demand paging in operating systems?
- A paging system where the user manually requests pages to be loaded into memory
- A virtual memory technique where pages are loaded into physical memory only when they are actually needed (referenced), rather than loading the entire process at startup
- A paging technique that demands equal amounts of memory from each running process
- A scheduling policy that gives CPU time based on memory demand of each process
Answer : B Explanation: Demand Paging is the most common virtual memory implementation. Initially, none or only some pages of a process are loaded into RAM. When a process references a page not in memory, a page fault occurs — the OS loads that specific page from disk. This approach: reduces initial load time (program starts faster), reduces memory usage (only needed pages are in RAM), allows programs larger than physical memory to run. Performance depends on the page fault rate: zero page faults → same as non-virtual-memory performance; more page faults → slower due to disk I/O. Prepaging (loading predicted pages in advance) and copy-on-write optimizations improve demand paging performance.
87. What is the concept of time-sharing in an operating system?
- Dividing the system clock into equal time units for process measurement
- A computing model where multiple users or processes share CPU time by rapidly switching between them, giving each user the illusion of having dedicated CPU access through a multi-user interactive environment
- A billing system that charges users based on CPU time consumed
- Sharing time zones across a distributed computing network
Answer : B Explanation: Time-Sharing extends multiprogramming by enabling multiple interactive users to use the system simultaneously. The CPU switches between processes so rapidly (milliseconds) that each user experiences immediate response to their commands. Key characteristics: quick response time for interactive use, each user gets a fair share of CPU, and processes are scheduled using time quantum (Round Robin typically). First popularized by CTSS (Compatible Time-Sharing System) at MIT in the 1960s. UNIX was designed as a time-sharing OS. Time-sharing is the foundation of: modern multi-user systems, cloud computing (VMs share physical CPUs), and interactive computing (web servers handling simultaneous requests).
88. What is the resource allocation graph in deadlock detection?
- A bar graph showing how much of each resource type has been allocated to each process
- A directed graph used to represent resource allocation and requests between processes — if the graph contains a cycle, a deadlock may exist; if each resource has only one instance, a cycle guarantees deadlock
- A network diagram showing the physical connections between computing resources
- A Gantt chart showing when each resource is available for allocation to processes
Answer : B Explanation: A Resource Allocation Graph (RAG) is a directed bipartite graph with two types of nodes: Process nodes (circles) and Resource nodes (rectangles). Two types of edges: Assignment edge (resource → process): resource instance is allocated to process. Request edge (process → resource): process is waiting for a resource. Cycle detection: If no cycle exists → no deadlock. If a cycle exists AND each resource has exactly ONE instance → deadlock exists. If a cycle exists but resources have multiple instances → deadlock MAY exist (needs further analysis). The Banker’s Algorithm can determine if a system is in a safe state, avoiding deadlock even with cycles.
89. What is the concept of protection rings in operating systems?
- Concentric circles used to organize network security zones around a data center
- A hierarchical privilege level mechanism where the kernel runs at Ring 0 (most privileged) and user applications run at higher ring numbers (Ring 3) — preventing user programs from directly accessing hardware or kernel resources
- Physical security rings placed around server hardware to prevent unauthorized access
- Ring buffers used by the OS to implement efficient circular memory queues
Answer : B Explanation: Protection Rings (privilege levels) are a hardware security mechanism. x86 architecture defines four rings: Ring 0 (Kernel Mode) — most privileged; OS kernel runs here, has direct hardware access. Ring 1 and Ring 2 — device drivers and OS services (rarely used in practice). Ring 3 (User Mode) — least privileged; user applications run here, cannot directly access hardware. Transitioning from Ring 3 to Ring 0 requires a system call or interrupt — the CPU verifies the request is valid. This prevents user programs from: directly reading/writing hardware registers, accessing other processes’ memory, or crashing the OS kernel. Modern virtualization adds Ring -1 (hypervisor level) below Ring 0.
90. What is the concept of copy-on-write (COW) in operating systems?
- A file management technique that creates a copy of a file every time it is opened
- An optimization technique where parent and child processes initially share the same memory pages after fork(), and a physical copy is made only when either process actually tries to modify a shared page
- A write protection mechanism that prevents processes from modifying shared libraries
- A backup technique that copies data to secondary storage only when it changes
Answer : B Explanation: Copy-On-Write (COW) is an optimization for the fork() system call. Without COW: fork() would need to copy the entire parent process memory to the child — very expensive. With COW: fork() creates the child’s page table pointing to the same physical pages as the parent. Both processes share pages marked as read-only. When either process writes to a shared page, a page fault occurs — the OS then creates a private copy of that page for the writing process, and both can proceed independently. COW dramatically speeds up fork() since most child processes immediately call exec() and never modify parent pages. COW is also used in databases, virtual machines, and file systems (ZFS, Btrfs snapshots).
