slot_shifting

10

Upload: gokul-vasan

Post on 12-Apr-2017

114 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: slot_shifting

Joint Scheduling of Distributed Complex Periodic and Hard

Aperiodic Tasks in Statically Scheduled Systems

Gerhard Fohler�

Computer Science Department

University of Massachusetts at Amherst� MA ����������

fohler�csumassedu

September ��� ��

Abstract

In this paper we present algorithms for the jointscheduling of periodic and aperiodic tasks in staticallyscheduled distributed real�time systems� Periodic tasksare precedence constrained� distributed� and communi�cating over the nodes of the systems� Both soft andhard aperiodic tasks are handled�

After a static schedule has been created in a �rststep� the algorithms determine the amount and distri�bution of unused resources and leeway in it� These arethen used to incorporate aperiodic tasks into the sched�ule by shifting the periodic tasks� execution� withoutviolating their feasibility� Run�time mechanisms aresimple and require only little memory� Processors andcommunication nodes can be utilized fully� The algo�rithm performs an optimal online guarantee algorithmfor hard aperiodic tasks of O�N��

An extensive simulation study exhibits very highguarantee ratios for various load and deadline scenar�ios� which underlines the eciency of our method�

� Introduction

Processes controlled by real�time computer systemstypically experience phases of continuity as well as ofchanges� Variations in the environment can be re��ected in the real�time system as modi�cations to theentire task set� called mode changes then� Smaller

�This work was funded in part by the National Science Foun�dation under grant IRI���������

�The work presented in this paper was carried out while theauthor was with Institut f�ur Technische Informatik TechnischeUniversit�at Wien Austria and during visits at the University ofMassachusetts�

� This paper has been accepted for the �th Real�Time Sys�tems Symposium Pisa Italy Dec ���

changes may result in the occurrence of tasks with ar�rival times unknown at design time� named aperiodictasks� Research in real�time scheduling has been fo�cused on either continuous or changing phases� Algo�rithms for continuous phases were dealing with guar�anteeing before the run�time of the system that �xedsets of periodic tasks with �xed properties would meettheir timing requirements� Such algorithms have beenpresented for both dynamic e�g�� ��� ��� and staticscheduling� e�g�� ���� The focus of other algorithmswas on�line scheduling of aperiodic tasks� without con�sideration of o �line guarantees� e�g�� ����

As attention was directed towards scheduling ofboth continuous and changing phases� algorithms tohandle mode changes have been presented for dy�namic� ���� ���� and static scheduling� ��� Unipro�cessor schedulability tests have been presented forsporadic tasks� i�e�� tasks with a bound on their oc�currence frequency� �� and mixed task sets of nonpreemptive sporadic and periodic tasks� ���� Jointscheduling of periodic and aperiodic tasks with un�known and unlimited arrival times has been addressedin the context of dynamic scheduling for single proces�sors� Schedulability tests of O�N�� were presented in��� The issue of using resources unused by the pe�riodic tasks on single processors has been studied inthe context of earliest deadline �rst scheduling� ����� gives online acceptance tests of O�N �� E�cientserver algorithms for earliest deadline �rst have beenpresented in ����

Server algorithms for �xed priority scheduling havebeen presented in ���� Later� the slack stealing al�gorithm was introduced� ��� and extended to dealwith hard aperiodic tasks� ���� � and more generalscheduling problems� �� �� As priorities are set ac�cording to the rate monotonic algorithm� ��� theworst case processor utilization achievable is about���� although higher in the average case� These dy�

Page 2: slot_shifting

namic algorithms consider tasks which are restrictedto be independent or synchronize via simple constructson single processors�

Handling soft aperiodic tasks in statically scheduledsystems was addressed in ���� Static scheduling allowsperiodic tasks to have arbitrary precedence constraintsand to be distributed and communicating over severalprocessing nodes� Without further provision� however�it requires the transformation of aperiodic tasks intopseudo periodic ones� ���� which can be prohibitivelyexpensive� or they can only be run� when no periodictasks are ready� which does not allow hard deadlinesfor aperiodics�

In this paper� we present mechanisms for the jointonline scheduling of periodic and aperiodic tasks instatically scheduled systems� This allows us to com�bine bene�ts of static scheduling� in particular a dis�tributed system and complex� precedence constrainedtasks� and dynamic online scheduling� which allows�exible task execution to incorporate aperiodic taskswith both soft and hard deadlines� Processors andcommunication medium can be utilized fully� The on�line mechanisms are very simple and require only littlememory� They can be used to select nodes for the exe�cution of aperiodic tasks and the handling of complex�distributed aperiodic tasks� As our algorithms inte�grate fully with the mode change algorithm ��� theyallow real�time systems to be statically scheduled andhighly �exible towards major and minor changes inthe environment� as detailed in ���

