Computer Science – 16.1 Purposes of an Operating System (OS) | e-Consult
16.1 Purposes of an Operating System (OS) (1 questions)
An operating system plays a crucial role in managing system resources – CPU time, memory, and I/O devices – to ensure efficient operation. Maximising resource utilisation is a primary goal, balancing throughput, fairness, and responsiveness. Here's an explanation of how scheduling and memory management contribute, along with their trade-offs:
Scheduling Algorithms
Scheduling algorithms determine the order in which processes are executed. Different algorithms have different strengths and weaknesses:
- First-Come, First-Served (FCFS): Simple to implement, but can lead to long wait times for short processes if a long process is running. Poor CPU utilisation if processes have varying burst times.
- Shortest Job First (SJF): Optimises average waiting time, but requires knowing the burst time of each process (often not feasible). Can lead to starvation of long processes.
- Priority Scheduling: Processes are assigned priorities, and higher-priority processes are run first. Can lead to starvation of low-priority processes if high-priority processes continuously arrive. Requires careful priority assignment.
- Round Robin (RR): Each process gets a fixed time slice. Fairness is improved, and responsiveness is better. However, context switching overhead can reduce overall throughput.
- Multilevel Feedback Queue Scheduling: Processes are assigned to different queues with different priorities. This allows for a balance between fairness and responsiveness. Complexity in implementation.
Trade-offs: Faster execution of some processes may come at the expense of fairness or responsiveness to other processes. The choice of algorithm depends on the system's requirements and the nature of the workload.
Example: A server handling web requests might use a Round Robin scheduler to ensure that each request receives timely attention, even if some requests are more complex than others. A real-time system, like an embedded control system, might use a Priority scheduler to guarantee that critical tasks are executed within strict deadlines.