Operating Systems Exam Paper - August 2023
Operating Systems Exam Paper - August 2023
The Banker's algorithm prevents deadlocks by simulating resource allocation for processes before actual allocation. It ensures that resource requests are granted only if the system remains in a safe state, meaning future processes can still obtain necessary resources without causing deadlocks. It uses vectors to track resources and demand, thus allowing precise control over allocation .
Page replacement algorithms directly impact how efficiently an operating system manages memory. LRU (Least Recently Used) minimizes page faults in practical access patterns by replacing the least recently used pages, whereas FIFO replaces the oldest pages regardless of access patterns, often leading to suboptimal performance and anomalies like Belady's. Efficient algorithms reduce page swaps, improving processing speed and resource utilization .
IPC faces challenges like synchronization, ensuring that processes run without conflicts; resource sharing, which requires management to avoid deadlocks; and security, preventing data from being accidentally shared or leaked. Solutions include semaphores and mutex locks for synchronization, deadlock detection algorithms, and permissions systems to secure data exchange .
Dynamic partitioning allows memory spaces to be allocated based on process needs, minimizing internal fragmentation and optimizing memory usage. However, it can lead to external fragmentation and increased overhead due to constant resizing. Fixed partitioning, while easier to manage and predict, suffers from internal fragmentation, as predefined partitions may not always fit process sizes efficiently, leading to wasted memory .
Thrashing occurs when excessive paging operations overshadow useful processing, usually due to insufficient physical memory. Understanding thrashing is crucial as it indicates a mismanagement of resources, leading to drastically reduced system performance. Addressing thrashing typically involves adjusting memory allocation strategies, increasing physical memory, or optimizing processes to reduce paging .
Belady's Anomaly refers to the counterintuitive situation where increasing the number of page frames results in more page faults in certain page replacement algorithms, like FIFO. This anomaly highlights the inefficiency of these algorithms in predicting and managing memory access patterns, directly impacting system performance and prompting the development of more sophisticated algorithms like LRU, which avoid such anomalies .
FCFS (First Come First Serve) is simple and fair in a temporal sense but can cause the 'convoy effect', delaying short processes. SJF (Shortest Job First) optimizes turnaround by prioritizing shorter tasks but may lead to starvation of longer processes. RR (Round Robin) provides fairness by allocating equal time slices to processes, improving response time in interactive systems but may introduce overhead due to frequent context switching .
FCFS is fair but not efficient for minimizing seek time. SSTF (Shortest Seek Time First) minimizes head movement but can starve outer requests. SCAN (Elevator Algorithm) is optimal for reducing seek time in high-density environments by servicing all requests in one direction before reversing, preventing starvation. C-SCAN is best for even distribution of service time across requests, beneficial in environments with many new requests, as it cyclically scans the disk like SCAN but in one direction .
Distributed operating systems enhance reliability by decentralizing resources to prevent a single point of failure, thus improving fault tolerance. They manage resources across multiple devices, promoting efficiency through load balancing and concurrent processing. They also provide services like remote access and resource sharing, unlike traditional systems that are limited to managing resources on a single device .
System calls serve as the interface between user-level programs and the operating system, enabling user applications to request services like file manipulation, process control, and communication. This interaction allows programs to execute tasks that require operating system privileges, bridging user operations with hardware abstraction .