5.5 Extension for Dependent Jobs
5.5.2 The DP-LoCBP Algorithm
Here we propose the DP-LoCBP algorithm which can construct the two scheduling tables SLO and SHI for a dual-criticality instance with dependent jobs. A DAG of mixed-criticality jobs isMC-schedulable if there exists a correct online scheduling policy for it. Our algorithm finds a LO-criticality priority order for the jobs of instanceI which is used to construct the table SLO. Then the same job allocation order of SLO is used to construct the table SHI, where HI-criticality jobs have greater priority than LO-criticality jobs, and the HI-criticality jobs are allocated theirCiHI units of execution time inSHI without violating the dependency constraints. The priority between two jobsji and jk is denoted by ji. jk, whereji is higher priority thanjk. This priority ordering must satisfy two properties:
• If a nodeji is assigned higher priority than nodejk(i.e., ji. jk), then there should not be a path in the DAG from node jk to nodeji.
• If the DAG is scheduled according to this priority ordering then each job ji of the DAG must finish its Ci(LO) units of execution time before d∆i .
Now we present the algorithm DP-LoCBP which finds a priority order for mixed-criticality dependent jobs.
The DP-LoCBP algorithm finds a priority order which is used to construct the scheduling tables for all the processors in steps 1 to 11. First, DP-LoCBP finds the LO- scenario deadline (di∆) of each job. For the LO-criticality jobs di∆ = di, but di∆ ≤ di for the HI-criticality jobs. Then the algorithm starts to assign the lowest priority jobs from the instanceI. It always selects the latest deadline job which does not have an outward edge as the lowest priority job, but LO-criticality jobs are considered before the HI-criticality jobs. A jobji can be assigned the lowest priority if and only if all other jobsjk finish their execution and there remains sufficient time forji to complete itsCi(LO) units of execution time before di∆. After a job ji is assigned the lowest priority, it is removed from the instance and added to the priority order Ψ. Then the remaining jobs are considered for priority assignment. If at any step a job cannot be assigned a priority, the algorithm declares failure. In step 12, the algorithm constructs the tableSLO. In steps 13 to 15, it checks for any possible HI-criticality scenario failure. If it does not find a HI-criticality scenario failure, then the priority order constructed by the DP-LoCBP algorithm can successfully schedule the instanceI. Then the table SHI is constructed for each processor by allocating Ci(HI) units of execution time of
Algorithm 15 DP-LoCBP(I) Notation:
I ={j1, j2, ..., jn}, whereji =< ai, di, χi, Ci(LO), Ci(HI)>.
Input: I, Dependency relation E ⊆I×I Output : Tables SLO and SHI
Assume earliest arrival time is 0.
1: Compute the LO-scenario deadline (di∆
) of each jobji asdi∆
=di−(Ci(HI)−Ci(LO));
2: while I is not empty do
3: Assign a LO-criticality latest deadline job ji which does not have an outward edge as the lowest priority job if ji can finish its execution in the interval [ai, di∆] after all other jobs finish their execution in LO-scenario under the global EDF scheme;
4: If any LO-criticality job with no outward edge cannot be given the lowest priority then a HI-criticality latest deadline job ji which does not have an outward edge is assigned as the lowest priority job if ji can finish its execution in the interval [ai, di∆
] after all other jobs finishes their execution in LO-scenario under the global EDF scheme;
5: if no job is assigned a lowest priority then
6: Declare FAIL and EXIT;
7: else
8: Add the jobji to the priority order Ψ.
9: Remove jobji from the instance and continue;
10: end if
11: end while
12: Construct table SLO for each processor Pi using the priority order Ψ;
13: if anyHIscenarioF ailure(SLO, I, Ψ) then
14: return FAIL and EXIT;
15: else
16: Construct table SHI for each processor Pi using the same order of allocated jobs in SLO.
17: The same order asSLO is followed to allocate the jobs in SHI;
18: After a HI-criticality job ji is allocated its Ci(LO) execution time in SHI, Ci(HI)− Ci(LO) units of execution time of jobji is allocated after the rightmost segment of jobji inSLO without violating the dependency constraints and without disturbing the priority order Ψ;
19: end if
each HI-criticality job using the same order of allocated jobs as SLO where a HI-criticality job is given higher priority over LO-criticality jobs. InSHI each HI-criticality job is allocated itsCi(LO) units of execution time without violating the dependency constraints. Once the Ci(LO) units of execution time are allocated for HI-criticality jobs in SHI, the remaining Ci(HI)−Ci(LO) units of execution time are allocated immediately without disturbing the priority order Ψ and without violating the dependency constraints. At each instant, the allocation is done without violating the dependency constraints.
We illustrate the operation of this algorithm by an example.
Example 5.5.1: Consider the mixed-criticality instance given in Table 5.3 which is going to be scheduled on a multiprocessor system having two homogeneous processors, i.e.,P0 and P1. The corresponding DAG is given in Fig. 5.4.
Figure 5.3: An example instance to explain the DP-LoCBP algorithm
Job Arrival time Deadline Criticality Ci(LO) Ci(HI)
j1 0 3 LO 1 1
j2 0 3 LO 1 1
j3 0 3 LO 1 1
j4 0 4 HI 1 3
j5 1 6 HI 1 3
j1 j2 j3 j4
j5
Figure 5.4: A DAG showing job dependencies among the jobs of an instance
Now we construct a priority order using the DP-LoCBP algorithm. The LO-criticality scenario d∆i of the jobs j1, j2, j3, j4.j5 are 3,3,3,2,4 respectively. Next we start assigning priorities to each job.
• We start with a node having no outward edges from it. The only such node is job j5.
So Algorithm 15 assigns job j5 the lowest priority. Ifj5 is assigned the lowest priority, then j1 and j2 can run simultaneously in P0 and P1 over [0,1] and [0,1] respectively.
Thenj3 andj4 can run over [1,2] in P0 and P1 respectively. Thenj5 can easily execute its 1 unit of execution on eitherP0 orP1 over [2,3] to finish by its LO-scenario deadline (d∆i ). Now we can assign job j5 the lowest priority job.
We remove job j5 and consider{j1, j2, j3, j4} to find the next lowest priority job.
• Since the LO-criticality jobs are given the lowest priority by the proposed algorithm, it is easy to verify that the successive lowest priority jobs will bej1, j2 andj3 respectively.
Finally, j4 is the highest priority job.
So the final priority order of jobs in instanceI isj4. j3. j2. j1. j5. The tableSLO for each processor is given in Fig. 5.5.
Now the anyHIscenarioF ailure(SLO, I,Ψ) subroutine checks for all possible HI- criticality scenarios. We can check that all HI-criticality scenarios are schedulable using the priority orderj4. j3. j2. j1. j5 of the instanceI. Finally, the tableSHIis constructed for each processor by allocating Ci(HI) units of execution time of each HI-criticality job using the same order of allocated jobs inSLOwhere a HI-criticality job is given higher priority over a LO-criticality job. On processorP0, the job order of SHI remains the same as in SLO. Job j4 is a HI-criticality job and does not depend on any other job, so it is allocated itsCi(LO) units of execution time over [0,1] and the remainingCi(HI)−Ci(LO) units of execution time are allocated in the interval [1,3]. Jobj5 is allocated in the interval [2,3] in table SLO of P0. Butj5 is allocated in the interval [3,6] due to dependency constraints which does not affect the scheduling after a mode change. On processorP1, jobj3 andj2 (LO-criticality) which do not depend on any other jobs, are allocated their one unit of execution time in the intervals [0,1] and [1,2] respectively. The table SHI for each processor is given in Fig. 5.6.
SLO P1 P0
j3 j2 j4 j1 j5
0 1 2 3 6
Figure 5.5: Table SLO for processor P0 and P1
SHI P1 P0
j3 j2
j4 j5
0 1 2 3 6
Figure 5.6: TableSHIfor processorP0and P1