The �rst step of our method is to construct astatic schedule for the periodic tasks� which meets alltiming� synchronization� and communication require�ments� Next� the amount and distribution of unusedresources and leeway� called spare capacities� is deter�mined� So we know for each point in time� by howmuch the execution of the next periodic task can beshifted without missing any deadlines� This is equiva�lent to the amount of aperiodic execution that can beincorporated into the static schedule� It is straightfor�ward to use this information at run�time to performa very simple test whether it is feasible to execute asoft aperiodic task� As the amount and distribution ofunused resources are known in advance as well� we pro�vide an optimal on�line acceptance test for hard ape�riodic tasks� Spare capacities are calculated o �lineand incrementally maintained on�line� so the run�timemechanisms are very simple and require little memory�

The rest of the paper is organized as follows� Sec�tion � lists the task and system model as well as ter�minology used throughout the paper� We present ourmethods for single nodes �rst in sections � and �� The

o �line preparations are described in section �� fol�lowed by the online mechanisms in section �� It ex�plains the guarantee algorithm� online scheduling� andmaintenance of spare capacities� Section deals withextending our method to distributed systems� Theanalysis in section � gives results from a simulationstudy� A summary concludes the paper in section ��

Due to space limitations� we do not give proofs here�The interested reader is referred to ���

� System Description and Task Model

We consider a distributed system� i�e�� one that con�sists of several processing nodes and communicationnodes� Our time model is discrete ���� An externalobserver counts the ticks of the globally synchronizedclock with granularity of slot�length and assigns num�bers from � to � to them� We denote by �in slot i�the time between the start and end of slot i� sloti� i�e��the time�interval �slotlength� i� slotlength� �i�����Slots have uniform length and are synchronized glob�ally� i�e�� they start and end at the same time for allnodes in the system�

A schedule is a sequence of slots sloti i � �� � � � �N���N stands for the number of slots in the schedule� Forstatic schedules� N is typically equal to the least com�mon multiple �lcm� of all involved periods� At run�time� a static schedule is executed repeatedly� i�e�� atslot t of the run�time of the system� slot t mod N isexecuted�� Communication nodes� i�e�� the commu�nication medium� are slotted and pre scheduled aswell� Protocols with bounded transmission times� e�g��TDMA or token ring are applicable� At run�time� adispatcher is invoked at regular time intervals of uni�form length �slot�length� and assigns a task to the pro�cessor each time or leaves it idle�

Tasks are fully preemptive and communicate withthe rest of the system via data read at the beginningand written at the end� The maximum execution time�MAXT� of a task is a calculated upper bound onthe execution time of a task ���� given in slots� Thisnumber of slots is used by the scheduler� regardlessof a � possibly smaller � actual execution time� Tasksynchronization is expressed exclusively by precedenceconstraints� Precedence constraints and tasks� can beviewed as a directed acyclic graph� Tasks are rep�resented as nodes� precedence constraints as edges�Tasks that have no predecessors are called entry tasks�tasks without successors exit tasks� The period of a

�Our algorithms deals with shifting these static executionslots as detailed in the following sections�

Page 3: slot_shifting

precedence graph PG is the time interval separatingtwo successive instances of PG in the schedule� Dead�line intervals are de�ned for the maximum executionof each individual precedence graph� Entry tasks ofinstance i of a precedence graph PG become readyfor scheduling at time i � period�PG�� Exit tasksof instance i of a precedence graph PG have to becompleted by time i � period�PG� � deadline�PG��All other tasks �inside� a precedence graph are con�strained only by the precedence order�

Tasks or precedence graphs may be attributedstatic� indicating their periodic execution and treat�ment by the static scheduler� Tasks not treated bythe static scheduler can be of the following types�along the classi�cation of ����� Sporadic� i�e�� theyhave known minimum inter�arrival time and executiontime� and a given deadline� They are called aperiodic�if no minimum inter�arrival time is given� If a deadlineis assigned� the task is called hard aperiodic� The dis�patcher checks at each invocation for aperiodic tasksthat have arrived during the last slot� We assume thataperiodic tasks are ready to run at the time of theirof arrival�

� O��Line Preparations

In a �rst step� we use a static scheduling algorithmto create scheduling tables for the periodic tasks� Itallocates the tasks to nodes and resolves the prece�dence constraints by ordering the task executions ac�cordingly� Figure � gives an example� These execu�tion sequences consist of subgraphs of the precedencegraphs� that have been separated by the allocation oftasks to nodes� Each of these subgraphs is limitedeither by the sending and receiving of inter�node mes�sages or entry and exit tasks which de�ne the start�times and deadlines� We combine the tasks of thesesubgraphs to scheduling blocks� as depicted in �gure� for the example of �gure �� These are indepen�dent� as all dependencies have been resolved duringo �line scheduling� This grouping reduces the num�ber of items� while scheduling blocks can be treatedin the same way as tasks� Due to space limitations�we cannot discuss this issue in detail here� the inter�ested reader is referred to ��� We will not distinguishbetween tasks and scheduling blocks in the following�

