• Keine Ergebnisse gefunden

Scheduling Algorithms for Hybrid Task Sets

5.4 A PERIODIC R EQUESTS

5.4.2 Scheduling Algorithms for Hybrid Task Sets

In this sub-section we consider existing algorithms for the scheduling of hybrid task sets, which consist of periodic tasks with hard deadlines and aperiodic requests. We will focus our discussion on works in the context of EDF scheduling for the following two reasons:

• The current implementation uses two earliest deadline scheduling algorithms: EDF and EDL (earliest deadline as late as possible);

• EDF, and EDL too, has a utilization-based schedulability criterion with an utiliza-tion bound of 1. Basing the implementautiliza-tion on such an algorithm bears the poten-tial to achieve a similarly high utilization factor.

The task model underlying the following algorithms deviates from ours. It models aperi-odic requests as soft, rather than firm tasks. They are not characterized by a common worst-case execution time or deadline either. Therefore, no acceptance test is performed for the aperiodic requests; they are served on a best-effort basis, the goal being to minimize their response times. Furthermore, the periodic jobs are instances of simple, hard tasks, not task pairs of course. The implication of this latter difference will be discussed in Sub-Section 5.4.3, where we introduce our approach. These differences notwithstanding, con-sidering these works is still worthwhile because of the two major analogies with our model: aperiodic requests must not compromise the guarantees given for periodic tasks and should be completed as soon as possible. The presentation is based on (Stankovic et al.

1998), which gives a good survey of the field. We do not strive to give a complete over-view here, but restrain ourselves to those algorithms relating to the scheduling algorithm we present in the following sub-section (5.4.3). In what follows, conventional periodic tasks are represented as τi = (Ti,Ci), where Ti is the period and Ci the worst-case execution time, and the utilization factor of a set of periodic tasks {τi = (Ti,Ci) | i ∈ 1..n} is defined as

=

=

i i

i

T U C

1

: n .

5.4.2.1 The Dynamic Priority Exchange (DPE) Server

The DPE server is a periodic server task that handles aperiodic requests; that is, aperiodic requests are executed during the times allocated for the server task (Spuri and Buttazzo 1996). Without additional measures, the time allocated for the server task is assigned to the other periodic tasks and is lost for the execution of aperiodic requests whenever no aperi-odic request is waiting to be served when the server task becomes the highest priority task in the pending queue. The basic idea of the DPE server is to let the server task exchange its allocated executions times with lower priority periodic tasks if no aperiodic requests are pending. This means that the lower priority tasks run at the priority of the server task until the execution time allocated for the server has been consumed. When an aperiodic request arrives afterwards, the allocated execution time is exchanged back to the server so that the server can use it to execute the aperiodic request. Thus, the execution times allocated for the server task are not lost if no aperiodic request is pending, but they are preserved to be used later.

In more detail, the DPE server works as follows. So-called aperiodic capacities (or capaci-ties, for short) are associated with all periodic tasks. Each capacity is assigned a priority according to the deadline of the last released instance of the corresponding periodic task, even if that instance has been completed already. In case a task and a capacity have the same deadline, ties are broken in favor of capacities. Whenever an instance of the server task is released, the corresponding capacity is set to the execution time allocated for the server task; all other capacities are initially 0. When an aperiodic capacity Γ is the highest priority entity ― task or capacity ― the scheduler chooses a task instance to execute in the following priority order:

1. A pending aperiodic request;

2. The periodic task instance with the shortest deadline;

3. The idle task.

The scheduler executes the selected task instance for at most Γ time units and subtracts the time the instance was running from the capacity Γ. When a periodic instance runs under a capacity for ∆t time units the capacity associated with that task increases by ∆t. So, if a periodic instance runs under a capacity, this means that the capacity is exchanged and pre-served in the system.

Figure 5-9. Example schedule of the DPE server (cf. (Stankovic et al. 1998 p. 171)).

Figure 5-9 shows an example schedule of the DPE server. In the depicted scenario, there are two periodic tasks, τ1 = (8,2) and τ2 = (12,3), and a DPE server, DPE = (6,3). The bold lines in the figure visualize the aperiodic capacities of the instances. At time 0, the highest priority entity is the capacity of the DPE server. The scheduler executes the first instance of τ1 (J1,1) and, for 1 time unit, the first instance of τ2 (J2,1) under that capacity. Accord-ingly, both instances accrue a capacity themselves. The remaining 2 time units of J2,1 are executed under the capacity of J1,1, which is now the highest priority entity. Thus, by time 5, J2,1 has accrued a capacity of 3, which at that time becomes the highest priority entity.

This capacity is exhausted by time 8 with executing the idle task, since there is neither an aperiodic request nor a periodic task instance pending. So, the initial capacity of 3 time units, which was preserved until time 5 is lost by time 8. At time 8, J1,2 is released and is executed under the capacity of the DPE server; so J1,2 accrues a capacity of 2 time units meanwhile. During times 10 to 12, the capacities of the server and of J1,2 are spent for the idle task. When J2,2 is released at time 12, it is first executed for one time unit under the capacity of J1,2 and then, for another time unit, under the capacity of the server. So it has a total capacity of 2 time units when an aperiodic request is released at time 14. At that time the highest priority entity is the capacity of the server. Therefore, the aperiodic request is executed for 2 time units under that capacity and then, for another two time units, under the capacity of J2,2. At that time (18), the capacity of the server is replenished so that there are 3 further time units available to execute the request, which is sufficient to complete it.

