Docsity

CPU Scheduling: Preemptive vs Non-preemptive, FIFO, Round Robin, Exponential Queue - Prof., Study notes of Operating Systems

Toggle sidebar
bg1
CS 414 : Operating Systems
UNIVERSITY OF VIRGINIA
Department of Computer Science
Spring 2008
Topic 8: CPU Scheduling
g
Readings for this topic: Chapter 5.
g
OS typically consists of two parts: 1) Process coordination, and 2) Resource Management
g
Resources fall into two classes:
g
Preemptible vs Non-preemptible
g
Is this distinction absolute? Real issue?
g
OS makes two related kinds of decisions about resources. What is the goal?
g
Allocation: who gets what. Implication?
g
Scheduling: how long can they keep it. Implication?
g
Resource #1:
g
Processes may be in any one of three general scheduling states:
g
Running.
g
Ready.
g
Blocked.
g
Goals for scheduling disciplines:
g
Efficiency of resource utilization. (keep CPU and disks busy)
g
Minimize overhead. (context switching)
g
Minimize response time. Define response time.
g
Distribute cycles equitably. What does this mean?
— 8.1 —
pf3

Partial preview of the text

Download CPU Scheduling: Preemptive vs Non-preemptive, FIFO, Round Robin, Exponential Queue - Prof. and more Study notes Operating Systems in PDF only on Docsity!

CS 414 : Operating Systems

UNIVERSITY OF VIRGINIA

Department of Computer Science

Spring 2008

Topic 8: CPU Scheduling

g Readings for this topic: Chapter 5. g OS typically consists of two parts: 1) Process coordination, and 2) Resource Management g Resources fall into two classes: g Preemptible vs Non-preemptible

g Is this distinction absolute? Real issue?

g OS makes two related kinds of decisions about resources. What is the goal? g Allocation: who gets what. Implication?

g Scheduling: how long can they keep it. Implication?

g Resource #1: g Processes may be in any one of three general scheduling states: g Running. g Ready. g Blocked. g Goals for scheduling disciplines: g Efficiency of resource utilization. (keep CPU and disks busy) g Minimize overhead. (context switching) g Minimize response time. Define response time. g Distribute cycles equitably. What does this mean?

g FIFO (also called FCFS): run until finished. g Usually, ‘‘finished’’ means ‘‘blocked’’. g Problem?

g Solution: limit maximum amount of time that a process can run without a context switch. This time is called a time slice.

g Round Robin: run process for one time slice, then move to back of queue. Each process gets equal share of the CPU. What if the slice isn’t chosen carefully? g Too long: g Too small:

g Originally, Unix had 1 sec. time slices. Right size? Most systems today use time slices of 10,000 - 100,000 instructions.

g How to implement priorities in RR?

g Is RR always better than FIFO?

g What is the best we can do? Is there "perfect" scheduling algorithm? STCF: shortest time to completion first with preemption. In what sense is it the best?

g Example: two processes, one doing 1 ms computation followed by 10 ms I/O, one doing all computation. Suppose we use 100 ms time slice: I/O process only runs at 1/10th speed, I/O devices are only utilized 10% of time. Suppose we use 1 ms time slice: then compute-bound process gets interrupted 9 times unnecessarily for each valid interrupt. STCF works well.

g Why not using STCF?

g Rule of thumb: Give the most to those who need the least. What’s the idea here?

g The strategy?