��� Start�times and Deadlines

The scheduling tables list �xed start� and end timesof task executions� that are less �exible than possible�The only assignments �xed by speci�cation� however�

TC

TZ

TY

TB

TD

TAPG0 PG1 task MAXTTA �TB TC TD TZ TY

dl PG�� � �dl PG�� � �

� �

NODE �

NODE �

T�A

T�B � CAAAA

T�B

T�B � DAAAA

T�YT�Z

T�C T�D

Figure �� Example Precedence Graphs and Schedule

� �

NODE �

NODE �

S��

T�B � CAAAA

T�B � DAAAA

S��

S�� S��

scheduling block est MAXT dlS� �TATB� � � �S� �TY TZ� � � �S� �TC� �S� �TD� � �

Figure �� Schedule for Example with SchedulingBlocks

are starts of entry and completion of exit tasks� and�as we assume message transmission times to be �xedfor now�� tasks sending or receiving inter�node mes�sages� The points in time of execution of all othertasks may vary within the precedence order� Based onthat knowledge� earliest start�times and latest �nish�times for all tasks can be calculated per node� As wewant to determine the maximum leeways of task ex�

�We will discuss shifting of messages in section ��

Page 4: slot_shifting

ecutions� we calculate the deadlines to be as late aspossible� Let end�PG� denote the end and start�PG�the start of precedence graph PG according to theschedule� � The start of an inter�node message trans�mission M is denoted start�M �� the time it is avail�able at all receiving nodes end�M �� These are theonly �xed start�times and deadlines� all others are cal�culated recursively with respect to logical successors�i�e�� in the precedence graph� The deadline of task T �dl�T �� of precedence graph PG in a schedule is� If T isexit task� dl�T � � dl�PG�� if T sends an inter�nodemessage M � dl�T � � start�M �� The earliest start�time of task T � est�T �� of precedence graph PG in aschedule is calculated in a similar way� If T is entrytask� est�T � � start�PG�� if T receives an inter�nodemessage M � est�T � � end�M ��

In our approach� earliest start�times serve only toprevent early execution of entry tasks or receivers ofinter�node messages� The precedence order is alreadykept in the execution sequence constructed by thestatic scheduler�

��� Execution Intervals

The deadlines of tasks are then sorted for each nodeand the schedule is divided into a set of disjoint ex�ecution intervals for each node� Spare capacities arede�ned for these intervals�

Each deadline calculated for a task de�nes the endof an interval Ii� end�Ii�� Several tasks with the samedeadline constitute one interval� The earliest start�time of an interval Ii� est�Ii�� is the minimum of theearliest start�times of its constituting tasks� The startof an interval Ii� start�Ii�� is the maximum of its ear�liest start�time or the end of the previous interval� Aninterval Ii is called independent� if there is no intervalIe� e � i with end�Ie� � est�Ii� and no interval Il� i � lwith end�Ii� � est�Il�� The length of an interval Ii isdenoted jIij� Figure � illustrates the intervals for theexample of �gure ��

��� Spare Capacities

Calculating spare capacity of an independent in�terval is straightforward� The executions of such aninterval can be shifted arbitrarily within the intervalboundaries� So the spare capacity �sc� of such an in�terval Ii is given by

sc�Ii� � jIij �X

T�Ii

MAXT �T � ���

�For simplicity of explanation we consider only a single in�stance of the precedence graph� Consequently we do not giveinstance numbers�

We illustrate this by the example depicted in �gures�� The resulting schedule along with earliest start�times� deadlines and spare capacities is shown in �gure�� The spare capacity in interval I� can accommodate

I� I�

I� I�

� �

NODE �

NODE �

S��

T�B � CAAAA

T�B � DAAAA

S��

S�� S��

int start end jIj MAXT sc nodeI� � � � � � �I� � � � � � �I� � � I� � � �

Figure �� Example of Simple Spare Capacities withIndependent Intervals

dynamic activities requiring two slots� that of I� none�Let us have a closer look at the idle slot ��� I� is

tight� i�e�� neither can any further activity be added atrun�time� nor could a speci�ed increase in executiontime of its tasks be accommodated� The schedule as awhole� however� is not tight� i�e�� more or longer tasksof PG� or an aperiodic task can be �tted in� Let usassume the modi�cation to our example that S� hasa MAXT of three slots instead of two� We then con�struct the schedule and calculate� the intervals� andthe spare capacities as described� The resulting sched�ule is given in �gure �� Deadlines and intervals staythe same� so I� is too short by one slot� The additionalexecution slot of S� was �tted into the idle slot � ofI�� In other words� I� �borrowed� one slot from I� to�t in S�� I� can give this one slot from its two idleones� having only one left then� This usage of otherintervals� capacities is indicated by the spare capac�ity value of ��� Apparently� the leeway of I�� i�e�� thespare capacity� will be smaller by the amount �lent��Taking into account the �borrowing� mechanism� wecan now extend equation ��

