operating systems scheduling. bursts of cpu usage alternate with periods of waiting for i/o. (a) a...

15
Operating Systems Scheduling

Upload: marybeth-bennett

Post on 05-Jan-2016

223 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Operating Systems Scheduling. Bursts of CPU usage alternate with periods of waiting for I/O. (a) A CPU-bound process. (b) An I/O-bound process. Scheduling

Operating Systems

Scheduling

Page 2: Operating Systems Scheduling. Bursts of CPU usage alternate with periods of waiting for I/O. (a) A CPU-bound process. (b) An I/O-bound process. Scheduling

Bursts of CPU usage alternate with periods of waiting for I/O. (a) A CPU-bound process. (b) An I/O-bound process.

Scheduling – Process Behavior

Page 3: Operating Systems Scheduling. Bursts of CPU usage alternate with periods of waiting for I/O. (a) A CPU-bound process. (b) An I/O-bound process. Scheduling

• Batch• Interactive• Real time

Categories of Scheduling Algorithms

Page 4: Operating Systems Scheduling. Bursts of CPU usage alternate with periods of waiting for I/O. (a) A CPU-bound process. (b) An I/O-bound process. Scheduling

Some goals of the scheduling algorithm under different circumstances.

Scheduling Algorithm Goals

Page 5: Operating Systems Scheduling. Bursts of CPU usage alternate with periods of waiting for I/O. (a) A CPU-bound process. (b) An I/O-bound process. Scheduling

• First Come First Served• Shortest Job First• Shortest Remaining-time Next• High Response-radio First

Batch Systems are usually non-preemptible.

Scheduling in Batch Systems

Page 6: Operating Systems Scheduling. Bursts of CPU usage alternate with periods of waiting for I/O. (a) A CPU-bound process. (b) An I/O-bound process. Scheduling

Important variables

• Arrival time / Finish time (point)• Waiting time / Executing time (period)• Turnaround time = Waiting time + Executing time

= Finish time – Arrival time• Weighting turnaround time

= Turnaround time / Executing time• Response radio = Turnaround time / Executing time

= 1 + Waiting time / Executing time

Page 7: Operating Systems Scheduling. Bursts of CPU usage alternate with periods of waiting for I/O. (a) A CPU-bound process. (b) An I/O-bound process. Scheduling

An example of shortest job first scheduling. (a) Running four jobs in the original order. (b) Running them

in shortest job first order.

Shortest Job First

Page 8: Operating Systems Scheduling. Bursts of CPU usage alternate with periods of waiting for I/O. (a) A CPU-bound process. (b) An I/O-bound process. Scheduling

• Round-robin scheduling• Priority scheduling• Multiple queues• Shortest process next• Guaranteed scheduling• Lottery scheduling• Fair-share scheduling

Scheduling in Interactive Systems

Page 9: Operating Systems Scheduling. Bursts of CPU usage alternate with periods of waiting for I/O. (a) A CPU-bound process. (b) An I/O-bound process. Scheduling

Round-robin scheduling. (a) The list of runnable processes. (b) The list of runnable

processes after B uses up its quantum.

Round-Robin Scheduling

Page 10: Operating Systems Scheduling. Bursts of CPU usage alternate with periods of waiting for I/O. (a) A CPU-bound process. (b) An I/O-bound process. Scheduling

A scheduling algorithm with four priority classes.

Priority Scheduling

Page 11: Operating Systems Scheduling. Bursts of CPU usage alternate with periods of waiting for I/O. (a) A CPU-bound process. (b) An I/O-bound process. Scheduling

11

Scheduling in Real-Time Systems

Schedulable real-time system

Givenm 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 12: Operating Systems Scheduling. Bursts of CPU usage alternate with periods of waiting for I/O. (a) A CPU-bound process. (b) An I/O-bound process. Scheduling

12

Policy versus Mechanism

Separate what is allowed to be done with how it is donea process knows which of its children threads are important and need

priority

Scheduling algorithm parameterizedmechanism in the kernel

Parameters filled in by user processespolicy set by user process

Page 13: Operating Systems Scheduling. Bursts of CPU usage alternate with periods of waiting for I/O. (a) A CPU-bound process. (b) An I/O-bound process. Scheduling

(a) Possible scheduling of user-level threads with a 50-msec process quantum and threads that run 5 msec per CPU burst.

Thread Scheduling (1)

Page 14: Operating Systems Scheduling. Bursts of CPU usage alternate with periods of waiting for I/O. (a) A CPU-bound process. (b) An I/O-bound process. Scheduling

(b) Possible scheduling of kernel-level threads with the same characteristics as (a).

Thread Scheduling (2)

Page 15: Operating Systems Scheduling. Bursts of CPU usage alternate with periods of waiting for I/O. (a) A CPU-bound process. (b) An I/O-bound process. Scheduling