Key Operating System Exam Questions
Key Operating System Exam Questions
User mode and kernel mode separate the execution environment to protect the system's critical resources. In user mode, applications run with reduced privilege, preventing direct hardware access and system resource modification, which avoids unintended interference with system operations or other processes . Kernel mode, however, allows the OS to execute highly privileged operations and access hardware resources directly . This separation is crucial for security as it ensures that user applications cannot easily corrupt the system or compromise overall security without transitioning through carefully controlled gateways such as system calls .
Semaphores are integer variables that facilitate process synchronization by using two atomic operations, wait and signal, to manage concurrent access to resources . Mutex locks are binary semaphores that ensure mutual exclusion when multiple threads access shared resources by allowing only one thread to hold the lock at any time . If not used correctly, these tools can lead to deadlocks, where processes wait indefinitively for resources held by each other, or to priority inversion, where lower-priority processes prevent higher-priority processes from progressing . Proper design and implementation of these synchronization mechanisms are crucial in avoiding such concurrency issues .
The system booting process begins with the CPU executing firmware instructions from the BIOS or UEFI, which initializes hardware components and performs POST (Power-On Self-Test) to ensure hardware reliability . The bootloader is then loaded, which in turn loads the operating system kernel into memory and transfers control to it . The OS kernel initializes core system functions and services, sets up memory management and process schedulers, and establishes user space to allow for user-level applications to start executing .
Batch operating systems process batches of jobs without user interaction, focusing on throughput . Time-Sharing systems allow multiple users to use the computer simultaneously, improving response time by sharing time slice among users . Real-Time operating systems provide immediate processing and response to external events, crucial for time-sensitive tasks, such as those in industrial automation . Distributed operating systems manage a collection of independent computers and make them appear to the users as a single coherent system, ideal for resource sharing across networked systems . Embedded operating systems are designed for embedded devices, focusing on efficiency and resource optimization for specific hardware with minimal user interface .
FCFS (First-Come, First-Served) scheduling processes jobs in the order they arrive, which is simple but can lead to inefficiencies like the "convoy effect," where short processes wait for a long process to finish . SJF (Shortest Job First) selects processes based on the shortest next CPU burst time, reducing average waiting time but requires accurate job length prediction, which may not be feasible always . Round Robin scheduling assigns each process a fixed time slice and cycles through them, ensuring fairness and responsiveness but may increase average wait time if time slices are not well-tuned for process workloads . Each has use cases based on system priorities such as fairness or efficiency .
The Critical Section Problem requires solutions to ensure that no two processes can be in their critical sections simultaneously (mutual exclusion), processes must progress without delay from other processes (progress), and processes must eventually enter their critical section if all other processes' critical sections are empty (bounded waiting). It can be resolved through synchronization mechanisms like semaphores or monitors, which coordinate access to shared resources ensuring that operations in the critical section do not overlap . Implementation of proper locking strategies usually solves potential race conditions and ensures process synchronization .
Thrashing occurs when the system spends more time swapping pages in and out of memory than executing processes, severely degrading system performance . It is often caused by overcommitting memory in situations where working sets of active processes exceed available physical memory. Mitigation strategies include improving page replacement algorithms to better predict page use, reducing system workload by limiting multi-tasking levels, or increasing physical memory to accommodate current demands . Working set model implementations that adjust dynamically can help balance the memory needs and available resources, avoiding the excessive paging activity characteristic of thrashing .
Open-source operating systems like UNIX and Linux offer benefits such as high customization potential, transparency for auditing security vulnerabilities, and a robust community contributing to continuous improvement and support . They provide cost savings due to zero licensing fees, encouraging wider adoption among individuals and enterprises. Challenges include the possible complexity of management and configuration for non-expert users and limited proprietary software support, which may impact compatibility with certain applications . Despite these challenges, open-source systems are favored in environments that prioritize flexibility, security, and innovation .
The Access Matrix model establishes a framework for defining access permissions, where each matrix row represents a domain (or user) and each column represents a resource (or object), with matrix entries specifying the type of access permitted . This model provides a flexible mechanism to define and enforce security policies, preventing unauthorized access by specifying permissions like read, write, and execute explicitly . The matrix allows dynamic changes to permissions, offering a granular approach to access control that can manage complex scenarios of interactions between users and resources across different execution environments .
Segmentation divides memory into variable-size segments based on logical divisions like functions or data structures, which matches the program’s logical structure and allows easier implementation of protection and sharing . Compared to paging, which divides memory into fixed-size pages, segmentation better supports dynamic memory sizes and is more intuitive for handling user-level partitioning needs . Key advantages of segmentation include ease of handling growing data structures and improved access control by providing segment-specific protections, though it can suffer from fragmentation issues unlike paging’s simpler contiguous memory allocation .