• Tidak ada hasil yang ditemukan

FT-FS: Normal Mode of Operation

Dalam dokumen PDF gyan.iitg.ernet.in (Halaman 122-125)

4.2 Fault Tolerant Fair Scheduler (FT-FS)

4.2.1 FT-FS: Normal Mode of Operation

The pseudocode of the functionFT-FS Normal()is presented in Algorithm 6. At the be- ginning of time slicetsl(say, at timet), each taskTiis allocated a shareshli (proportional to its weight) to be executed within tsl and is calculated as follows:

ALGORITHM 6: Function FT-FS Normal()

Input: Rl: Active task set,e¯i: the remaining execution requirement of each taskTi

(∈Rl)

Output: Generate schedule for time slicetsl

1 for each taskTi in Rl do

2 shli =min(eui×tsll,e¯i){refer Equation 4.2};

3i =e¯i−shli;

4 scap=m×tsll−P|Rl|

i=1shli {refer Equation 4.5};

5 if scap >0 then

6 for each taskTi in Rl do

7 if ¯ei >0 then

8 Determine Ti’s urgency factorufi, and update its shareshli and e¯i {refer Equation 4.6};

9 Recalculate scapusing Equations 4.3 and 4.5;

10 if scap >0 then

11 Create a list lt of tasks for whiche¯i >0, sorted in non-increasing order of their lag(Ti, t+tsll) values;

12 for each taskTi in ltdo

13 shli =shli+ 1, e¯i =e¯i−1,scap=scap−1;

14 if ¯ei = 0 then

15 Remove Ti from listlt;

16 if scap= 0 then

17 exit;

18 After finalizing the shares of all tasks in Rl generate schedule for time slice tsl using McNaughton’s wrap-around rule [82].

4.2 Fault Tolerant Fair Scheduler (FT-FS)

Let, Rl denote the set of active tasks at time t. The total workload within time slice tsl becomes: L=P|Rl|

i=1ui.Given L, theeffective execution rate (also referred to as effective weight) of each taskTi at timet is calculated as:

∀Ti ∈Rl, eui =min(M

L ×ui, 1) (4.1)

where, M=m, is the number of available processors. FT-FS Normal() first determines an initial share for each task Ti in Rl as:

∀Ti ∈Rl, shli =bmin(eui×tsll, e¯i)c (4.2) where,e¯i is the currently remaining execution requirement ofTi’s current instance. Let, sum shrl denote the sum of shares of all tasks within time slice tsl. Thus,

sum shrl =

|Rl|

X

i=1

shli (4.3)

Given sum shrl, there exists a feasible schedule within tsl only if,

sum shrl ≤M×tsll (4.4)

If sum shrl <M×tsll, there exists some spare capacity (denoted as scap) within time slice tsl:

scap=M×tsll−sum shrl (4.5)

Now, FT-FS Normal() proportionally distributes this residual capacityscap among all tasks in Rl for which e¯i >0. Thus, the modified task shares become:

∀Ti ∈Rl, shli =shli +bmin(scap×ufi, e¯i)c (4.6) where, ufi is termed as the relative urgency factor of Ti and is defined as:

ufi =e¯i/¯pi |Rl|

X

i=1

¯

ei/p¯i (4.7)

Here, p¯i is the currently remaining time before the completion of Ti’s period. Equa- tion 4.6 ensures that the fraction of the residual capacity allocated to taskTi is propor- tional to its relative execution urgency ufi. If there still remains some residual capacity after updating task shares, FT-FS Normal() creates a list lt of tasks for which e¯i >0,

sorted in non-increasing order of their lag(Ti, t+tsll)1 values. Here, lag(Ti, t+tsll) de- notes the lag of taskTi at the end oftsl (at time t+tsll), assumingTi to have executed its shareshli intsl. Thus, lag(Ti, t+tsll) = pei

i ×(t+tsll)−(allocated(Ti, t) +shli).

Now,FT-FS Normal()sequentially chooses the next task inltand increases its share by 1 until the residual capacityscapis exhausted. After this, a schedule for all tasks inRl is generated corresponding to time slice tsl, using McNaughton’s wrap-around rule [82].

Based on this generated schedule, tasks allocated to each processor are executed in parallel until completion of the time slice.

Example 1: Consider a set of eight periodic tasks, T1 (11,52,1), T2 (13,50,2), T3 (13,54,3), T4 (11,52,4), T5 (10,51,5), T6 (11,54,6), T7 (11,50,7) and T8 (10,52,8) to be executed on two unit capacity processors (m = 2) using the FT-FS scheduling scheme. Figure 4.1 depicts theFT-FS schedule for the first 100 time slots.

ts1 ts5

V1

V2

0 50 100

T2 T

2 T

3 T

T 5 4

T5 T

6

51 52 54 ts2ts

3 ts 4

T1

T7 T

8

T2

T7

T1 T

4

T5 T

T 8 7

T2 T

3 T

T 5

1 T

4

T6

T5 T

T 8 7

Figure 4.1: FT-FS schedule for first 100 time slots.

The time slice boundaries corresponding to the above task set occur at time instants 50,51,52,54 and 100. Therefore, tsl1 = 50, tsl2 = 1, tsl3 = 1, tsl4 = 2 and tsl5 = 46. So, at the beginning of ts1, the initial allocated shares of currently active tasks T1, T2, T3, T4, T5, T6, T7, T8 become: sh11 = sh14 = sh16 = sh17 = 11, sh12 = sh13 = 13 and sh15 = sh18 = 10, (see Equations 4.1 and 4.2). Here, sum shr1(= 90) < m× tsll(=

2×50 = 100) (see Equation 4.4) and all active tasks are able to satisfy their required execution requirements. Therefore, there exists a feasible schedule within ts1 (refer Algorithm 6) and these tasks are executed in ts1, based on the generated schedule. At the beginning of the second time slice ts2, i.e., at timet = 50, the currently active tasks

1lag [7] defines the fairness deviation for each task Ti at time t and is given as: lag(Ti, t) = (ei/pi)×tallocated(Ti, t). Here,allocated(Ti, t) is the amount of execution actually completed byTi subsequent to its start at time 0.

4.2 Fault Tolerant Fair Scheduler (FT-FS)

in the system are T2 and T7. The final allocated shares of these tasks to be executed withints2 are given by: sh22 =sh27 = 1. At the beginning of time slice ts3, the currently active tasks are T2, T5, T7, and their allocated shares are 1, 1, 0, respectively. Here, lag based priority order of these three tasks is: T5 > T2 > T7, and total number of available time slots is: m×tsl3 = 2×1 = 2. Therefore, tasks T2 and T5 acquire a share of 1 time unit each, in time slice ts3. In the fourth time slice ts4, the currently active tasks are T1, T2, T4, T5, T7, T8, and their allocated shares are 1, 0, 1, 0, 1, 1, respectively.

Here, lag based priority order of these six tasks is: T1 > T4 > T8 > T7 > T5 > T2, and total number of available time slots is 4. Therefore, tasks T1, T4, T7, T8 acquire a share of 1 time unit each, in time slice ts4. The rest of the schedule continues as shown in

Figure 4.1.

Dalam dokumen PDF gyan.iitg.ernet.in (Halaman 122-125)