sc�Ii� � jIij�X

T�Ii

MAXT �T ��min�sc�Ii�� �� �� ���

The spare capacity of an interval is decreased by the

�This example was constructed for illustration purposes�The scheduler would not create the idle slots at � and � withoutS� and S� waiting for inter�component messages�

gokulvasan
Highlight
gokulvasan
Highlight
gokulvasan
Highlight
Page 5: slot_shifting

I� I�

I� I�

� �

NODE �

NODE �

S��

T�B � CAAAA

T�B � DAAAA

S��

S�� S��

int start end jIj MAXT sc node

I� � � � � � �I� � � � � �I� � � I� � � �

Figure �� Example of Simple Spare Capacities withDependent Intervals

amount �lent� to subsequent intervals� Aperiodictasks may be started� when the spare capacity is nonnegative�

� On�Line Mechanisms

During system operation� the on�line scheduler isinvoked after each slot� First� it checks whether ape�riodic tasks have arrived during the last slot� Softaperiodic tasks can be executed when the currentspare capacity is greater than zero� If hard aperiodictasks have arrived� the guarantee algorithm is invoked�Next� one task out of the ready aperiodic or periodictasks is selected for execution or the processor left idle�This decision is then used to update the spare capaci�ties� Finally the scheduling decision is executed in thenext slot�

��� Guarantee Algorithm

At run�time of the system we have a set of tasks Ti�assigned to intervals Ii with deadlines dl�Ii� and sparecapacities sc�Ii�� The current time is denoted t� Wedenote the current spare capacity of the current inter�val Ic at t with sc�Ic�t� sc�Ic�t � sc�Ic�� Now assumea hard aperiodic task TA arrives with known parame�ters est�TA� � t� MAXT �TA�� and dl�TA�� If severalsuch tasks arrive� they are sorted in earliest deadlineorder� Next the guarantee routine is applied to the�rst task� if successful to the second� and so on� Thismay prevent the �nding of an optimal solution� but

reduces the run�time e orts spent for the guarantee��The trivial condition dl�TA� �MAXT �TA� is checkedbefore� The guarantee algorithm shall now decide�whether TA can be accommodated to meet its dead�line without causing any other guaranteed deadline tobe missed�

We identify three parts of the total spare capacitiesavailable�sc�Ic�t� the remaining spare capacity of the currentinterval�P

sc�Ii�� c � i � l� end�Il� � dl�TA� � end�Il��� �dl�TA�� the spare capacities of all full intervals betweent and dl�TA�� andmin�sc�Il���� dl�TA��start�Il�� ��� the spare capacityof the last interval� or the execution need of TA beforeits deadline in this interval� whichever is smaller

If the sum of all three is larger than MAXT �TA��TA can be accommodated� and therefore guaranteed�To prevent other hard aperiodic tasks from using sparecapacities needed by TA� we recalculate the spare ca�pacities and intervals from right to left taking intoaccount that the resources for TA are not availablefor other tasks� This applies the latest deadline laststrategy� which has been shown to provide maximumquantity of processor idle time available for processingsporadic tasks� by Chetto and Chetto ���

Unless dl�TA� � dl�Il�� the interval where dl�TA�lies in� Il��� needs to be split� A simple decreas�ing of sc�Il��� might result in the following� Assumethat TA has been guaranteed as described� and thatsc�Il���new � sc�Il���old � �dl�TA� � start�Il�����Then another hard aperiodic task T �A arrives withdl�TA� � dl�T �A� andMAXT �T �A� � sc�Il���new� Thealgorithm would guarantee T �A� because T �A requestsless execution time than the spare capacity in that in�terval� It needs these spare capacities� however� beforeits deadline� but these are already needed for TA� Thiswill result in either TA or T �A missing its deadline�

Therefore Il�� is split into two intervals� after TAhas been guaranteed� Il���left � �start�Il���� dl�TA��and Il���right � �dl�TA�� end�Il����� Then the sparecapacities of all intervals Ii� c � i � Il���right arerecalculated�

In order to perform the acceptance test� we have togo through the intervals up to the aperiodic�s dead�line� If it is accepted we have to possibly create a newone and then update these intervals� Thus� the com�plexity of our guarantee algorithm is O�N �� N beingthe number of intervals� N can be large when periodsare not harmonically related� Unless the aperiodic�s

�We might even think of limiting the number of task arrivalsat a time�

Page 6: slot_shifting

deadline is signi�cantly larger than that of the othertasks� the number of intervals we have to go through�i�e�� up to the aperiodic�s deadline� will be una ectedby the maximum N � It is shown in ��� that this ac�ceptance test has equivalent results � but with simplerrun�time handling � as to the ones presented in ���and ��� which are optimal for single processors� Dueto space limitations we do not give proofs here� Theinterested reader is referred to ���

