Scheduling Part1
Scheduling Part1
Operating System
Basic Concepts
▪ Whenever the CPU becomes idle, the operating system must select
one of the processes in the ready queue to be executed.
▪ The selection is carried out by the CPU scheduler.
Scheduling
CPU-scheduling decisions may take place under the following four circumstances:
unit
▪ Waiting time – amount of time a process has been waiting in the ready
queue
▪ Throughput: The number of processes that are completed per time unit.
▪ Turnaround time: The interval from the time of submission of a process to the
time of completion is the turnaround time.
▪ Turnaround time is the sum of the periods spent waiting to get into
memory, waiting in the ready queue, executing on the CPU, and doing I/O.
▪ Waiting time: the amount of time a process spends waiting in the ready
queue.
▪ Waiting time is the sum of the periods spent waiting in the ready queue.
▪ Response time: the amount of time it takes from when a request was
submitted until the first response is produced.
P1 P2 P3
0 24 27 30
P2 P3 P1
0 3 6 30
▪ Associate with each process the length of its next CPU burst
• Use these lengths to schedule the process with the shortest time
• Estimate
P4 P1 P3 P2
0 3 9 16 24
▪ Since the next CPU burst length is unknown, one practical approach is
to predict it based on past behavior.
▪ A common method is Exponential Averaging, which estimates the
next CPU burst using a weighted average of previous bursts:
P1 P2 P4 P1 P3
0 1 5 10 17 26