Operating Systems Exam Questions Guide
Operating Systems Exam Questions Guide
When a page fault occurs, the operating system must determine whether the access is valid, locate the missing page on disk, allocate space in memory for the page, load the page into memory, and update the page table to include it. If necessary, it may involve swapping out another page. The process involves multiple steps, each critical for maintaining the flow of operations and requires careful coordination between hardware and the operating system .
Pre-emptive scheduling allows the operating system to interrupt and switch the CPU between tasks, enabling better responsiveness, as seen in Round Robin scheduling. Non-preemptive scheduling, such as First-Come, First-Served (FCFS), allows a process to keep the CPU until it finishes executing or voluntarily yields, offering simplicity and reduced overhead but potentially poor response times in interactive systems .
Virtual memory is a memory management capability that provides an "idealized abstraction of the storage resources" and creates the illusion for users of a very large memory. It is supported by schemes such as paging, where the memory is divided into fixed-size units called pages, allowing for non-contiguous memory allocation and efficient memory use. This scheme helps manage fragmentation and allows for larger processes to be run than the physical memory might normally allow .
Directory structures in file systems can be single-level, two-level, tree, or acyclic graph structures. A single-level directory is simple but suffers from naming conflicts. Two-level directories provide a separate space for each user, improving organization. Tree structures allow a hierarchical arrangement supporting logical grouping and efficient file management, while acyclic graph structures are more flexible, permitting shared subdirectories and easier collaboration. Each structure offers different ease of use, performance, and management capabilities .
Different disk scheduling algorithms impact performance differently. FCFS (First-Come, First-Served) is fair but can lead to long wait times; SSTF (Shortest Seek Time First) reduces seek time but can cause starvation; SCAN (Elevator algorithm) moves the head across the full range, serving requests in one direction before reversing, balancing performance and fairness. Each algorithm has trade-offs in efficiency, fairness, and responsiveness, making the choice context-dependent based on the workload and system goals .
Peer-to-peer systems offer several advantages over client-server systems. Firstly, they provide increased fault tolerance as there is no single point of failure. Secondly, they enhance scalability since each peer contributes resources, reducing the burden on a central server. Thirdly, they improve resource utilization by allowing direct communication and resource sharing between peers .
Context switching is considered an overhead in operating systems because it involves saving and loading the state of a process so that execution can be resumed from the same point at a later time. This process requires significant CPU time and resources to store and restore process control blocks (PCBs), resulting in increased latency and reduced CPU efficiency as the processor is not performing actual computational work during the switch .
Deadlocks in a computing system can occur when the following conditions are met simultaneously: mutual exclusion, hold and wait, no preemption, and circular wait. Mutual exclusion ensures that resources cannot be shared, while hold and wait allows processes to hold resources while waiting for others. No preemption prevents the forcible release of resources, and a circular wait occurs when a closed chain of processes exists, each waiting for a resource held by the next process. Deadlocks can be analyzed by breaking any of these conditions to avoid the situation .
The three methods used to pass parameters to an operating system are: passing parameters in registers, using a table in memory, and pushing parameters onto the stack. Passing parameters in registers involves storing parameters within a set number of registers, which is efficient but limited by the number of available registers. Using a table in memory allows for more parameters as they can be stored in a contiguous block that the OS accesses, while pushing parameters onto the stack enables dynamic parameter passing and handles function calls efficiently by using the call stack .
The Translation Look-aside Buffer (TLB) improves the performance of a paging system by caching page table entries, thus reducing the time required for virtual address translation. When a virtual address is accessed, the TLB checks for a corresponding physical address, speeding up the lookup process significantly if the required entry is found in the TLB, reducing the need for frequent access to the slower main memory each time an address is translated .