B.Tech Operating Systems Exam Paper 2023
B.Tech Operating Systems Exam Paper 2023
FCFS (First-Come, First-Served) is simple and fair in order but can lead to convoy effect, causing inefficient CPU utilization. RR (Round Robin) improves time sharing and responsiveness but may increase context switching overhead. SJF (Shortest Job First) minimizes average waiting time by executing shortest tasks first, but can lead to starvation of longer tasks. Selecting an algorithm depends on system goals such as fairness, responsiveness, or throughput, balancing the trade-offs in specific environments .
Linked allocation stores files as linked lists of disks blocks, each block pointing to the next, allowing efficient dynamic storage without fragmentation risks. Compared to contiguous allocation, which requires files to occupy sequential blocks risking fragmentation and need for reshuffling, linked allocation saves space and allows easy file expansion. However, it suffers from slower access times due to non-sequential blocks and larger overheads in pointer storage, making it suitable for media where resizing and fragmentation control are priorities .
Directory structures in file systems organize and manage files in hierarchical formats, allowing efficient storage, retrieval, and naming of files. They provide a user-friendly way to navigate and structure data logically. Implementation involves tree structures where directories and subdirectories are nodes, and files are leaves, facilitating operations like creation, deletion, and renaming. Key advantages include improved access control, data grouping, and navigation simplicity .
Deadlocks occur when a group of processes become permanently blocked as each process waits for resources held by another. Prevention methods include avoiding conditions leading to circular waits, such as resource hierarchy protocols and preemptive resource scheduling. Recovery involves process termination to break the deadlock cycle or resource preemption where resources from some processes are forcibly taken under specific conditions. Each method has trade-offs in terms of complexity and performance .
The critical section problem challenges include ensuring that only one process accesses a shared resource at a time, preventing race conditions, and ensuring mutual exclusion and progress. Peterson's solution provides a two-process synchronization mechanism that uses a combination of turn and flag variables to ensure mutual exclusion. This solution allows each process to set its flag and give way to the other process only if it is the latter's turn, thus synchronously coordinating entry to the critical section .
Segmentation involves dividing the memory into variable-sized segments based on logical divisions like code, data, and stack, whereas paging divides memory into fixed-size pages. Segmentation is useful for handling growing data structures, object-oriented programs, and multiple threads requiring isolated memory spaces. Paging is beneficial in minimizing fragmentation and optimizing memory use without requiring contiguous memory allocation, thereby enhancing efficiency in multi-tasking environments .
The optimal page replacement algorithm replaces the page that will not be used for the longest period in the future, minimizing page fault rates. Its implementation requires future knowledge of process references, which is often impractical for real-time systems, hence it is used mainly for theoretical performance benchmarking. Benefits include setting a lower bound for comparison with other algorithms like FIFO or LRU to evaluate their effectiveness in managing memory .
An operating system (OS) performs several essential functions, including management of hardware resources such as the CPU, memory, and I/O devices, providing a user interface for interaction with the computer, and facilitating execution of application software. It supports system operations by ensuring efficient process management, memory management, and I/O operations. For users, it provides services such as file management, security, and error detection. All these functions together ensure seamless execution of tasks and efficient resource allocation .
System calls such as fork, exit, wait, waitpid, and exec are fundamental to process management. Fork creates a new process by duplicating the current process, exit terminates a process and optionally returns a status code to the parent, wait and waitpid make a process suspend its execution until children terminate or change state, and exec replaces the process memory space with a new program. These calls allow effective management, communication, and coordination of processes within an operating system .
Semaphores are synchronization tools used in operating systems to control access to shared resources by multiple processes to prevent race conditions. They act as counters indicating the availability of resources. In the Bounded Buffer Problem, which involves producers adding to and consumers removing from a fixed-size buffer, semaphores manage access to avoid buffer overflows and underflows. Two semaphores track the number of filled slots and available slots without needing explicit locking, efficiently synchronizing producer and consumer processes .