Download Operating Systems - Process Priority | CMSC 412 and more Study notes Operating Systems in PDF only on Docsity!
Announcements
z
Program #1– Is on the web– Additional info on elf file format is on the web
z
Reading– Chapter 6
Selecting a process to run
z
called scheduling
z
can simply pick the first item in the queue– called round-robin scheduling– is round-robin scheduling fair?
z
can use more complex schemes– we will study these in the future
z
use alarm interrupts to switch between processes– when time is up, a process is put back on the end of the
ready queue
- frequency of these interrupts is an important parameter
- typically 3-10ms on modern systems• need to balance overhead of switching vs.
responsiveness
Process Creation
z
Who creates processes?– answer: other processes– operations is called fork (or spawn)– what about the first process?
z
Have a tree of processes
- parent-child relationship between processes
z
what resources does the child get?
- new resources from the OS• a copy of the parent resources• a subset of the parent resources
z
What program does the child run?
- a copy of the parent (UNIX fork)
- a process may change its program (execve call in
UNIX)
- a new program specified at creation (VMS spawn)
CPU Scheduling
z
Manage CPU to achieve several objectives:– maximize CPU utilization– minimize response time– maximize throughput– minimize turnaround time
z
Multiprogrammed OS– multiple processes in executable state at same time– scheduling picks the one that will run at any give time (on a
uniprocessor)
z
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-termscheduling
Short-termscheduling
Eventwait
Long-term scheduling
z
Determine which programs admitted to system forprocessing - controls degree of multiprogramming
z
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
z
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, expectedexecution time, I/O requirements, etc.)
Scheduling criteria
z
Per processor, or system oriented– CPU utilization
- maximize, to keep as busy as possible
- throughput
- maximize, number of processes completed per time unit
z
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
z
Per process– predictability
- job should run in about the same amount of time,
regardless of total system load
z
Per processor– fairness
- don’t starve any processes, treat them all the same
- enforce priorities
- favor higher priority processes