CPU Scheduling Items Flashcards
What is the CPU scheduling about?
CPU scheduling is about deciding which tasks from the task queue should be executed by the CPU
and in what sequence. By controlling the execution order of tasks, CPU scheduling ensures efficient
utilization of CPU resources.
What does the choice of a specific CPU scheduling algorithm depend on?
The choice of a CPU scheduling algorithm primarily hinges on the system’s needs, including
efficiency goals, fairness, response time, and the nature of tasks (CPU or I/O intensive).
What is CPU burst? What is I/O burst?
A CPU burst is the period of time when a process is actively using the CPU for computations or
instructions, while an I/O burst is the period of time when a process is waiting for input/output
operations to complete, during which it is not using the CPU.
Why can it be beneficial to schedule short CPU burst processes to the CPU before long CPU burst
processes?
Scheduling short CPU burst processes before long ones can increase system responsiveness, reduce
waiting times for most processes, and improve overall throughput.
What does it mean a CPU scheduling algorithm is preemptive or non-preemptive?
A preemptive CPU scheduling algorithm allows a running process to be interrupted and replaced
by another process, typically a higher-priority one, while a non-preemptive algorithm lets a process
run to completion before scheduling another process
What does it mean a CPU scheduling algorithm is starvation free?
A starvation-free CPU scheduling algorithm ensures that every process will eventually get a chance
to execute, preventing situations where some processes never get CPU time.
First-Come-First-Served algorithm. Its idea, its advantages and disadvantages.
The First-Come-First-Served (FCFS) algorithm schedules processes based on their arrival time. Its
main advantage is simplicity and fast execution, and it is also free from starvation. However, its main
disadvantage is that it can lead to long wait times if the initially arriving processes have long CPU
bursts.
Shortest-Job-First algorithm. Its idea, its advantages, and disadvantages.
The Shortest-Job-First (SJF) algorithm schedules processes based on their burst time, starting with
the shortest. The main advantage of this algorithm is reduced average waiting time, and it is generally
fast. However, it requires prior knowledge of burst times, which may not always be available, and it
can potentially lead to starvation of longer tasks.
How can system know the duration of the next CPU burst
The duration of the next CPU burst can be estimated using several methods, including simple
averaging of previous burst times or exponential averaging, which gives more weight to recent
bursts.
Round-Robin algorithm. Its idea, its advantages, and disadvantages.
The Round-Robin (RR) algorithm assigns each process a fixed time quantum and incorporates a
limit on CPU utilization. If a process exceeds its time quantum, it is moved to the back of the queue.
RR ensures fairness, prevents starvation, and executes tasks efficiently. However, one of its
drawbacks is the potential for longer waiting times due to frequent context switches between
processes.
Priority scheduling. Its idea, its advantages, and disadvantages.
Priority scheduling assigns each process a priority and schedules the highest-priority processes first.
The advantage is that important tasks get processed first, but it can lead to starvation of low-priority
tasks.
Aging
Aging is a technique used to prevent starvation in priority scheduling by gradually increasing the
priority of tasks that have been waiting for a long time. As a process waits longer for the CPU, its
priority becomes higher.
Priority inversion and priority donation.
Priority inversion occurs when a high-priority task has to wait for a lower-priority task. Priority
donation is a technique to prevent this, where the lower-priority task temporarily inherits the higher
priority.
Real-time scheduling.
Real-time scheduling is used in systems where tasks have strict deadlines that must be met. The
scheduler is designed to ensure that critical tasks are completed within their specified deadlines.
Soft and hard real-time system.
In soft real-time systems, it’s acceptable if some deadlines are occasionally missed. In contrast, in
hard real-time systems, failing to meet a deadline is considered a system failure.