This example nicely shows, how the capacities initially allocated for the server task are preserved by exchanging them with the periodic tasks.

5.4.2.2 The Earliest Deadline Late (EDL) Server

The EDL server is an optimal algorithm w.r.t the response times of aperiodic requests (Spuri and Buttazzo 1996). It works as follows: As long as no aperiodic request is pending the periodic tasks are executed according to EDF. When an aperiodic request arrives, say at time t, the scheduler computes the idle times of an EDL schedule for the current job set J(t). Under EDL scheduling, jobs still have priorities according to their deadlines, a shorter deadline implying a higher priority, but tasks are executed as late as possible (Chetto and Chetto 1989). The set J(t) comprises all periodic task instances active at time t with their remaining allocated processing times ― their WCET minus the processing time they already received ― and all future periodic instances within the same hyper period with their WCET. The EDL server assigns the thus computed idle times to the aperiodic request. Once the request has been completed, the scheduler returns to normal operation;

that is, it schedules the periodic instances according to EDF.

Figure 5-10 gives an example of how the EDL server works. Two periodic tasks have to be scheduled, τ1 with a period of 6 and a WCET of 3, and τ2 with a period of 8 and a WCET of 3. The instances of these tasks are scheduled with EDF until time 8 when an aperiodic request arrives (light gray in the figure). At this time, the scheduler computes an EDL schedule for the remaining periodic instances in the hyper period (represented by the dashed boxes in the figure). For the current instance of τ1, only its remaining allocated processing time of 1 is considered. The lowest graph in Figure 5-10 (a) depicts the idle times of this schedule (denoted by the function ω(t)). Figure 5-10 (b) shows how the scheduler proceeds after computing the EDL schedule. First, it executes the aperiodic re-quest during the idle times of the EDL schedule. After two time units, at time 10, the ape-riodic request is completed. Afterwards, it returns to EDF scheduling for the peape-riodic in-stances.

The optimality of this algorithm w.r.t the response times of the aperiodic requests stems from a result presented in (Chetto and Chetto 1989). They show that for any time t, there is no other scheduling algorithm providing more idle times during [0,t] than EDL. Thus, a maximum of idle times is made available whenever an aperiodic request arrives. The main problem with this algorithm is the time complexity of computing the idle times of the EDL schedule. As this computation has a complexity of O(Nn), where n is the number of peri-odic tasks and N is the number of instances within a hyper period, it may not be practically feasible to use this approach (Stankovic et al. 1998). In particular, N may be quite large if the tasks do not have harmonic periods. Hence, it is worthwhile looking for a scheduling algorithm that comes close to the EDL server regarding response times of the aperiodic requests, but incurs less overhead. The IPE server presented in the following clause is such an algorithm.

Figure 5-10. Example schedule for the EDL server

5.4.2.3 The Improved Priority Exchange (IPE) Server

The IPE server avoids the computational overhead of the EDL server, yet still achieves a near optimal performance w.r.t the response times of aperiodic requests (Spuri and But-tazzo 1996). It combines ideas from the DPE and the EDL server. In principle, it works nearly the same way as the DPE server. What changes is the way in which the capacities of the server task are replenished. While in the DPE server the initial capacities are replen-ished periodically by some fixed amount of time allocated for the server task, the IPE server uses the idle times of an EDL schedule of the periodic tasks to replenish the server capacities. This means that whenever an idle time interval of the EDL schedule starts, a capacity equal to the length of the idle time interval is added to the capacity of the server task. As EDL maximizes those idle times (Chetto and Chetto 1989), it maximizes the ini-tial capacities of the server tasks.

Exchanging capacities works the same way as in the DPE server. Capacities get priorities according to their deadlines. The capacity of the server always has the highest priority. If a

capacity is the highest priority entity, a task instance is selected for execution under the capacity in the following order:

1. A pending aperiodic request;

2. The periodic task instance with the shortest deadline;

3. The idle task.

So, if no aperiodic request is pending, the capacity is exchanged with a periodic instance so that it is preserved and can be used when an aperiodic request arrives later.

The IPE server has been shown to exhibit a performance, which is comparable to that of the EDL server and hence nearly optimal w.r.t the response times of aperiodic requests (Spuri and Buttazzo 1996). Furthermore, it feasibly schedules each periodic task set with a processor utilization not greater than one. Expressed more formally, this means: For each set T := {τj = (Tj,Cj) | j ∈ 1..n} of periodic tasks, the IPE server feasibly schedules T if and only if

1 :

1

=

= n

i i

i

T U C

The drawbacks of the IPE server as compared to the DPE server, or other periodic server approaches, is that it is based on the idle times of an EDL schedule of the periodic task set, which is computed offline. Storing the idle times incurs a certain memory overhead, in particular if the periods of the periodic tasks are not harmonic. The current implementation of TAFT (Becker and Gergeleit 2001,Becker et al. 2003), which is also based an EDL schedule for a periodic task set (for the exception parts in this case), shows that using an EDL schedule for the periodic tasks is a viable solution. We therefore decided to base our implementation on the IPE server due to the advantages stated above.