TutorChase logo
Login
IB DP Computer Science HL Study Notes

6.2.2 Techniques in OS Resource Management

The Operating System (OS) is pivotal in managing a computer's resources, ensuring they are used efficiently by different programs. This involves a series of complex techniques to optimise the computer's performance.

Scheduling

Scheduling refers to how the OS prioritises and allocates CPU time to processes and tasks. Efficient scheduling is crucial for multitasking environments to ensure that all processes receive adequate CPU time.

Types of Scheduling Algorithms:

  • First-Come, First-Served (FCFS): This simple scheduling method queues processes in the order they arrive. It is fair but can lead to inefficient CPU usage, known as the convoy effect.
  • Shortest Job First (SJF): Processes with the smallest execution time are prioritised, reducing the average waiting time for all processes.
  • Round-Robin (RR): Each process is assigned a time slice and is cycled through in a round-robin fashion. It is particularly effective in time-sharing systems.
  • Priority-Based Scheduling: Each process is given a priority. Processes with higher priorities are executed first, while those with lower priorities may suffer from starvation if not managed properly.

Unlock the rest of this chapter with a free account

Sign up for a free account to keep reading notes and practice questions.

FAQ

Interrupts and polling are two mechanisms for handling I/O operations, and they differ significantly in terms of CPU resource usage. With interrupts, the CPU is free to perform other tasks and only stops to address an interrupt when a device signals that it needs attention. This "interrupt-driven" approach is more efficient because it reduces CPU idle time waiting for I/O operations. Polling, in contrast, requires the CPU to actively check the status of each I/O device regularly, which can waste valuable CPU cycles if the device does not need attention at the time of polling. Hence, interrupts are generally preferred for efficiency but may not be suitable for all devices, especially those that require constant attention.

Device drivers are specialised software programs that provide an interface between the operating system and hardware devices. In the context of polling, the device driver regularly checks the status of its device to see if it needs processing. The driver is optimised for this task, knowing exactly when and how to check the device, and what actions to take if an operation is required. This can improve system efficiency by offloading the task of monitoring hardware from the CPU to the driver, which is specifically designed for this purpose. Additionally, well-designed drivers can reduce polling frequency or implement intelligent polling strategies that minimise the performance impact on the system.

Soft and hard real-time operating systems differ in their guarantees of service. A soft real-time system prioritises processing tasks based on their deadlines, but allows for occasional deadline misses, which may not significantly affect the system's performance. This is often suitable for applications where performance is critical but not mission-critical, such as streaming media. In contrast, a hard real-time system has strict timing constraints and guarantees that tasks will be performed within a specified deadline. Resource management in such systems is more stringent, often requiring dedicated hardware and predictable scheduling algorithms to ensure that deadlines are always met. This is crucial in systems where failure to process data in real-time could result in catastrophic outcomes, such as in life support systems or air traffic control.

Thrashing occurs when a system spends more time swapping pages in and out of the virtual memory than executing processes. This can happen when there is insufficient physical memory and too many processes are active, causing continuous page faults that saturate the I/O bandwidth. The operating system mitigates thrashing by implementing better page replacement algorithms, such as Least Recently Used (LRU), which can predict which pages will be used least in the future. It can also use a working set model to ensure that each process maintains a minimum number of pages in memory to continue operating efficiently. Furthermore, the OS may limit the number of active processes to prevent the system's demand for memory from exceeding the available amount.

In a priority-based scheduling system, each process is assigned a priority level by the operating system. This level can be determined based on the type of process (system vs user), the amount of resources required, the expected execution time, or the process importance. Often, system processes have higher priority than user-initiated tasks. Priorities can be static or dynamic; static priorities are set at the beginning and remain constant, whereas dynamic priorities can change during the process lifetime, usually in response to the aging mechanism which prevents starvation of low priority processes. The scheduler then uses these priority levels to decide the order in which processes are given CPU time, with higher priority processes being chosen first.

Hire a tutor

Please fill out the form and we'll find a tutor for you.

1/2
Your details
Alternatively contact us via
WhatsApp, Phone Call, or Email