• Tidak ada hasil yang ditemukan

4.4 HETERO-SCHED: A Low-overhead Heterogeneous Multi-core Scheduler

4.4.3 An Illustrative Example

Let us consider a real-time system consisting of a set of five tasks (T = {T1, T2, ..., T5}) to be preemptively scheduled on a heterogeneous multi-core platform consisting of three processing cores (V ={V1, V2, V3, V4}). The Utilization Matrix U[5×4] is as follows:

U[5×4] V1 V2 V3 V4 T1 0.5 1.3 0.8 1.2 T2 0.8 0.7 1.0 1.1 T3 1.1 0.8 0.7 0.9 T4 1.2 0.9 0.8 0.7 T5 0.9 1.1 1.1 1.4

The period (as well asdeadline) of each task is as follows: p1 = 10,p2 = 20, p3 = 10, p4 = 20 and p5 = 40. According to HETERO-SCHED (Algorithm 9), we compute first the hyper-period, H = lcm(10,20,10,20,40) = 40. Using deadline partitioning, let us find the time-slices in the interval [0,40). It may be observed from Figure 4.4a that there are four time-slices, i.e., T S = {T S1, T S2, T S3, T S4}, where T S1 = [0,10), T S2 = [10,20), T S3 = [20,30) and T S4 = [30,40).

Computation of Shares Required: Algorithm 9 invokes Algorithm 10 to compute the allocation matrixAMk for each time-slice T Sk. First, Algorithm 10 creates the two lists L1, L2 and initializes them to ∅. Then, Algorithm 10 invokes Algorithm 11 to compute the shares required by each task Ti ∈T at the time-slice T S1 whose interval is [0,10). The computed shares are as follows:

4.4 HETERO-SCHED: A Low-overhead Heterogeneous Multi-core Scheduler for Real-time Periodic Tasks

(a)Deadline Partitioning (b)Schedule for migrating tasks

(c) Final schedule for all tasks Figure 4.4: Example

sh[5×4] shi,1,1 shi,2,1 shi,3,1 shi,4,1

T1 5 13 8 12

T2 8 7 10 11

T3 11 8 7 9

T4 12 9 8 7

T5 9 11 11 14

Now, Algorithm 11 sorts the computed shares in non-decreasing order, i.e., The sorted list L1 at time-slice T S1 is as follows (hi, j, shi,j,1i): {h1,1,5i, h2,2,7i, h3,3,7i, h4,4,7i,h1,3,8i,h2,1,8i,h3,2,8i,h4,3,8i,h3,4,9i,h4,2,9i,h5,1,9i,h2,3,10i,h2,4,11i, h3,1,11i, h5,2,11i}, h5,3,11i, h1,4,12i, h4,1,12i, h1,2,13i, h5,4,14i}. This list L1 is returned to Algorithm 10. Then, Algorithm 10 invokes Algorithm 12 to compute the allocation matrix AM1 for non-migrating tasks.

Allocation of Non-migrating Tasks: Algorithm 12 extracts the first element from the listL1, i.e.,h1,1,5i(taskT1 requires a share of 5 units on processorV1). The taskT1

can be fully allocated on processing core V1 and hence, the allocation matrixAM1[1][1]

is updated as 5 and the migration count for T1 is set to 0, i.e., M C1[1] = 0. Since, task T1 has been completely allocated on the processing core V1, Algorithm 12 deletes all entries of T1 from list L1, i.e., h1,3,8i, h1,4,12i and h1,2,13i have been removed from L1. Now, Algorithm 12 repeats the above process by extracting the first element from L1, i.e., h2,2,7i. Since, processing core V2 can fully accommodate task T2, it has been allocated to V2 withAM1[2][2] being updated to 7 and the migration count forT1 is set to 0, i.e., M C1[2] = 0. Similarly, the task T3 is allocated (according to h3,3,7i) on V3 and T4 is allocated (according to h4,4,7i) on V4.

