Top Banner
1 Scheduling Introduction to Scheduling Bursts of CPU usage alternate with periods of I/O wait a CPU-bound process an I/O bound process
15

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

Mar 28, 2015

Download

Documents

Sarah White
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: 1 Scheduling Introduction to Scheduling Bursts of CPU usage alternate with periods of I/O wait –a CPU-bound process –an I/O bound process.

1

SchedulingIntroduction to Scheduling

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

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

2

When to Schedule

1. At process creation

2. At process termination

3. At blocking system calls

4. At I/O interrupt

Preemtive and non-preemtive scheduling algorithms

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

3

Goals of Scheduling

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

4

Scheduling in Batch Systems (1)

(a) First-come-first-served (FCFS)

(b) Shortest-job-first (SJF) - provably optimal if all jobs are known in advance

(c) Shortest-remaining-time-next (SRTN)

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

5

Scheduling in Batch Systems (2)

Three level scheduling

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

6

Scheduling in Interactive Systems (1)

• Round Robin Scheduling(a) list of runnable processes(b) list of runnable processes after B uses up its quantum

Length of quantum:– too short => waste of CPU time– too long => poor response

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

7

Scheduling in Interactive Systems (2)

A scheduling algorithm with four priority classesStatic and dynamic priority allocations, e.g. 1/f.

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

8

Scheduling in Interactive Systems (3)

• Multiple queues• Shortest process next; aging (weighted average)• Guaranteed scheduling (1/n)• Lottery scheduling - biased randomness, passing tickets• Fair share scheduling

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

9

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 10: 1 Scheduling Introduction to Scheduling Bursts of CPU usage alternate with periods of I/O wait –a CPU-bound process –an I/O bound process.

10

Policy versus Mechanism

• Separate what is allowed to be done with how it is done– a process knows which of its children threads

are important and need priority

• Scheduling algorithm parameterized– mechanism in the kernel

• Parameters filled in by user processes– policy set by user process

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

11

Thread Scheduling (1)

Possible scheduling of user-level threads• 50-msec process quantum, threads run 5 msec/CPU

burst

Application-specific thread schedulers

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

12

Thread Scheduling (2)

Possible scheduling of kernel-level threads• 50-msec process quantum• threads run 5 msec/CPU burst

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

13

UNIX Scheduler

The UNIX scheduler is based on a multilevel queue structure

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

14

Scheduling in Windows (1)

Mapping of Win32 priorities to Windows 2000 priorities

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

15

Scheduling in Windows (2)

Windows 2000 supports 32 priorities for threads