scheduling chap 2. scheduling introduction to scheduling (1) bursts of cpu usage alternate with...

13
Scheduling Chap 2

Upload: cecilia-harvey

Post on 30-Dec-2015

228 views

Category:

Documents


0 download

TRANSCRIPT

Scheduling Chap 2

SchedulingIntroduction to Scheduling (1)

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

Introduction to Scheduling

Scheduling Algorithm Goals

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()

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 ?

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 ?

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 ?

Scheduling in Batch Systems

Three level scheduling

Scheduling in Interactive Systems

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

Scheduling in Interactive Systems

A scheduling algorithm with four priority classes

Honesty in Scheduling

• Who is the owner?

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

• Lying!

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

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.