---+ +--+ --------->||||-->| |----> Departures Arrivals ---+ +--+ Queue ServerThe scheduling discipline (or policy) is used to select a job out of the queue whenever the server becomes available. Examples of scheduling disciplines are FCFS (First Come First Served), SJF (Shortest Job First), RR (Round Robin).
A scheduling discipline can be simple or complex. Typically, the more frequent the scheduling decisions, the less sophisticated the scheduling discipline that is used. For example, the scheduling discipline used in the ready queue (micro-scheduling), is usually fairly simple, just priority scheduling. The scheduling discipline used for batch or swapped out jobs (macro-scheduling) tends to be more sophisticated.
The following features are used to classify scheduling disciplines (Ruschitzka&Fabry):
| Priority | Decision | Arbitration | Feasibility Scheduling Algorithm | Function | Rule | Rule | ======================================================================== FIFO (FirstInFirstOut) | r | No-Preempt| Random | Realistic ------------------------------------------------------------------------ LIFO (LastInFirstOut) | -r | No-Preempt| Random | Realistic ------------------------------------------------------------------------ SJF (ShortestJobFirst) | -t | No-Preempt| Chronologic | Ideal ------------------------------------------------------------------------ SRT(ShortestRemainTime)| a-t | Preempt | Chronologic | Ideal ------------------------------------------------------------------------ RR (RoundRobin) | constant | Preempt | Cyclic | Realistic =======================================================================
Job | Time ========= 1 | 6 2 | 3 3 | 8 4 | 7The schedule for FCFS is
Exponential Averaging
We have seen that SJF is not directly implementable since we do not have
reliable values for the execution times of jobs. However we may get fairly
satisfactory estimates of the actual execution times. The reasoning goes as
follows.
A job does not execute to completion without interruptions. Instead, it runs for a while, then blocks, then runs again, then blocks, etc. If we focus on these separate runs, and their execution times t1, t2, .., tn, we see a time series. If i runs have already taken place, and we need to estimate the time taken by the (i+1)th run, we can use information about the execution times and the estimated times that have occurred up to now. Here is a method for doing such estimating.
Let a be a real number in the interval [0,1]. Let e1 be an initial time estimate, then, for any i >= 1, we set
Round Robin (RR)
Round Robin is the scheduling discipline whereby, if we are given jobs
j1, j2, ..jn, and we have chosen a time Quantum q, we run j1 for up to
q seconds, then give control to j2 for up to q seconds, then to j3 and so on
until we start again with j1, j2, ... Whenever a job terminates we continue the
round robin with the remaining jobs.
Going back to the jobs considered earlier, let's examine their response time under the RR scheduling discipline for a variety of values of Q.
In case that Q is 2, the schedule has form
In case that Q is 1, the schedule has form >q
As you have seen, in Round-Robin both the schedule and response time change with changes in the Quantum Q. For example, if Q is chosen sufficiently large, say, greater than the service time of any job, then RR becomes equal to FCFS. People have chosen to evaluate RR when the value of the quantum goes to 0. In this case we say that we are in the processor sharing situation.
In our example, job 2 will terminate after 12 seconds, job 1 after a total of 21 seconds, job 4 after a total of 23 seconds, and job 3 after 24 seconds. That is, the (average) Response Time becomes 80/4 = 20.
Notice that:
ingargiola.cis.temple.edu