��� On�Line Scheduling

On�line scheduling is performed locally for eachnode� We have the set of tasks Ti� consisting ofstatic� guaranteed� and soft aperiodic tasks� withknown est�Ti�� MAXT �Ti�� and dl�Ti�� and the setof intervals Ii� The scheduler is given the ready set�R�t� � fT jest�T � � tg and the set of intervals andspare capacities� It may choose one task out of theready set or leave the CPU idle� We identify the fol�lowing cases�R�t� � fg� There are no tasks ready to be scheduled�the CPU remains idle�R�t� �� fg � sc�I�t � � � �T � T soft aperiodic� T isexecuted�R�t� �� fg�sc�I� � �� A static or guaranteed task hasto be executed� Zero spare capacity indicates� thatadding further activities will result in a deadline vio�lation of the task set�R�t� �� fg� sc�I�t � ����T � T soft aperiodic� A staticor guaranteed task is executed� The task with theearliest deadline in R�t� is selected� Ties are brokenarbitrarily� e�g�� by index number�

��� Maintenance of Spare Capacities

The decision of the scheduler is now used to updatethe spare capacities depending on which type of taskwas selected for execution�Aperiodic execution� One slot of the spare capacities isused to execute a slot of a dynamic task� Obviously�the spare capacity of the current interval has to bedecremented by one�No execution� One slot of spare capacity is used with�out dynamic processing� The spare capacity has to bedecremented by one� too�Static execution� Executing a static task T only swapsspare capacities� Depending on the interval to whichthe executed task belongs to� the current interval Iior a subsequent one Ij � j � i is a ected�T Ii� The amount of spare capacity is not changedfor any interval�

T Ij � One slot of spare capacities is swapped be�tween Ii and Ij � sc�Ii� is decremented by one� sc�Ij�is incremented by one� This is� however� not gener�ally complete� There might be one or more intervalsIk� i � k � j in between Ii and Ij � This will happen ifthe start�time constraint for Ii and the intervals Ik hasnot been ful�lled yet� while that of Ij has� If Ij hasnegative spare capacity� it borrowed spare capacitiesfrom Ij��� If one slot of execution of Ij has been exe�cuted in Ii� this slot need not be executed in Ij� whichwill need to �borrow� one slot less from Ij��� Then�the same applies to Ij�� also� If Ij�� had spare capac�ity� it now has to borrow one slot less from Ij��� So�the spare capacities of the consecutive� with decreasingindices� �lending� intervals Il� i � l � j� sc�Il� � �are increased�

We will now illustrate the run�time maintenance ofspare capacities with the example of �gure � and showhow negative spare capacities are forced to becomenon�negative by our mechanisms� Let us assume thatno dynamic activities are requesting execution at thebeginning of the schedule� i�e�� before slot �� Then� S�can execute in slots � � �� and S� in slots � � � Twoslots of S� execute in I�� One has been given by theborrowing mechanism� the other is the one unused byaperiodics� So S� needs two slots less of its interval I��They are added to the spare capacity� sc�I�� � ���� � �� One slot is available for aperiodic tasks inI�� Both �surplus� slots in I�� one more than precalculated� have been used by S�� so sc�I�� � ��� ��� which re�ects the situation correctly�

Let us assume one slot of I� was used for dynamicactivities� Then no idle slots are available for fur�ther dynamic execution and so S� has to execute inslots � � �� and S� is forced to start execution in slot�� which is in I�� So S� will not need this slot inI� anymore and the spare capacity of I� is increased�sc�I�� � �� � � � �� So when I� starts� its sparecapacity is non�negative� as required�

� Global Shifting

The local approach deals with incorporating aperi�odic tasks on single nodes only� In this section� we ex�tend it to handle aperiodic activities in the distributedsystem�

��� Shifting Inter Node Messages

The global shifting mechanism� allows inter�nodemessages to be shifted as well� This enables earlierexecution on the receiving node� As for tasks on

Page 7: slot_shifting

each node of the system� static scheduling de�nes anexecution sequence of messages for the communica�tion medium� Consequently� messages can be shiftedwithin that sequence in the same manner as tasks onprocessing nodes� The restricted accessibility of thecommunication medium� as imposed by protocols asTDMA or token ring� has to be taken into account�though� The methods for deriving start�times anddeadlines� the construction of intervals� and the cal�culation of spare capacities remain unchanged and isapplied to the communication nodes as well�

The di erence for global shifting is that inter�nodemessages can be sent earlier� i�e�� the earliest start�times of tasks receiving these messages will decreaseat run�time� This may extend intervals and in turnincrease spare capacities� Let MIM denote an inter�node message that is scheduled to be received at timeend�M sched

IM �� It is received earlier at run�time� attime end�Mnew

IM �� end�MnewIM � � end�M sched

