Scheduling Algorithms For Real-Time Systems
Scheduling Algorithms For Real-Time Systems
1. Periodic tasks have constant known execution times Priority inheritance protocol (PIP)[8] dynamically changes
and are ready for execution at the beginning of each the priority of a task if it is blocking a higher priority task.
period(T ). The priority is then set to the priority of the task it is
blocking. This is referred to as inheriting the priority. The
2. Deadlines(D) for tasks are at the end of each period:
amount of times a high priority task can be blocked is the
(D = T ) number of semaphores it will use. So if a task will use m
semaphores it can in worst case be blocked m times per exe-
3. The tasks are independent, that is, there is no prece- cution. A problem with this protocol is that it does not pre-
dence between tasks and they do not block each other. vent deadlock. Deadlock is when some task holds at least one
semaphore and still tries to lock another semaphore taken
4. Scheduling overhead due to context switches and swap- by another task in a similar state and this will cause the
ping etc. are assumed to be zero. system to halt.
• Idle is the opposite of active, Pexe < PS . • Worst case processing time TP
• RTS is the time at which the server replenishes con- • Resource requirements TR
sumed capacity.
Premises for tasks are that they are independent, nonperi-
The sporadic server starts with fully replenished capacity. odic, non-preemptive and use resources in shared or exclu-
Whenever the server becomes active RTS is set to the cur- sive mode. When scheduling a task the algorithm calculates
rent time added to the period of the server. How much the earliest start time, TEST for the task based upon when
the server should replenish at RTS is determined when the the required resources will be available. The following con-
server becomes idle or all the capacity has been consumed. dition is to be true for every task when a new schedule is
The amount to replenish is the capacity consumed from the made:
point the server was activated to the point it becomes idle
0 < TA < TEST < (TD − TP )
or runs out of capacity. The sporadic server performs bet-
ter than the background server and the polling server. The All tasks that are at any one point to be scheduled is placed
performance is comparable to the DS and PE algorithms al- in a list sorted according to deadline and a schedule is searched
though they are in some cases inferior to the SS algorithm. for by using a tree structure to find feasible schedules in
which the root is an empty schedule and each leaf is a sched- server algorithms have a drawback in that they violate a
ule while not every leaf is feasible. The tasks are inserted requirement of the rate monotonic algorithm stating that a
into the schedule, which then is one node level down in the task should be ready to execute at the beginning of every
tree, one at a time until a schedule is found or a deadline period. Yet, servers offer an advantage when dealing with
miss will occur. In the case of a miss there will be some back aperiodic tasks. Another kind of extension algorithms are
tracking in the tree and a new schedule will be looked at and protocols of which some are mentioned in this paper. They
so forth until a plausible schedule is found. Every time an- aid in dealing with mutual exclusion and deadlocks.
other task is to be inserted there is a heuristic function H,
which looks at more than deadline, is called to evaluate a This shows that the complexities on uniprocessor systems
portion of the tasks in the list to find the most appropriate can be quite high and yet it is far greater on multiproces-
task to insert into the schedule at that point. sor systems which are becoming the commonplace even in
small real-time systems. As complexity increases utilization
The original version of this algorithm looked at all tasks that decreases and on multiprocessor systems with static priority
were not in the schedule every time a task was to be added, scheduling it can be at most 50%[17].
but this algorithm only looks to the first few in a sorted
list and this near sightedness is what makes the algorithm Multiprocessor systems are the future as we see it now, but
myopic. Compared to the non-myopic version of this algo- finding algorithms that takes full advantage of these systems
rithm and to other multiprocessor algorithms of its time the is an arduous task in which much effort has been and is
myopic algorithm was an efficient improvement. The my- being made by researchers. Future work could be to focus
opic algorithm is O(nk) where 1 ≤ k ≤ n depending on the on these new algorithms being produced as well as dynamic
number of tasks to be scheduled at the time as n equals all based server algorithms.
tasks to be scheduled and k is a subset there of. This then
makes the myopic algorithm have O(n) while the original
non-myopic algorithm was O(n2 ).
5. REFERENCES
[1] Burns A.,”Scheduling hard real-time systems: a review”
Software Engineering Journal, May 1991.
Pfair scheduling algorithms[14] are based upon the idea of
giving each task access to resources in proportion to the [2] Burns A. and Audsley N., ”REAL-TIME SYSTEM
demand for resources it has in comparison to the other tasks SCHEDULING” Predicatably Dependable Computer
scheduled. Tasks are given a new attribute called rational Systems, Volume 2, Chapter 2, Part II. or Department of
weight (x.w) which is defined as execution requirement (x.e) Computer Science, University of York, UK.
divided by period (x.p), in which x.e and x.p are integer [3] Mohammadi A. and Akl S. G., ”Scheduling Algorithms
values and x.p > 1. To be schedulable 0 < x.w < 1 must be for Real-Time Systems”, Technical Report No. 2005-499,
true for any task and the sum of all tasks x.w < m, where School of Computing, Queen’s University Kingston,
m is the sum of all resources. Tasks are then split into Ontario Canada K7L 3N6, July 15, 2005.
subtasks, that is points where a task may be preempted so [4] Cottet F., Delacroix J. and Mammeri Z., ”Scheduling in
another will get access to resources for awhile, and a function Real-Time Systems”, published by John Wiley & Sons
is used to determine how to schedule these subtasks such Ltd, Chichester, West Sussex, England, ISBN
that all requirements are met. In addition there are several 0-470-84766-2, year 2002.
rules governing how this is done correctly to get the greatest [5] Liu C.L. and Layland J.W., ”Scheduling Algorithms for
benefit from this approach. There are at least three known Multiprogramming in a Hard-Real-Time Environment”
optimal pfair algorithms: PF[14], PD[15] and ER-PD[16]. Journal of the Association for Computing Machinery,
vol. 20, no. 1, pp. 46-61., year 1973.
4. SUMMARY AND CONCLUSIONS [6] Strosnider J. K., Lehoczky J. P. and Sha L., ”The
Deferrable Server Algorithm for Enhanced Aperiodic
In the simple case, scheduling may seem straight forward
Responsiveness in Hard Real-Time Environments”, IEEE
and is easy enough to understand, but once more tasks are
Transactions on Computers, vol. 44, no. 1, January 1995.
added it becomes more troublesome to complete a schedule.
Introducing several resources makes for more complicated [7] Leung J. Y.-T., Whitehead J., ”On the complexity of
schedules and increases complexity in the algorithms used fixed priority scheduling of periodic, real-time tasks”,
to create these schedules. The requirements that real-time Performance Evaluation, vol. 2, issue 4, pages 237-250,
systems must fulfill are several and equally many are the December 1982.
approaches how to schedule such systems. As mentioned in [8] Sha L., Rajkumar R. and Lehoczky J. P., ”Priority
this paper optimal algorithms exist but their optimality is Inheritance Protocols: An Approach to Real-Time
often only theoretical and not practical in actual systems. Synchronisation”, IEEE Transactions on Computers
39(9), pp. 1175-1185, September 1990.
The scheduling of aperiodic and sporadic tasks is more dif- [9] Dertouzos M., ”Control robotics: The procedural control
ficult than periodic tasks due to their unpredictability. To of physical processes”, Proc. IFIP Cong., pp. 807-813,
overcome this, algorithms based on server tasks for handling year 1974.
aperiodic arrivals are one solution. Algorithms of this kind [10] Dertouzos M.L. and Mok A.K.L., ”Multiprocessor
are an extension to the scheduling algorithm governing the On-Line Scheduling of Hard Real-Time Tasks” IEEE
system. All servers presented in this paper are based upon Transactions on Software Engineering, vol. 15, no. 12,
systems working on the rate monotonic algorithm, but there December 1989.
are other server algorithms extending systems based on the [11] Sprunt B., ”Aperiodic Task Scheduling for Real-Time
earliest deadline first algorithm. Several of the presented Systems” Ph.D. Dissertation, Department of Electrical
and Computer Engineering, Carnegie Mellon University,
August 1990.
[12] Ramamritham K., Stankovic J. A. and Shiah P.-F.,
”Efficient Scheduling Algorithms for Real-Time
Multiprocessor Systems”, IEEE Transactions on Parallel
and Distributed Systems, vol. 1, no. 2, April 1990.
[13] Carpenter J., Funk S., Holman P., Srinivasan A.,
Anderson J. and Baruah S., ”A Categorization of
Real-time Multiprocessor Scheduling Problems and
Algorithms”, Handbook of Scheduling: Algorithms,
Models, and Performance Analysis, Edited by J. Y.
Leung, Published by CRC Press, Boca Raton, FL, USA,
year 2004.
[14] Baruah S.K., Cohen N., Plaxton C.G., and Varvel D.,
”Proportionate progress: A notion of fairness in resource
allocation.”, Algorithmica, 15:600-625, year 1996.
[15] Baruah S.K., Gehrke J. and Plaxton C.G., ”Fast
scheduling of periodic tasks on multiple resources”,
Proceedings of the 9th International Parallel Processing
Symposium, p. 280-288, April 1995.
[16] Anderson J. H. and Srinivasan A., ”Early-Release Fair
Scheduling”, Department of Computer Science,
University of N. Carolina, Chapel Hill, NC 27599-3175,
year 2000.
[17] Andersson B. and Jonsson J., ”The utilization bounds of
portioned and pfair static-priority scheduling on
multiprocessors are 50%”, Department of Computer
Engineering, Chalmers University of Technology, SE-412
96 Göteborg, Sweden, year 2003.