4.4 HETERO-SCHED: A Low-overhead Heterogeneous Multi-core Scheduler
4.4.1 HETERO-SCHED Algorithm
4.4 HETERO-SCHED: A Low-overhead Heterogeneous Multi-core Scheduler
invokes COMPUTE-SHARES-REQUIRED (Algorithm 11) to compute the share shi,j,k required by each task Ti ∈T at T Sk on theVjth processing core, as follows:
shi,j,k =dui,j × |T Sk|e (4.1)
The computed share shi,j,k along with the task (Ti) and the processor (Vj) id’s have been used to form the tuple hi, j, shi,j,ki, which is then inserted into the list L1 (Line 6 of Algorithm 11). After computing the shares required by each task over all the m processing cores, Algorithm 11 sorts the list L1 in non-decreasing order of shares and returns it back to COMPUTE-ALLOCATION algorithm.
ALGORITHM 10: COMPUTE-ALLOCATION Input: T, V, T Sk, AMk
Output: Allocation matrix AMk, Feasibility flag F
1 Initialize the lists L1 =∅, L2 =∅
2 COMPUTE-SHARES-REQUIRED (T,T Sk, L1)
3 ALLOCATE-NON-MIGRATE (L1, L2,AMk, V)
4 ALLOCATE-MIGRATE (L2,AMk, V)
5 return AMk
ALGORITHM 11: COMPUTE-SHARES-REQUIRED Input: T, T Sk, L1
Output: The sorted list L1 consisting of shares required
1 {Compute the shares required by each task at T Sk }
2 for i= 1 to n do
3 for j = 1 to m do
4 shi,j,k =dui,j × |T Sk|e
5 L1 =L1∪ {hi, j, shi,j,ki}
6 Sort the list L1 innon-decreasing order of shi,j,k
7 return L1
After computing required shares, Algorithm 10 invokes ASSIGN-NON-MIGRATE (Algorithm 12) to compute the schedule for the set of tasks which can be fully assigned on to any one of the cores for its complete share of shi,j,k.
4.4 HETERO-SCHED: A Low-overhead Heterogeneous Multi-core Scheduler for Real-time Periodic Tasks
4.4.1.2 ASSIGN-NON-MIGRATE
It extracts-out the first element (say, hi, j, shi,j,ki) from the list L1. Then, it checks whether it is possible to schedule task Ti on Vj for shi,j,k time units. If possible, it allocates Ti onVj by setting the allocation matrixAMk[i][j] = shi,j,k and subsequently, sets the migration count ofTi to 0. SinceTi has been allocated completely, Algorithm 12 deletes all the entries corresponding to Ti from both L1 and L2.
On the other hand, if the allocation requirement shi,j,k of task Ti cannot be ful- filled on core Vj, then Algorithm 12 inserts the element hi, j, shi,j,ki in to the list L2. Once all elements in L1 has been verified, Algorithm 12 returns the schedule for non- migrating tasks and list L2 containing the migrating tasks. Then, Algorithm 10 invokes ALLOCATE-MIGRATE (Algorithm 13) to compute the schedule for each migrating task in L2.
ALGORITHM 12: ALLOCATE-NON-MIGRATE Input: L1, L2,AMk, V
Output: AMk (Allocation matrix with non-migrating tasks), L2 (Sorted list of migrating tasks)
1 while L1 is not empty do
2 Extract-out the first element hi, j, shi,j,kifrom L1
3 if Ti can be allocated fully on Vj for shi,j,k then
4 Update AMk[i][j] = shi,j,k 5 Set migration count of Ti to 0
6 Delete all entries of Ti fromL1 and L2
7 else
8 Tentatively insert hi, j, shi,j,ki at the end of L2
9 returnAMk, L2
4.4.1.3 ASSIGN-MIGRATE
It starts the allocation process by selecting the task that is part of the first element hi, j, shi,j,kiinL2 (Line 4). Initially, ALLOCATE-MIGRATE moves all elements related to Ti from the list L2 to L3 (Line 6). Then, it iterates over L3 until the task Ti is completely allocated with its computation demand on the processing platform (Lines 8 to 27). Suppose, the allocation ofTi is infeasible, then the entire setT is declared to be
infeasible (Lines 28 to 30).
(Lines 8 to 27): ALLOCATE-MIGRATE extracts-out the first element (say,hi, j, shi,j,ki) fromL3 and computes the unused capacityucj ofVj (Lines 9 and 10). Ifucj is non-zero, then ALLOCATE-MIGRATE checks the migration count of Ti to compute the unallo- cated share of Ti with respect to core Vj, i.e., ucj (Line 12 to 15). While utilizing the unused capacity ofVj, there are two possibilities:
• usi > ucj: This implies that the unallocated share ofTi is greater than the unused capacity of coreVj. Hence, the taskTi is partially allocated onVj (AMk[i][j] =ucj) and the normalized unallocated share of Ti is updated as: usi = (usi−ucj)/ui,j. Finally, the migration count is incremented by one (M Ck[i] =M Ck[i] + 1).
• usi ≤ucj: This implies that the unused capacity of core Vj is sufficient enough to meet the unallocated demand of Ti. Hence, the task Ti is allocated on Vj. Since, Ti’s allocation is completed, usi is reset to 0 and all entries of Ti are deleted from L3.
4.4.1.4 COMPUTE-SCHEDULE
If task allocation is successful, then HETERO-SCHED invokes COMPUTE-SCHEDULE.
It may be noted that the objective of this scheduling phase is to assign start and finish times of all tasks on their allocated processing cores such that, (i) all tasks are scheduled according to their allocation, and (ii) the same task is never simultaneously executed on more than one processing core.
In order to achieve this objective, we use the following guidelines (also known as HETERO-SCHED guidelines) during the scheduling of tasks:
(i) Schedule tasks on unused time slots starting from left to right over the given time- slice,
(ii) Always schedule the task with the highest number of migrations,
(iii) Schedule a migrating task in stair-case fashion such that its executions are not over- lapped, where starting time of a migrating task on a core is assigned after incrementing
4.4 HETERO-SCHED: A Low-overhead Heterogeneous Multi-core Scheduler for Real-time Periodic Tasks
ALGORITHM 13: ALLOCATE-MIGRATE Input: L2, AMk,V
Output: AMk (Allocation matrix with all tasks)
1 while L2 is not empty do
2 Let hi, j, shi,j,ki be the first element in L2
3 Create and Initialize a list L3 to∅
4 Extract all entries of Ti from L2 and move to L3
5 Let usi be the normalized unallocated share of Ti
6 while L3 is not empty do
7 Extract-out the first element hi, j, shi,j,kifrom L3
8 Compute unused capacity of Vj inT Sk, i.e., ucj
9 if ucj 6= 0 then
10 if migration count M Ck[i] = 0 then
11 Unallocated share of Ti: usi =shi,j,k
12 else
13 Unallocated share of Ti: usi =usi×ui,j
14 if usi > ucj then
15 Allocate Ti onVj: AMk[i][j] = ucj
16 Update the normalized unallocated share of Ti: usi = (usi−uci)/ui,j
17 Migration count: M Ck[i] =M Ck[i] + 1
18 else
19 AMk[i][j] = ucj− dusie
20 Reset usi to 0
21 Delete all entries of Ti from L3 22 if usi 6= 0 then
23 Declare that the allocation of task set T on multi-core platformV is infeasible
24 returnAMk
it’s ending time on previous core by 1. The starting and ending times of execution for each task in the times-slice Gk is stored in the Schedule Matrix SMk,
(iv) Break the execution of a non-migrating task into multiple chunks when it cannot be scheduled non-preemptively on the same allocated core. COMPUTE-SCHEDULE (Algorithm 14) uses the above guidelines to guarantee the feasible scheduling of tasks on a given heterogeneous platform.
ALGORITHM 14: COMPUTE-SCHEDULE Input: AMk,SMk
Output: Schedule matrix SMk at time-slice T Sk
1 while all tasks in SMk are not scheduled do
2 From AMk, select Ti with the highest number of migrations (handle tie-brakes arbitrarily)
3 for each Vj (j = 1 to m) and AMk[i][j]6= 0 do
4 Schedule Ti’s allocated share on Vj according to HETERO-SCHED guidelines
5 return SMk