IM �� Fur�thermore� IiIM stands for the interval that the taskreceiving MIM is assigned to� The early transmissionof MIM may have one of the following e ects�Spare capacities of IiIM increase� This is the casewhen end�IiIM��� � start�IiIM �� Then IiIM�� andIiIM do not overlap� they are independent� Letus assume MIM was sent � slots earlier� Thenend�Mnew

IM � � end�M schedIM � � �� � � � and the spare

capacities of IiIM are given as sc�InewiIM� � sc�IschediIM

����

Spare capacities of other intervals increase� Theearly receiving of MIM enables tasks assigned to IiIMto be executed early using unused spare capacities inearlier intervals� increasing the spare capacities of theintervals they were scheduled to execute in� Let Iearlybe the interval with early � iIM and end�Iearly� �end�M sched

IM � and end�Iearly� � end�MnewIM �� There

exist intervals Ij with early � j � iIM � Let unuseddenote the slots of unused spare capacities in these in�tervals� Then tasks Tk IiIM can execute in unused�and thus increment spare capacities in the intervalsthey were scheduled to execute in�

No spare capacities increase� The decreasing ofstart�times does not necessarily allow tasks to startearly� e�g�� if the schedule is tight� In that case nospare capacities are increased� and the global mecha�nism performs in the same way as the local one�

��� Node Selection

The local guarantee algorithm determines� whetheran aperiodic task that has arrived at a particular nodecan be executed on that node feasibly� If the task isnot accepted� it will be discarded� In a distributed

system� however� other nodes might be capable of ac�cepting this task ���� We can use the local guaranteealgorithm to perform a system wide acceptance test�By subsequently performing the local guarantee algo�rithm for a task on all nodes� we can decide whetherthe task can be accepted anywhere in the system� Thisrequires that aperiodic tasks arrive at a selected node�which in turn initiates the local tests for each aperi�odic in sequence� While this method is simple� it isnot optimal if more than one aperiodic task arrives tothe system at the same time� Tasks are guaranteedand assigned to nodes in sequence� one by one� So adi erent task order for the acceptance test may resultin a di erent set of guaranteed tasks�

��� Distributed ComplexAperiodic Tasks

We use static scheduling to prepare the complex pe�riodic tasks for on�line scheduling� It transforms thesetasks into simple independent� start�time�deadlineconstrained tasks on single processors� To handle dis�tributed complex aperiodic tasks� we propose a similarstep� They can be transformed into single indepen�dent� deadline constrained aperiodic tasks on singleprocessors using the method described in ��� Duringschedule preparation� each of these aperiodic tasks isbroken down into a set of aperiodic tasks assigned tocertain nodes� Upon the arrival of a complex aperiodictask at run�time� this set of tasks is known for eachnode� So we perform the local acceptance test on allnodes for all these tasks� Only if all tasks comprisingthe complex aperiodic task can be guaranteed at allnodes� it is accepted�

� Analysis

We have implemented the described mechanismsand have run simulations for various scenarios� Thesystem simulated consists of � processing nodes� con�nected via a TDMA driven communication medium�Some ���� task�sets were generated and scheduled bythe MARS scheduler ��� We randomly generated ape�riodic task loads for each of these� so that the com�bined load of static and aperiodic tasks was set to �������� ���� ���� and ����� Aperiodic tasks were sim�ple and preassigned to processing nodes� The deadlinefor the aperiodic tasks was set to their MAXT and twotimes MAXT� We studied the guarantee ratio of the� randomly arriving � aperiodic tasks� and the perfor�mance of both local and global scheme� Each pointrepresents a sample size of ��� � ���� task sets� ���con�dence intervals were smaller than ��

Page 8: slot_shifting

Figure depicts the overall simulation results� The

0.0 20.0 40.0 60.0 80.0 100.0Combined Static and Aperiodic Load %

0.00

0.20

0.40

0.60

0.80

1.00

Guara

ntee R

atio

Guarantee Ratio for Aperiodic TasksLocal Shifting

Deadline = MAXTDeadline = 2 * MAXT

0.0 20.0 40.0 60.0 80.0 100.0Combined Static and Aperiodic Load %

0.00

0.20

0.40

0.60

0.80

1.00

Guara

ntee R

atio

Guarantee Ratio for Aperiodic TasksGlobal Shifting

Deadline = MAXTDeadline = 2 * MAXT

Figure � Guarantee Ratio for Aperiodic Tasks

graphs show the e�ciency of the slot shifting mech�anisms� as guarantee ratios are very high� As ex�pected� the guarantee ratio for aperiodic tasks withlarger deadlines is higher than for smaller deadlines�Even under high load� guarantee ratios stay high� Asexpected� global shifting is superior to local shifting�The di erence decreases for low loads� Low loads pro�vide large amounts of spare capacities and leeways� Soeven the local mechanism will be able to guarantee ahigh number of aperiodic tasks�

