Chapter 3. Density First with Minimum Non-overlap Scheduling Algorithm
3.1 A New Heuristic Function
In the first phase, a heuristic function is used to decide the priorities of tasks. A task with the highest priority will be selected to be scheduled first. Most scheduling algorithms described in section 2.2 use deadlines and earliest finish times as the integrated heuristic function. This implies that tasks which may or have to finish earlier are given higher priorities.
Nevertheless, real-time tasks are not concerned about when to start computation but rather about meeting their deadlines. For example, tasks with earlier deadlines or finish times may have small computation times so that they are still schedulable even with lower scheduling order. On the other hand, tasks with later deadlines or finish times should be given higher
priorities if their computation times are large with respect to their schedulable intervals. The question of whether or not a task Ti could be scheduled by its deadline depends on the relationship between the schedulable intervals of Ti and its computation times on each processor. Thus, we introduce a concept of density as the heuristic function.
The time of all schedulable intervals for a task is called schedulable time generally. The density of a task is a ratio of the computation time to the schedulable time. When the computation time needed by Ti is getting closer to its schedulable time, we say that Ti has large density. With large density, it is less flexible to schedule Ti. That is, if Ti does not have higher priority of scheduling order, it may be rejected because the schedulable time is getting less after other tasks are scheduled. Conversely, if the computation time needed by Ti is small with respect to its schedulable time, i.e. small density, Ti may be still schedulable with lower priority. This is because it is easier to find schedulable intervals for tasks with small density than tasks with large density. Before we give the formal definition of density, some terminologies will be defined first.
Let Pri and Bki be the primary and backup copies of task Ti respectively, and Proc is the set of all processors in the system. Because of the time exclusion between primary and backup copies of a task, the scheduled start time of Bki must be greater than or equal to the scheduled finish time of Pri. It implies that the deadline of Ti, di, is impossible to be the latest finish time of Pri, and the ready time of Ti, ri, is also impossible to the earliest start time of Bki. In the following, the start or finish time for primary and backup will be redefined. First, Bki is impossible to be scheduled if the interval between the scheduled finish time of Pri and di is less than the minimum computation time of Ti. Thus, Pri must be finished before its latest finish time, LFP(Ti). Actually, LFP(Ti) could be thought of as the deadline of Pri. Finally, we give the following definitions.
Definition 3.1 The Latest Finish time of Primary (LFP) is defined as:
In additional to the LFP, Ti has the earliest finish time for its primary.
Definition 3.2 The Earliest Finish time of Primary (EFP) is defined as:
}
The scheduled start time of Bki could be as early as the earliest finish time of Pri. Thus, we define the earliest start time of backup (ESB) for Ti as:
ESB(Ti) = EFP(Ti) (3) ESB(Ti) could also be thought of as the ready time of Bki. With the definitions of LFP and ESB, we could claim that Pri should be scheduled between ri and LFP(Ti), and Bki should be scheduled between ESB(Ti) and di.
Neither primary nor backup of a task could be scheduled on the processors without sufficient schedulable time for it. The processor on which the primary or backup could be scheduled may be different. Thus, we define a set of available processors for the primary and backup respectively. Each set contains processors on which the primary (backup) can be scheduled.
Definition 3.3 We define availP(Pri), the set of available processor for Pri, and availP(Bki), the set of available processor for Bki, as follows:
(1) availP(Pri) = { processor j }, where there is at least one time slot greater than or
equal to cij between ri and LFP(Ti) on processor j. The slot cannot be overlapped with any scheduled tasks, neither primaries nor backups.
(2) availP(Bki) = { processor j }, where there is at least one time slot greater than or equal to cij between ESB(Ti) and di on processor j. The slot can be overlapped with any scheduled backups.
Here, we give an example to demonstrate the above definitions. We assume there are four processors in the system, the current time is 10, and there are three tasks have arrived into the system. Fig. 3.1 shows the current schedule, and Table 3.1 lists the attributes of the tasks in the queue. This example will be used for illustration throughout this chapter. In this example, Pr9 must finish before the time = 40 because the Br9 may be scheduled on processor 3 where T9 has the maximum computation time. Thus, the LFP(T9) is 40. Pr9 could start at time = 17, and has the earliest finish time, 26, on processor 2. This implies Bk9 could start as early as time = 26. Thus the ESB(T9) is 26. Pr9 can be scheduled in the range from the ready time, r9 = 10, to the LFP(T9), 40. On processor 3, there are two time slots, (10, 15) and (28, 40), which are not reserved for any task yet between r9 and LFP(T9). But both of them are less than c93 so that Pr9 could not be scheduled on processor 3. Similarly, Pr9 could not be scheduled on processor 4 because the only unreserved time slot between r9 and LFP(T9), (21, 30), is less than c94. Thus, the set of processors which Pr9 can be scheduled, i.e. availP(Pr9), is {processor 1, processor 2}. Bk9 can be scheduled in the range from the ESB(T9), 26, to the deadline, d9 = 45. Between ESB(T9) and d9, we assume all scheduled backups may be overlapped with Bk9. On processor 1, 2, 3, there are time slots large enough to execute Bk9. However, time slots (26, 30) and (40, 45) are too small to execute Bk9. Thus, the availP(Bk9) is {processor 1, processor 2, processor 3}.
As we mentioned early in this section, the density of a task is a ratio of the computation
d Table 3.1. Attributes of tasks in the task queue.
ri di ci1 ci2 ci3 ci4
T9 10 45 5 11 15 10
T10 10 50 15 14 11 10
T11 10 37 5 7 5 8
time to its schedulable time. First, because of the two copies of a task, the computation time needed by Ti includes the time for Pri and Bki. Actually, we define the time needed by primary and backup as the average computation time on those processors in the availP(Pri) and
availP(Bki) respectively.
Definition 3.5 For task Ti, we define Pr_mean, the average computation time of Pri on availP(Pri), and Bk_mean, the average computation time of Bki on availP(Bki) as follows:
)
Fig. 3.1. The schedule at time = 10. Dark shading areas depict scheduled primaries. Grey shading areas depict scheduled backups.
availP(Bki) respectively.
Next, the schedulable time for Ti is the sum of time slots which are schedulable for Pri or ki.
aries or backups on processor
B A time slot, represented as (start, end), which is schedulable for Pri on processor p is defined as prslotip. prslotip must satisfies the following conditions: (1) start≥ri , (2)end ≤LFP(Ti), (3)end −start≥cip, (4) prslotip cannot be overlapped with any scheduled prim p. A time slot which is schedulable for Bki on processor p is defined as bkslotip. Similarly, bkslotip must satisfy: (1) start≥ESB(Ti ), (2) end ≤di , (3)end−start ≥cip, (4) bkslotip cannot be overlapped with s es on r p. F chedulable time is the sum of all prslot
cheduled primari processo or Ti, the total s
efinition 3.6 The Sum of Schedulable Time of Ti, named SST, is defined as:
ip and bkslotip.
After introducing the above definitions, we could define the new heuristic function, me
efinition 3.4 For each task Ti in the task queue, we define the density heuristic function as:
na d density function, as follows.
D
The density of a task indicates the tightness of the interval between the ready time and the deadline with respect to its computation time. The highest density means that it is least flexible to schedule a task. On the other hand, low density means that it is easy to find
schedulable intervals for primary and backup. Thus, we will select the task with the maximum density in task selection phase. It is to be noted that the density is defined for a task Ti, rather than Pri or Bki separately. The reason is that Ti will be rejected if either Pri or Bki fails to be scheduled. Getting less flexible to schedule either Pri or Bki implies that it is also inflexible to schedule Ti.
Table 3.2 gives an example of density calculation for the tasks in table 3.1. T10 are given
Table 3.2. Density calculation for T9, T10, T11 in Table 3.1.
LFP ESB
the highest priority even though both of the EFT(Pr10) and d10 are larger than the other tasks.
availP(Pr) availP(Bk) Pr_mean Bk_mean
∑
prslot∑
bkslot density9 40 26 proc1,2 proc1,2,3 8 10.333 0.220
T10 40 36 proc1,3 proc2,3,4 13 11.667 29 38 0.368
T11 32 15 proc1,2,3,4 proc1,2,3,4 6.25 6.25 36 54 0.139
T 28 55
.2 Minimum Non-Overlap (MNO) for Backup
DNA starts to
3
After selecting the task with the maximum density in the first phase,
schedule the primary and backup in the second phase. As many scheduling algorithms for heterogeneous systems, we will schedules the primary on the processor where it could finish as early as possible. In the next step for scheduling backup, most algorithms like those described in section 2.2.1 also assign a backup to a processor according to the earliest finish time. The processor time reserved for backups, however, is redundant and will be deallocated if their primaries finish successfully. If the processor time reserved for backups could be minimized, there is more schedulable time for other new tasks. An intuitive method for this idea is to overlap backups as much as possible. It works for homogeneous systems, but doesn’t work for heterogeneous systems. This is because the computation time of a task varies from processor to processor in heterogeneous systems. For a task Ti, having the maximum
overlapped time on processor p does not necessarily mean that Ti also has the minimum
defined as:
, for each
non-overlapped time on processor p. The non-overlapped time is actually the extra processor time being reserved for Bki. For example, in Fig. 3.2, lines with double arrows represent the computation time and the possible schedule of Bki where it has the minimum non-overlapped time on that processor. It is shown that Bki has the maximum overlapped time on processor 1, however 6 extra time units, i.e. interval (23, 29), are required. Similarly, 6 extra time units will be required for processor 2. Bki has the minimum non-overlapped time, 2, on processor 3 means that only 2 extra time units will be reserved for it. Thus, we will intend to minimize the extra time being reserved for backups, i.e. non-overlapped time. That is, a backup will be scheduled on the processor where it has the minimum non-overlapped time. We give the definition of minimum non-overlap of a backup as follows.
Definition 3.7 The Minimum Non_Overlap (MNO) of Bki is }
, where Maxoverlapip is the maximum overlapped time of Bki on process
ma m pe
minimum non-overlapped time of Bki is 2 on processor 3.
10 15 20 25 30 35 40
rocessor where
in Fig.3.3. The schedule of Bk10 on processor 2 is exactly the ter
After introducing the concepts of density and MNO, the complete algorithm of DNA is ws the flow of our DNA algorithm. Similar to most On each processor, we try to find the maximum overlapped time for Bki in order to minimize the non-overlapped time. Finally, Bki will be scheduled on the p
MNO(Bki) is obtained.
For the example in section 3.1, T10 has the maximum density and Pr10 is scheduled on processor 1 by its EFT shown
in val (ESB(T10), d10), and the non-overlapped times is 7. On processor 3, there is no any backup to be overlapped with so that the non-overlapped time equals the c10,3, 11. On processor 4, Bk4 could be overlapped with Bk10 completely, and the non-overlapped time is only 3. Obviously, if Bk10 is scheduled on processor 4, the extra processor time reserved for it is only 3. Thus, MNO(Bk10) is 3 and Bk10 will be scheduled on processor 4 even though the maximum overlapped time is on processor 2, and the earliest finish time is on processor 3.
3.3 The DNA Algorithm
described in this section. Fig. 3.4 sho
Bk10
heuristic scheduling algorithms, the steps involved in DNA divided into two phases. The two phases repeats continuously until the task queue is empty. The first phase is to select the task with the maximum density as the candidate to be scheduled. In the second phase, we try to schedule the primary copy of the selected task first. If successfully, the next step is trying to schedule the backup copy. A task is said to be scheduled successfully only if both copies are scheduled successfully. Conversely, the selected task will be rejected if either the primary or
Is the task queue empty?
YES
Fig. 3.4 Flow chart of DNA algorithm NO
Modify heuristic values of tasks affected by Ti
Select the task Ti with the maximum density heuristic value
Schedule Pri by EFT
Schedule bki by MNO Calculate the density heuristic
for all tasks initially
Bk11
the backup fails to be scheduled. For the previous example, after T10 is scheduled successfully, we recalculate the density e remaini The next one to be scheduled is T9 with density = 0.395, and T11 is the last one. The final schedule is shown in Fig. 3.5.
It is to be noted that after a task with the maximum density has been selected, we schedule the primary first, and then, schedule the backup immediately. This is different from
many fa ed algorith yopic and FTMA which
schedule their backups as d 2, 8]. The reason is that the density heuristic function determines the priorities among all original tasks, neither primaries nor
backups. The advantage is t tion any more. That is,
the distance parameter in distance myopic algorithm and the separated task queues in FTMA are eliminated.
of th ng tasks, T9, T11.
ult-tolerant sch primaries and
uling ms, such as distance m istinct tasks [
hat there is no need for task queue construc
It is also to be noted that we have no checking strong feasibility and backtracking which are used in distance myopic and FTMA [2, 8]. The purpose of checking strong feasibility is for looking ahead. Although the feasibility check window decreases the number of tasks to be checked, the overhead of checking each task exists at each selection phase. We just apply the density heuristic function to all the remaining tasks in the task queue. Because of the assumption of dynamic systems and scheduler model defined in chapter 2, the number of
30 35
tasks in the task queue should not become so large while the scheduler starts scheduling. Thus, the overhead of the task selection shall not be very heavy. We need no backtracking in our
neither chec he stron of th urrent partial schedule, nor backtrack to the previous schedule if the selected task is not schedulable. It is just s eduling all the tasks one by one.
Because we take all tasks into consideration in the task selection phase e complexity of worst ca e is O(n2 n is the numbe f tasks be sch uled. T compl ty is hi er than that of FTMA and distance myop shall not be very large in the assumption of our scheduler model. In addition, a trick could also reduce the run time cost.
The density heuristic function is applied to all tasks only before the repeat of the two scheduling phases. After a task is scheduled successfully, the heuristic function may not be applied to all the remaining tasks in the next task selection phase. Only those tasks, which have schedulable time slots overlapped with the just scheduled primary or backup, will be given the recalculated density.
In the next chapter, we will evaluate our DNA algorithm using simulation. The simulation result of DNA will compare with distance myopic and FTMA.
algorithm. If either primary or backup fails to be scheduled, this task is just rejected. Both steps of checking and backtracking will increase the running time of algorithms in realistic
systems. Thus, we k t g feasibility e c
ch
, th
). r o to ed he exi gh
s
ic, O(n). Nevertheless, n
Chapter 4. Simulation and Performance Evaluations
In this chapter, we will evaluate the performance of density first with minimum non-overlap scheduling algorithm (DNA) through simulation. In section 4.1, we will describe the architecture of the simulator and some simulation parameters. Next, we will give the performance evaluations in section 4.2.
4.1 Simulation Construction
Because DNA is a dynamic scheduling algorithm, we will construct a dynamic simulation instead of a static simulation. The flow of dynamic simulation is divided into two parts. The first one is the task generator which generates a set of real-time tasks as the input of the second part, simulator. The simulator simulates the events in the systems and the actions of the scheduler. In the following, we will describe how to construct these two parts.
4.1.1 Task Generator
The task generator generates a set of real-time tasks in the non-decreasing order of arriving times. Each task has the attributes as described in section 2.1.1. The parameters which affect these attributes in the task generation are summarized in Table 4.1. In the following, we will describe how to decide the attributes of a task.
The computation time of a task varies from processor to processor, and is bounded by the minimum and maximum computation time, MIN_C and MAX_C. The heterogeneity variable, which is chosen uniformly between 0 and 1, represents the heterogeneity of computation times of a task. It determines the range of possible computation times for a task. Thus,
ddddddd Table 4.1. Parameters for task generator.
parameter explanation range of possible values
MIN_C minimum computation time 10
MAX_C maximum computation time 80
λ task arrival rate [0.3, 0.9] (real)
R laxity [2, 7] (real)
P number of processors [3, 10] (integer)
BurstP probability of a burst λ 100
MAX_Burst maximum task number for a burst 10 MIN_Burst minimum task number for a burst 30
computation times of a task are chosen uniformly in the range of MIN_C and MIN_C + (MAX_C – MIN_C) × heterogeneity. The lower bound, however, is not always MIN_C, so the range will be shifted by the variable shift. Because the upper bound cannot larger than MAX_C, the shift is chosen uniformly between 0 and MAX_C – (MAX_C – MIN_C) × heterogeneity. Finally, computation times of a task are chosen uniformly between (MIN_C + shift) and (MIN_C + ((MAX_C – MIN_C) × heterogeneity) + shift). Fig. 4.1 shows the range of computation time.
The arrival times of tasks depend on the interarrival time between each task. The interarrival time is exponentially distributed with mean [2]:
2
, whereλ is the task arrival rate, and P is the number of processors. We also assume there is a possibility of bursts of tasks. We define the mean of interarrival time for bursting is
10
The probability of burst, BurstP, varies withλ and is defined asλ 100. When a burst
MIN_C + (MAX_C – MIN_C) × heterogeneity + shift
MIN_C + shift
happens, there are at least MIN_Burst tasks and at most MAX_Burst tasks arriving at the systems in a very short interval.
Because both copies may be scheduled with the first two maximum computation times, the deadline of a task must be late enough to satisfy this possible scheduling. Thus, the deadline of a task Ti is uniformly chosen between (ai + max cip + second max cip) and (ai + R
× max cip). The laxity parameter, R, indicates the tightness of the deadline, and is at least 2.
Fig. 4.2 depicts the lower and upper bound of deadline when laxity = 3.
4.1.2 Simulator
Our evaluation was done by implementing a discrete-event dynamic simulator [17]. The
Our evaluation was done by implementing a discrete-event dynamic simulator [17]. The