Top Banner
Scheduling Chap 2
13

Scheduling Chap 2. Scheduling Introduction to Scheduling (1) Bursts of CPU usage alternate with periods of I/O wait –a CPU-bound process –an I/O bound.

Dec 30, 2015

Download

Documents

Cecilia Harvey
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Scheduling Chap 2. Scheduling Introduction to Scheduling (1) Bursts of CPU usage alternate with periods of I/O wait –a CPU-bound process –an I/O bound.

Scheduling Chap 2

Page 2: Scheduling Chap 2. Scheduling Introduction to Scheduling (1) Bursts of CPU usage alternate with periods of I/O wait –a CPU-bound process –an I/O bound.

SchedulingIntroduction to Scheduling (1)

• Bursts of CPU usage alternate with periods of I/O wait– a CPU-bound process– an I/O bound process

Page 3: Scheduling Chap 2. Scheduling Introduction to Scheduling (1) Bursts of CPU usage alternate with periods of I/O wait –a CPU-bound process –an I/O bound.

Introduction to Scheduling

Scheduling Algorithm Goals

Page 4: Scheduling Chap 2. Scheduling Introduction to Scheduling (1) Bursts of CPU usage alternate with periods of I/O wait –a CPU-bound process –an I/O bound.

Two Major Types

• Pre-emptive– O/S can remove a running process.– On the clock or Error

• Non Pre-Emptive– O/S can not remove a running process– Must complete or Block– DO_EVENTS()

Page 5: Scheduling Chap 2. Scheduling Introduction to Scheduling (1) Bursts of CPU usage alternate with periods of I/O wait –a CPU-bound process –an I/O bound.

Scheduling in Batch Systems

An example of first come first served scheduling

A arrives at zero and runs til 10.

B arrives at one and needs 5 units.

C arrives at two and needs 2 units.

D arrivers at three and needs 1 unit.

A finishes at 10, B at 15, C at 17 and D at 18.

Average turnaround is? Average wait is ?

Page 6: Scheduling Chap 2. Scheduling Introduction to Scheduling (1) Bursts of CPU usage alternate with periods of I/O wait –a CPU-bound process –an I/O bound.

Scheduling in Batch Systems

An example of shortest job first scheduling

A arrives at zero and runs til 10.

B arrives at one and needs 5 units.

C arrives at two and needs 2 units.

D arrivers at three and needs 1 unit.

Time line is?

Average turnaround is? Average wait is ?

Page 7: Scheduling Chap 2. Scheduling Introduction to Scheduling (1) Bursts of CPU usage alternate with periods of I/O wait –a CPU-bound process –an I/O bound.

Scheduling in Batch Systems

An example of shortest time remaining scheduling

A arrives at zero and runs til 10.

B arrives at one and needs 5 units.

C arrives at two and needs 2 units.

D arrivers at three and needs 1 unit.

Time line is?

Average turnaround is? Average wait is ?

Page 8: Scheduling Chap 2. Scheduling Introduction to Scheduling (1) Bursts of CPU usage alternate with periods of I/O wait –a CPU-bound process –an I/O bound.

Scheduling in Batch Systems

Three level scheduling

Page 9: Scheduling Chap 2. Scheduling Introduction to Scheduling (1) Bursts of CPU usage alternate with periods of I/O wait –a CPU-bound process –an I/O bound.

Scheduling in Interactive Systems

• Round Robin Scheduling– list of runnable processes– list of runnable processes after B uses up its quantum

Page 10: Scheduling Chap 2. Scheduling Introduction to Scheduling (1) Bursts of CPU usage alternate with periods of I/O wait –a CPU-bound process –an I/O bound.

Scheduling in Interactive Systems

A scheduling algorithm with four priority classes

Page 11: Scheduling Chap 2. Scheduling Introduction to Scheduling (1) Bursts of CPU usage alternate with periods of I/O wait –a CPU-bound process –an I/O bound.

Honesty in Scheduling

• Who is the owner?

• Compute ratio– R = CPU units / CPU possible units

• Lying!

Page 12: Scheduling Chap 2. Scheduling Introduction to Scheduling (1) Bursts of CPU usage alternate with periods of I/O wait –a CPU-bound process –an I/O bound.

Scheduling in Real-Time Systems

Schedulable real-time system

• Given–m periodic events

– event i occurs within period Pi and requires Ci seconds

• Then the load can only be handled if

1

1m

i

i i

C

P

Page 13: Scheduling Chap 2. Scheduling Introduction to Scheduling (1) Bursts of CPU usage alternate with periods of I/O wait –a CPU-bound process –an I/O bound.

A problem

Arrival Time 0 1 2 3

Process/Job A B C D

CPU units 6 3 1 4

Draw a time line for each process using FCFS, SJN, SRT, RR quanta of 2.

Compute turnaround time and wait time for each process.

Compute average turnaround and average wait for each method.