ECS 150 Winter 2000: Process Scheduling

Process Scheduling

  1. Goal: What characterizes a "fair internal policy?" Which process is given the CPU next? This is the province of schedulers.
  2. Schedulers
    1. long-term
    2. medium-term
    3. short-term
  3. Scheduling Considerations and Overview
    1. metrics: throughput, turnaround, response, resource use, waiting time, consistency
    2. distingishing characteristics of processes such as priority, anticipated resource need (including running time), running time, resources used so far, interactive/non-interactive, frequency of I/O requests, time spent waiting for service
  4. The Scheduling Algorithms
    1. First Come, First Served (FCFS)
    2. Shortest Job Next (SJN), Shortest Job First (SJF), Shortest Process Next (SPN)
    3. Shortest Remaining Time (SRT), Preemptive Shortest Process Next (PSPN)
    4. Highest Response Ratio Next (HRRN, HRN)
    5. Round Robin (RR) with Quantum q
    6. Multilevel Feedback Queues (MLF, MLFB) with n different priority levels each of priority Tp
  5. External Priority Methods
    1. worst service next
    2. response ratio guarantee
    3. deadline scheduling
    4. fair-share scheduling


Types of Schedulers

Introduction

This chart shows the function of each of the three types of schedulers (long-term, short-term, and medium-term) for each of three types of operating systems (batch, interactive, and real-time).

Chart

 batchinteractivereal-time
long-termjob admission based on characteristics and resource needs sessions and processes normally accepted unless capacity reached processes either permanent or accepted at once
medium-termusually none--jobs remain in storage until done processes swapped when necessary processes never swapped
short-termprocesses scheduled by priority; continue until wait voluntarily, request service, or are terminated processes scheduled on rotating basis; continue until service requested, time quantum expires, or pre-empted scheduling based on strict priority with immediate pre-emption; may time-share processes with equal priorities

Job Scheduling Algorithms

Introduction

This handout shows how the various job scheduling algorithms work.

First Come, First Serve (FCFS)

This policy services jobs in the order they arrive.

job namearrival timeservice timestart timefinish timeturnaround timewaiting timeresponse ratio
A0100101001.0
B12910393891.3
C233942403713.3
D37424946396.6
E412496157454.8
mean    38265.4

Shortest Job Next (SJN)

This policy services the shortest job next.

job namearrival timeservice timestart timefinish timeturnaround timewaiting timeresponse ratio
A0100101001.0
B129326160312.1
C2310131183.7
D37132017102.4
E412203228162.3
mean    25132.3

Pre-emptive Shortest Job Next (PSJN)

This policy services the shortest job next, pre-emptively.

job namearrival timeservice timestart timefinish timeturnaround timewaiting timeresponse ratio
A01002pre-empted by C
  8122020102.0
B129326160312.1
C2325301.0
D37512921.3
E412203228162.3
mean    24121.7

Highest Response Ratio Next (HRN)

This policy services the job with the highest response ratio next.

job arrival service start finish turnaround waiting response

job namearrival timeservice timestart timefinish timeturnaround timewaiting timeresponse ratio
A0100101001.0
B129326160312.1
C2310131183.7
D37132017102.4
E412203228162.3
mean    25132.3

Round Robin (RR)

This policy services jobs for a fixed quantum (here, 5).

job namearrival timeservice timestart timefinish timeturnaround timewaiting timeresponse ratio
A01005end of quantum; B starts
  5232828182.8
B129510end of quantum; C starts
  242833end of quantum; D starts
  194045end of quantum; E starts
  14476160312.1
C2310131183.7
D371318end of quantum; E starts
  2333532254.6
E4121823end of quantum; A starts
  73540end of quantum; B starts
  2454743313.5
mean    35233.3

Multilevel Feedback (MLFB)

The variant of this class of scheduling algorithms uses three levels:

The jobs A, B, C, D, and E have been augmented by F, a 1-second job arriving at time 13, and G, an 11-second job arriving at time 50. These are to demonstrate that quanta are usually not interrupted.

In what follows, the number in parentheses in the comment field is the remaining service time for the job.

timelevel 1level 2level 3comments
0A----A(10) arrives, runs
1AB----B(29) arrives, A continues quantum
2BCA--C(3) arrives, A's quantum expires (8), moves to level 2, B runs
3BCDA--D(7) arrives, B continues quantum
4CDEAB--E(12) arrives, B's quantum expires (27), moves down, C runs
6DEABC--C's quantum expires (1), moves down, D runs
8EABCD--D's quantum expires (5), moves down, E runs
10--ABCDE--E's quantum expires (10), moves down, A runs from level 2 (level 1 is empty)
13FABCDE--F(1) arrives, A's quantum continues
14FABCDE--A's quantum expires (4), F runs (at level 1)
15--ABCDE--F finishes, B runs from level 2 (level 1 is empty)
19--ABCDE--B's quantum expires (23), C runs
20--ABDE--C finishes, D runs
28--ABDE--E's quantum expires (6), A runs
32--BDE--A finishes, B runs
36--DEBB's quantum expires (19), moves down, D runs
37--EBD finishes, E runs
41----BEE's quantum expires (2), moves down, B runs from level 3 (since there is nothing in higher levels)
50G--BEG arrives(11), B continues to run
60G--EB finishes, G runs (since it is in the highest level)
62--GEG's quantum expires (9), moves down, G runs from level 2
66--GEG's quantum expires (5), G runs
70----EGG's quantum expires (1), moves down, E runs
72----GE finishes, G runs
73------G finishes
The relevant numbers (ignoring start and finish time) are:
job namearrival timeservice timestart timefinish timeturnaround timewaiting timeresponse ratio
A01002preempted by B
  81014preempted by F
  4283232223.2
B12924preempted by C
  271519preempted by C
  233236preempted by D
  19416059302.0
C2346preempted by D
  1192018156.0
D3768preempted by E
  52024preempted by E
  1363734274.9
E412810preempted by A
  102428preempted by A
  63741preempted by B
  2707268565.7
F1311415212.0
G50116070preempted by E
  1727323122.1
mean    33.723.33.7


Send email to cs150@csif.cs.ucdavis.edu.

Department of Computer Science
University of California at Davis
Davis, CA 95616-8562



Page last modified on 1/26/2000