We have further studied the in�uence of thetightness of timing constraints of the staticallyscheduled tasks on the guarantee ratio� Weused the following scheme to test the algo�rithm under di erent deadline and periodicity con�straints� Two parameters� period laxity�pl� and

deadline laxity factor �df� were used to set dead�lines and periods of precedence graphs� respectively�as follows� period�PG� � total cost�PG� � pl anddl�PG� � period�PG� � df where total cost isthe sum of the computation as well as communicationwithin a precedence graph� The results presented herehave the following settings� pl of ��� and ��� and dfof ���� ��� and ���� load was generated for ��� and���� The resulting guarantee ratios are depicted in�gure �� Note that each plot consists of two graphs�one for each setting of pl�

0.6 0.8 1.0 0.6 0.8 1.0Deadline Factors

0.00

0.20

0.40

0.60

0.80

1.00

Guar

antee

Rati

o

Guarantee Ratio for Aperiodic TasksLocal Shifting

Load = 40 %Load = 80 %

pl = 1.2 pl = 1.5

0.6 0.8 1.0 0.6 0.8 1..0Deadline Factors

0.00

0.20

0.40

0.60

0.80

1.00

Guar

antee

Rati

o

Guarantee Ratio for Aperiodic TasksGlobal Shifting

Load = 40 %Load = 80 %

pl = 1.2 pl = 1.5

Figure �� Guarantee Ratio for Aperiodic Tasks underDi erent Timing Constraints of Statically ScheduledTasks

The plots of the individual settings follow the sametendencies as of the overall guarantee ratio discussedabove� As deadlines increase� guarantee ratios do so�too� since more leeway in the deadlines allows for more

Page 9: slot_shifting

shifting� The guarantee ratios of both approaches ben�e�t from the increased leeways of schedules with largerperiods�

Summary

In this paper we presented algorithms for the jointscheduling of precedence constrained distributed pe�riodic and hard and soft aperiodic tasks in staticallyscheduled systems� The systems under considerationare assumed to be consisting of a set of nodes� con�nected by an inter node communication medium withbounded transmission times such as TDMA� Our ap�proach� slot shifting� makes use of the unused resourcesand leeways in static schedules� called spare capacities�to incorporate aperiodic tasks�

In a �rst step� static schedules are created forthe distributed� precedence constrained periodic tasks�The created scheduling tables are then used to deter�mine spare capacities� While the periodic tasks arecomplex and distributed� the spare capacities are as�signed locally to each node in the system� We use thespare capacities to test� whether aperiodic tasks can beexecuted without violating the feasibility of periodictasks� If an aperiodic task is executed� the executionof the periodic tasks is shifted� We presented an op�timal on�line guarantee algorithm for hard aperiodictasks of O�N�� N the number of tasks on that node�

In order to re�ect distribution� we have presentedextensions to allow for the shifting of inter node mes�sage as well� Furthermore� we addressed guidelines forthe selection of nodes to execute aperiodic tasks andto handle distributed complex aperiodic tasks usingthe slot shifting algorithm as basis�

As the major part of the calculations involved isperformed o �line during schedule preparation� theon�line mechanisms are very simple and require onlylittle memory� Nodes can be fully utilized� Implemen�tation and analysis by extensive simulation of the slotshifting algorithm show its e�ciency� The resultingguarantee ratios of aperiodic tasks were high for vari�ous load and deadlines scenarios� Our algorithms inte�grate fully with the mode change algorithm ��� Thisallows real�time systems to be statically scheduled andhighly �exible towards major and minor changes in theenvironment�

Using the slot shifting algorithms� future researchwill include issues of integrating sporadic tasks� i�e��aperiodic tasks with lower bounds on their inter�arrival times� using priorities to indicate importance�and ellaborating on node selection and complex ape�riodic task handling�

Acknowledgements

The author wishes to thank Krithi Ramamrithamfor his interest in the work� fruitful discussions andhelpful comments� Hermann Kopetz and the MARSresearch team for support� establishing a creative at�mosphere� and countless discussions� The studentChristian Erlacher implemented the work presentedhere and provided many useful comments� Finally� avery sincere thanks goes to Dr� Epiniki Politschnig ofNeunkirchen hospital� whose outstanding competence�initiative� and persistence saved the author�s life in acritical medical situation� allowing this paper to bewritten�

References

�� N�C� Audsley� R�I� Davis� and A� Burns� Mech�anisms for enhancing the �exibility and util�ity of hard real�time systems� In Proc� �thReal�Time Systems Symposium� pages ������ SanJuan� Puerto Rico� Dec� �����

�� S�K� Baruah� A�K� Mok� and L�E� Rosier�Preemptively scheduling hard�real�time sporadictasks on one processor� In Proc� th Real�TimeSystems Symposium� pages �������� Dec� �����

�� H� Chetto and M� Chetto� Scheduling periodicand sporadic tasks in a real�time system� Infor�mation Proceedings Letters� ����������� February�����

