Scheduling

Only available on StudyMode
  • Topic: Real-time computing, Computer multitasking, Scheduling
  • Pages : 18 (1485 words )
  • Download(s) : 90
  • Published : February 11, 2013
Open Document
Text Preview
OPERATING SYSTEMS
1

CPU Scheduling
What Is In This Chapter?


This chapter is about how to get a process attached to a processor.



It centers around efficient algorithms that perform well.



The design of a scheduler is concerned with making sure all users get their fair share of the resources.

5: CPU-Scheduling

2

CPU Scheduling
What Is In This Chapter?










Basic Concepts
Scheduling Criteria
Scheduling Algorithms
Multiple-Processor Scheduling
Real-Time Scheduling
Thread Scheduling
Operating Systems Examples
Java Thread Scheduling
Algorithm Evaluation
5: CPU-Scheduling

3

Scheduling
Concepts

CPU SCHEDULING
Multiprogramming

A number of programs can be in
memory at the same time. Allows
overlap of CPU and I/O.

Jobs

(batch) are programs
without user interaction.

User

(time shared) are programs that
may have user interaction.

Process

is the common name for both.

CPU - I/O burst cycle

Characterizes process execution,
which alternates, between CPU and
I/O activity.
CPU times are
generally much shorter than I/O
times.

that

run

Preemptive Scheduling
An interrupt causes currently
running process to give up the CPU
and be replaced by another process.
5: CPU-Scheduling

4

CPU SCHEDULING

The Scheduler

Selects from among the processes in memory that are ready to execute, and allocates the CPU to one of them
CPU scheduling decisions may take place when a process:
1.

Switches from running to waiting state

2.

Switches from running to ready state

3.

Switches from waiting to ready

4.

Terminates

Scheduling under 1 and 4 is nonpreemptive
All other scheduling is preemptive

5: CPU-Scheduling

5

CPU SCHEDULING

The Dispatcher

Dispatcher module gives control of the CPU to the process selected by the shortterm scheduler; this involves: switching context
switching to user mode
jumping to the proper location in the user program to restart that program Dispatch latency – time it takes for the dispatcher to stop one process and start another running

5: CPU-Scheduling

6

CPU SCHEDULING

Criteria For
Performance
Evaluation

Note usage of the words DEVICE, SYSTEM, REQUEST, JOB.
UTILIZATION

The fraction of time a device is in use. ( ratio of in-use time / total observation time )

THROUGHPUT

The number of job completions in a period of time. (jobs / second )

SERVICE TIME

The time required by a device to handle a request. (seconds)

QUEUEING TIME Time on a queue waiting for service from the device. (seconds) RESIDENCE TIME The time spent by a request at a device.
RESIDENCE TIME = SERVICE TIME + QUEUEING TIME.
RESPONSE TIME Time used by a system to respond to a User Job. ( seconds ) THINK TIME

The time spent by the user of an interactive system to figure out the next request. (seconds)

The goal is to optimize both the average and the amount of variation. (but beware the ogre predictability.)
5: CPU-Scheduling

7

CPU SCHEDULING

Scheduling
Behavior

Most Processes Don’t Use Up Their Scheduling Quantum!

5: CPU-Scheduling

8

CPU SCHEDULING

Scheduling
Algorithms

FIRST-COME, FIRST SERVED:





( FCFS) same as FIFO
Simple, fair, but poor performance. Average queueing time may be long. What are the average queueing and residence times for this scenario? How do average queueing and residence times depend on ordering of these processes in the queue?

5: CPU-Scheduling

9

Scheduling
Algorithms

CPU SCHEDULING
EXAMPLE DATA:
Process

Arrival
Time
0
1
2
3

1
2
3
4

Service
Time
8
4
9
5

FCFS
P1
0

P2
8

P3
12

P4
21

26

Average wait = ( (8-0) + (12-1) + (21-2) + (26-3) )/4 = 61/4 = 15.25 Residence Time
at the CPU

5: CPU-Scheduling

10

CPU SCHEDULING

Scheduling
Algorithms

SHORTEST JOB FIRST:



Optimal for minimizing queueing time, but...
tracking img