CPU scheduling algorithms
multilevel feedback queue is defined by the following characteristics
-# of queues -scheduling alg. -alg. for moving processes b/w queues -alg. to decide queue a process starts in
when higher queue has relative priority over lower queue
-each queue gets a time slice, which it can schedule as smaller slices to its processes -avoids starvation, but higher processes more likely to be disrupted by lower-priority ones
multilevel queue scheduling algorithms
-higher queue has absolute priority over lower queues -higher queue has relative priority -combination
in round robin, the time slice(q) needs to be
-large enough with respect to context switch time -small enough for system to be continually responsive
first-come first-served
-processes all allocated to CPU in order they arrive -simplest -processes run until completing -not preemptive
weaknesses of priority
completely dependent on the priority being set reasonably -a process might get one so bad it never runs
round robin
define a time quantum/slice, set timer interrupt to stop running process if burst is longer than slice -ready processes added to back of queue
priority(scheduling algorithm)
each process has a priority that determines how soon it is scheduled compared to other processes -priority can be # or func
processes in a multilevel queue
each process is permanently assigned a given queue based on input or an inherent property
round robin is like
first come first served but redesigned to add preemption
strengths of priority
flexible
strengths of shortest job first
guaranteed to produce an optimal schedule in terms of waiting time
when higher queues have absolute priority over lower queues
higher-importance processes less likely to be stalled by lower-importance ones, but this might lead to starvation for some processes
multilevel feedback queue
multilevel queue where processes can move between queues
multilevel queue not useful for
nonpreemptive systems
weakness of shortest job first
not possible, longer processes might never get run
average waiting time for round robin
often long
shortest job first
processes are scheduled to CPU with priority to process with next-shortest burst -can be preemptive or non
soft real-time scheduling just requires that
processes run with absolute priority over other processes
multilevel queue
ready queue partitioned into multiple separate queues -queues are given a priority order
strengths of first-come first-served
really simple, easy to write and understand
combination of absolute/relative priority in multilevel queues
schedule top 2 queues(system, quasi-realtime) have abs. priority over rest -priority w/in those 2 is relative
absolute priority leads to
starvation, almost always a bad idea
the round robin is the basis of
the scheduling algorithm for most interactive time-sharing systems
round robin designed for
time-sharing systems
in round robin, each process is guaranteed
to have to wait at most (n-1)q time units until it gets the processor back
weaknesses of first-come first-served
unpredictable wait times and performance - nonpreemptive nature makes it unsuitable for modern OSs
real-time scheduling
used for processes that need to respond to events as quickly as possible
hard real-time scheduling requires that
we either service process's latency requirements or refuse the process
starvation
when a process has such a bad priority that some other process always has a better one and it never runs