Lecture Notes for CPU Scheduling - Operating Systems | CMSC 412, Study notes of Operating Systems

Material Type: Notes; Professor: Hollingsworth; Class: Operating Systems; Subject: Computer Science; University: University of Maryland; Term: Unknown 1989;

Typology: Study notes

Pre 2010

Uploaded on 02/13/2009

koofers-user-2tm
koofers-user-2tm 🇺🇸

10 documents

1 / 14

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
CMSC 412 - S98 (lect 10) copyright 1996 Jeffrey K. Hollingsworth
Announcements
lReading 5 (5.1-5.3,5.6)
lMidterm #1 is March 10 in class
covers material through and including lecture 11
problems at the end of the chapters
synchronization problems
questions about the project
Suggestions for study
see problems on web page
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe

Partial preview of the text

Download Lecture Notes for CPU Scheduling - Operating Systems | CMSC 412 and more Study notes Operating Systems in PDF only on Docsity!

Announcements

l Reading 5 (5.1-5.3,5.6)

l Midterm #1 is March 10 in class

  • covers material through and including lecture 11
    • problems at the end of the chapters
    • synchronization problems
    • questions about the project
  • Suggestions for study
    • see problems on web page

CPU Scheduling

l Manage CPU to achieve several objectives:

  • maximize CPU utilization
  • minimize response time
  • maximize throughput
  • minimize turnaround time

l Multiprogrammed OS

  • multiple processes in executable state at same time
  • scheduling picks the one that will run at any give time (on a uniprocessor)

l Processes use the CPU in bursts

  • may be short or long depending on the job

Process State Transitions

New

Exit

Ready,

suspend Ready^ Running

Blocked

Blocked,

suspend

Long-term scheduling

Medium- term scheduling

Short- term scheduling

Event wait

Long-term scheduling

l Determine which programs admitted to system for

processing - controls degree of multiprogramming

l Once admitted, program becomes a process, either:

  • added to queue for short-term scheduler
  • swapped out (to disk), so added to queue for medium-term scheduler

l Batch Jobs

  • Can system take a new process?
    • more processes implies less time for each existing one
    • add job(s) when a process terminates, or if percentage of processor idle time is greater than some threshold
  • Which job to turn into a process
    • first-come, first-serve (FCFS), or to manage overall system performance (e.g. based on priority, expected execution time, I/O requirements, etc.)

Scheduling criteria

l Per processor, or system oriented

  • CPU utilization
    • maximize, to keep as busy as possible
  • throughput
    • maximize, number of processes completed per time unit

l Per process, or user oriented

  • turnaround time
    • minimize, time of submission to time of completion.
  • waiting time
    • minimize, time spent in ready queue - affected solely by scheduling policy
  • response time
    • minimize, time to produce first output
    • most important for interactive OS

Scheduling criteria

non-performance related

l Per process

  • predictability
    • job should run in about the same amount of time, regardless of total system load

l Per processor

  • fairness
    • don’t starve any processes, treat them all the same
  • enforce priorities
    • favor higher priority processes
  • balance resources
    • keep all resources busy

Algorithms (cont.)

l Round-Robin (RR)

  • use preemption, based on clock - time slicing
    • generate interrupt at periodic intervals
  • when interrupt occurs, place running process in Ready queue, select next process to run using FCFS
  • what’s the length of a time slice
    • short means short processes move through quickly, but high overhead to deal with clock interrupts and scheduling
    • guideline is time slice should be slightly greater than time of “typical job”CPU burst
  • problem dealing with CPU and I/O bound processes

Algorithms (cont.)

l Shortest Process Next (SPN)

  • non-preemptive
  • select process with shortest expected processing time
  • improves response time, but increases its variability, reducing predictability - provably decreases average waiting time
  • problem is estimating required processing time
  • risk of starving longer processes, as long as there are shorter processes around
  • not good for time sharing - non-preemptive

Priority Based Scheduling

l Priorities

  • assign each process a priority, and scheduler always chooses process of higher priority over one of lower priority

l More than one ready queue, ordered by priorities

RQ

CPU

RQ

RQ n

Blocked queue

Admit.

Event Occurs

Event Wait

Preemption

Dispatch (^) Release

Priority Algorithms

l Fixed Queues

  • processes are statically assigned to a queue
  • sample queues: system, foreground, background

l Multilevel Feedback

  • processes are dynamically assigned to queues
  • penalize jobs that have been running longer
  • preemptive, with dynamic priority
  • have N ready queues (RQ0-RQ N ),
    • start process in RQ
    • if quantum expires, moved to i + 1 queue