Process Management
a process manager manages processes, so what's a process?
it is not quite the same as a program or an executable file
consider this
life-cyle for a process
and how each transition comes about
the fact that programs need different resources at different times allows for
multiprogramming
multiprogramming will lead to a lot of jumping around in the
flow of control
from the hardware's perspective
the process manager portion of the OS needs to keep up with all the processes
so there is a
process table
with an
entry for each process
consider how this entry helps when context-switching and what needs to be saved/restored
in addition to keeping up with each process' information, the process manager must also track order in a
queue
Process Scheduling
schedulers can be
non-preemptive
or
preemptive
; preemptive requires an interval timer
how do we decide who get the CPU at any given time? priority - either implicitly or explicitly
most scheduling systems can also change a process' priority as needed
a good scheduler will prevent
starvation
some non-preemptive scheduling algorithms:
first come first serve (FCFS)
shortest job first (SJF) (also called shortest job next or SJN)
assigned priority
deadline
measuring effectiveness with service time, wait time, turnaround time (or its inverse, throughput rate)
consider how these measures apply to a fast-food drive-through
compute these measures for the following list of processes for FCFS and SJF
Process Number (Arrival Order)
Service Time
0
350
1
125
2
475
3
250
4
75
generally the optimal schedule given known service times is SJF
however, in the real world, most of the time we really don't know the service time until the program finishes running
another unrealistic aspect of this exercise is we haven't taken into account any I/O
furthermore, scheduling normally takes place in concert with context-switching and that means it is preemptive
in a preemptive scenario, service time is broken up into pieces called
quantums
some preemptive scheduling algorithms:
round-robin (RR)
multiple-level queues (also called multilevel feedback queues)
consider how RR would work with the earlier process list