�� H� Chetto and M� Chetto� Some resultson the earliest deadline scheduling algorithm�IEEE Transactions on Software Engineering����������������� October �����

� R�I� Davis� K�W� Tindell� and A� Burns� Schedul�ing slack time in �xed priority pre�emptive sys�tems� In Proc� �th Real�Time Systems Sympo�sium� pages �������� Dec� �����

�� M� DiNatale and J�A� Stankovic� Dynamic end�to�end guarantees in distributed real�time sys�tems� In Proc� �th Real�Time Systems Sympo�sium� pages ������� San Juan� Puerto Rico� Dec������

�� G� Fohler� Analyzing a pre run�time schedulingalgorithm and precedence graphs� Research Re�port �� ��� Institut f!ur Technische Informatik�Technische Universit!at Wien� Vienna� Austria�September �����

Page 10: slot_shifting

�� G� Fohler� Realizing changes of operational modeswith pre run�time scheduled hard real�time sys�tems� In Proc� of the Second International Work�shop on Responsive Computer Systems� Saitama�Japan� October �����

�� G� Fohler� Flexibility in Statically ScheduledReal�Time Systems� PhD thesis� Technisch�Naturwissenschaftliche Fakult!at� Technische Uni�versit!at Wien� Wien� !Osterreich� April �����

��� M�R� Garey� D�S� Johnson� B�B� Simons� andR�E� Tarjan� Scheduling unit�time tasks with ar�bitrary release times and dead lines� IEEE Trans�actions on Software Engineering� �������������May �����

��� K� Je ay� Scheduling sporadic tasks with sharedresources in hard�real�time systems� In Proc� �th Real�Time Systems Symposium� pages ������ Dec� �����

��� H� Kopetz� Sparse time versus dense time in dis�tributed real�time systems� In �th Int� Conf� onDistributed Computing Systems� pages ��������Yokohama� Japan� June �����

��� J�P� Lehoczky and Sandra Ramos�Thuel� An opti�mal algorithm for scheduling soft�aperiodic tasksin �xed�priority preemptive systems� In Proc� �th Real�Time Systems Symposium� pages �������� Dec� �����

��� J�P� Lehoczky� L� Sha� and J�K� Strosnider� En�hanced aperiodic responsiveness in hard real�timeenvironments� In Proc� �th Real�Time SystemsSymposium� pages �������� �����

�� C� L� Liu and J� W� Layland� Scheduling algo�rithms for multiprogramming in a hard�real�timeenvironment� Journal of the ACM� ������������Jan� �����

��� A� K� Mok� Fundamental Design Problems of Dis�tributed Systems for the Hard Real�Time Envi�ronment� PhD thesis� Massachusetts Institute ofTechnology� ����� Report MIT LCS TR�����

��� P� Puschner and Ch� Koza� Calculating the maxi�mum execution time of real�time programs� Real�Time Systems� ������������ Sep� �����

��� K� Ramamritham� Allocation and scheduling ofcomplex periodic tasks� In �th Int� Conf� onDistributed Computing Systems� pages ������������

��� K� Ramamritham� G� Fohler� and J��M� Adan�Issues in the static allocation and scheduling ofcomplex periodic tasks� In Proc� �th IEEEWorkshop on Real�Time Operating Systems andSoftware� NY� NY� USA� May �����

��� L� Sha� R� Rajkumar� J� Lehoczky� and K� Ra�mamritham� Mode change protocols for priority�driven preemptive scheduling� Real�Time Sys�tems� ������������ December �����

��� L� Sha� R� Rajkumar� and J� P� Lehoczky� Prior�ity inheritance protocols� An approach to real�time synchronization� IEEE Transactions onComputers� C��������������� September �����

��� M� Spuri and G�C� Buttazzo� E�cient aperi�odic service under earliest deadline scheduling� InProc� �th Real�Time Systems Symposium� pages����� San Juan� Puerto Rico� Dec� �����

��� J� A� Stankovic� K� Ramamritham� and S��C�Cheng� Evaluation of a �exible task schedulingalgorithm for distributed hard real�time systems�IEEE Transactions on Computers� ������� Dec�����

��� S� R� Thuel and J�P� Lehoczky� On�line schedulingof hard deadline aperiodic tasks in �xed�prioritysystems� In Proc� �th Real�Time Systems Sym�posium� pages �������� Dec� �����

�� S� R� Thuel and J�P� Lehoczky� Algorithms forscheduling hard aperiodic tasks in �xed�prioritysystems using slack stealing� In Proc� �thReal�Time Systems Symposium� pages ������ SanJuan� Puerto Rico� Dec� �����

��� K�W� Tindell� A� Burns� and A�J� Welling� Modechanges in priority pre�emptively scheduled sys�tems� In Proc� �th Real�Time Systems Sympo�sium� pages �������� Dec� �����