Download CPU scheduler

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

DNIX wikipedia , lookup

Burroughs MCP wikipedia , lookup

Process management (computing) wikipedia , lookup

Transcript
CPU scheduling
6. Schedulers, CPU Scheduling
6.1. Schedulers
Short term, Long term, Medium term schedulers.
6.2. CPU Scheduling
6.2.1. CPU- I/O burst cycle
6.2.2. CPU scheduler
6.2.3. Dispatcher
6.3. Scheduling Criteria
6.4. Scheduling Algorithms
First Come First Served. Shortest Job First. Priority Scheduling.
Round Robin. Multilevel queues, Multilevel feedback queues.
Textbook Silberschatz 6th ed. Chapter 6
CPU scheduling
Schedulers
Long Term Scheduler
•
•
•
•
Is called not so often.
Controls the degree of multiprogramming (# of processes in memory).
Good mix of I/O bound and CPU bound proc. ?
Some systems do not have long term scheduler. ?
HDD
Dispatch
CPU
Queues
Interrupt
Short Term (CPU) Scheduler
• Is called very often
• Decides how to pick a process
• Does Context Switching
• queues
Must be
very fastits lifetime.
A process migrates between the various scheduling
throughout
CPU scheduling
Medium Term Scheduling
CPU scheduling
Medium Term Scheduling
Some operating systems, such as time-sharing systems, may introduce an
additional, intermediate level of scheduling.
This medium-term scheduler, removes processes from memory (and from
active contention for the CPU), and thus reduces the degree of
multiprogramming.
CPU scheduling
CPU-I/O Burst Cycle
Scheduling is a fundamental operatingsystem function.
Almost all computer resources are
scheduled before use. The CPU is, of course,
one of the primary computer resources.
Thus, its scheduling is central to operatingsystem design.
The success of CPU scheduling depends on
the following observed property of
processes:
CPU scheduling
CPU-I/O Burst Cycle
Histogram of CPU-burst Times
I/O Bound program
many very short CPU bursts
CPU Bound program
a few very long CPU bursts
CPU scheduling
Preemptive and Non-Preemptive

CPU scheduler Selects from among the processes in ready
queue, and allocates the CPU to one of them


Queue may be ordered in various ways
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 only 1 and 4 is nonpreemptive

Otherwise scheduling is preemptive
CPU scheduling
Preemptive and Non-Preemptive
Preemptive (interruptible) scheduling
Non Preemptive scheduling
We intentionally do not allow the process to
take the resource continuously. We preempt
(interrupt) it using some algorithm.
 Divide CPU time into time slices (10100ms). CPU runs a process no more than
one time slice
 Use some priorities to interrupt the running
process.

All new OS are preemptive:



Windows 95 and later
Unix systems
Latest Macintosh OS
Advantage: Fast, Effective.
Disadvantage: Expensive, Complex.

Processes are given control of the processor
until they complete execution or voluntarily
move themselves to a different state.
we use only free time of resources which are
not captured by the current process
Mainly old OS are non preemptive:



Mainframe Systems
Old Windows 3.1 OS
New Systems without timer
Advantage: Simple implementation.
Disadvantage: Not effective. CPU could
be captured for a long time by one process.
CPU scheduling
Dispatcher
Dispatcher – Does the remaining tasks after the process selection – Gives
control to the process.
• Context Switch
• Switching between Kernel-User modes
• Jumping to the proper location in the program to continue it.
Dispatch latency - stop one process and start another – Should be very
short