Key Concepts of Operating Systems
Key Concepts of Operating Systems
Volatile storage, like main memory, loses its stored data when power is lost, which presents challenges for data management in terms of persistence and reliability. Operating systems must ensure that critical data is periodically written to non-volatile storage to preserve it across reboots or failures. This necessitates mechanisms like checkpoints and logging to ensure that work can be resumed with minimal data loss .
A process control block (PCB) is a data structure used by the operating system to store information about a process. It contains process-related information such as the process ID, process state, CPU registers, memory limits, and scheduling information. The PCB allows the operating system to track and manage processes efficiently, ensuring that the CPU can switch between processes without losing track of their individual states .
System calls provide the interface for application programs to access operating system services and hardware resources. In UNIX, system calls like 'fork' are used to create processes and manage system resources directly in a straightforward and uniform manner. Windows, however, generally uses higher-level API calls with a more complex and layered architecture, which abstracts many traditional system call functions into extensive libraries, providing a wider yet more complex programming interface .
Message passing and shared memory are two fundamental methods of inter-process communication. Message passing involves processes sending and receiving messages to communicate, useful in distributed systems as it avoids dependency on shared memory spaces but can incur overhead due to data copying. Shared memory allows multiple processes to access the same memory space simultaneously, which provides fast communication since data does not need to be copied between processes, but it requires synchronization to avoid race conditions .
A real-time operating system (RTOS) is designed to process data as it comes in, typically without buffering delays. It ensures task deadlines are met by prioritizing tasks and using scheduling algorithms that trigger the execution of tasks in a manner that allows them to be completed within their designated time constraints. This often involves preemptive scheduling to ensure high-priority tasks are executed immediately .
Round Robin scheduling assigns time slices, or quanta, to each process in the queue and cycles through them, providing each process a fair share of the CPU without preemption. This makes it equitable for all processes but not necessarily efficient in minimizing waiting times. In contrast, Shortest Job First (SJF) selects the process that has the shortest next CPU burst time, which can minimize average waiting time but may lead to starvation of longer processes .
In symmetric multiprocessor systems, each processor runs an identical copy of the operating system and they share the same memory, allowing any processor to access any IO device and memory unit, leading to efficient load balancing. In contrast, asymmetric multiprocessor systems designate one processor as the master processor and the others as slave processors, with the master processor controlling the system and assigning specific tasks to slave processors, typically leading to less efficient use of resources but simpler architecture .
The primary challenge with the Shortest Job First (SJF) algorithm is accurately predicting the length of the next CPU burst. This uncertainty can lead to incorrect scheduling decisions. Additionally, since SJF is non-preemptive, longer processes can suffer from starvation if shorter jobs continuously arrive. This makes it difficult to apply in systems where job lengths are not predictable or where fairness cannot be assured .
Time sharing in operating systems enhances user experience by allowing multiple users to interact with the system concurrently, seemingly running multiple applications at once. This is achieved by rapidly switching the CPU among user programs, providing each user with a time-sliced share of the CPU. This approach ensures high responsiveness and efficient computation resources utilisation, making it ideal for environments with multiple interactive users .
CPU burst times significantly impact overall system throughput, as they determine how long a process will occupy the CPU. Shorter CPU bursts lead to higher throughput as processes spend less time occupying the CPU, allowing more processes to complete within a given time frame. Scheduler algorithms like Shortest Job First optimize throughput by favoring shorter processes, although they can be less effective when burst times are unpredictable .