Now, h5,1,9i becomes the first element of list L1. According to this, if task T5 is allocated on processing core V1, it requires a share of 9 units. However, processing core V1 does not have the capacity to accommodate T1 and hence, the element h5,1,9i has been inserted into L2. Similarly, the other three elements corresponding to task T5 has been moved to L2, i.e., h5,2,11i, h5,3,11i and h5,4,14i. Since, the list L1 becomes empty, the execution moves from Algorithm 12 to Algorithm 10. The allocation matrix AM1[5×4] for non-migrating tasks at time-slice T S1, is as follows:

AM1[5×4] V1 V2 V3 V4

T1 5 0 0 0

T2 0 7 0 0

T3 0 0 7 0

T4 0 0 0 7

T5 0 0 0 0

Allocation of Migrating Tasks: It may be observed that task T5 is unallocated and Algorithm 10 invokes Algorithm 13 to scheduleT5. It first moves all entries corresponding to T5 from list L2 to L3. Then, Algorithm 13 extracts the first element from L3, i.e., h5,1,9i, and computes the spare capacity of V1. Since, there is a residual spare capacity of 5 on processing coreV1, the taskT5 has been partially allocated on V1,AM1[5][1] = 5.

The unallocated share ofT5is 9−5 = 4. This has been normalized as follows: us5 = 4/0.9

= 4.4 (approx). The normalized value of the unallocated share for taskT5 (us5) and the migration count (M C1[5]) have been updated as 4.4 and 1, respectively.

4.4 HETERO-SCHED: A Low-overhead Heterogeneous Multi-core Scheduler for Real-time Periodic Tasks

Now, Algorithm 13 extracts the next elementh5,2,11ifromL3 and checks the spare capacity of processing core V2. Since, the spare capacity of V2 (i.e. 3), is not sufficient enough to accommodate the unallocated share of T5 (i.e., 4.4∗1.1 = 4.8), it has been partially allocated onV2. That is,AM1[5][2] = 3. The unallocated share ofT5is 4.8−3 = 1.8. This has been normalized as follows: us5 = 1.8/1.1 = 1.6 (approx). The normalized value of the unallocated share for task T5 (us5) and the migration count (M C1[5]) have been updated as 1.6 and 2, respectively.

Next, Algorithm 13 extracts the element h5,3,11i from L3 and checks the spare capacity of processing core V3. Since, the spare capacity of V3 (i.e. 3), is sufficient enough to accommodate the unallocated share of T5 (i.e., 1.6∗1.1 = 1.76), it has been allocated on V3. That is,AM1[5][2] = 2. The final allocation matrixAM1[5×4] (including migrating tasks) for time-slice T S1, is as follows:

AM1[5×4] V1 V2 V3 V4

T1 5 0 0 0

T2 0 7 0 0

T3 0 0 7 0

T4 0 0 0 7

T5 5 3 2 0

Scheduling of Migrating Tasks: Since the task allocation is feasible, Algorithm 9 invokes Algorithm 14 to construct a schedule. It may be noted that the migration count of T5 is the highest among all tasks and hence, T5 is scheduled first according to HETERO-SCHED guidelines. The resulting schedule consisting of T5 is depicted in Figure 4.4b.

Scheduling of Non-migrating Tasks: It may be observed that all the remaining unscheduled tasks have the same migration count. Since ties are broken arbitrarily, let us consider the task T1. By following the allocation matrix and HETERO-SCHED guidelines, T1 is scheduled on V1 from time slot 5 to 10. Next,T2 is scheduled on V2. It may be observed that the execution of T2 is broken into two pieces since T5 is already scheduled on V2. Similarly, the remaining tasks are scheduled and the final schedule for time-slice T S1 is depicted in Figure 4.4c.

It may be noted that the size of all time-slices in T Sis same and hence, the schedule constructed for the first time-slice T S1 can be utilized for all the remaining time-slices by only updating the time-slice boundaries.