• No se han encontrado resultados

CICLO CONTABLE

In document Contabilidad general I (página 33-35)

C. POR LA FUNCION QUE DESEMPEÑAN

VI. CICLO CONTABLE

Letτ be a task system in which some task Ti initiates a weight change to weightNw at time

tc. LetOw be the last scheduling weight ofTi before the change is initiated attc. LetS be

them-processorGEDF schedule of τ. Let Tij be last-released job of Ti beforetc. If Tij does

not exist or Tij is inactive at tc before the reweighting event is initiated (i.e., tc ≥ d(Tij)),

then the weight change is immediately enacted, and future jobs of Ti are released with the

new weight. In the following rules, we consider the remaining possibility, i.e., Tij exists and is active at tc. (Notice that if tc = d(Tik) = r(Tik+1), then Tik is the last-released job of Ti

beforetc, and it is not active at tc. Therefore, the change is immediately enacted and Tik+1

is released with the new weight.) Let REM(Tij, tc) =e(Tij)−A(S,T

j

i, 0, tc). Note that REM(Tij, tc) denotes the actual re-

maining computation inTi’s current job. LetnextE(Tij, tc) equalREM(Tij, tc), ifREM(Tij, tc)>

0; otherwise, if REM(Tij, tc) = 0, then let nextE(Tij, tc) equal the value of e(Tij+1) had the

weight-change event not occurred. SincenextE(Tij, tc) is only used to determine the execution

time of the next job released, it can be calculated at timer(Tij+1). (Notice that, if Ti has no

next jobTij+1 to release at the time specified in the rules below, then nextE(Tij, tc) = 0. In

this case, the rules are applied as stated, except thatTij+1 is not released.)

As was mentioned earlier, the choice of which rule to apply depends on whether deviance is positive or negative. If positive, then we say that Ti is positive-changeable at time tc

1Since reweighting events may modify the actual execution time of a job, removing this assumption would

entail having notation to distinguish between redefined execution times as the result of reweighting and rede- fined execution times that occur due to a task executing for less than its specified execution time.

from weight Ow to Nw; otherwise Ti is negative-changeable at time tc from weight Ow to Nw. Because Ti initiates its weight change at time tc, wt(Ti,tc) = Nw holds; however, Ti’s

scheduling weight does not change until the weight change has been enacted, as specified in the rules below. Note that, if tc occurs between the initiation and enaction of a previous

reweighting event of Ti, then the previous event is canceled, i.e., treated as if it had not

occurred. As discussed later, any “error” associated with canceling a reweighting event like this is accounted for when determining drift (formally defined in Section 3.5.3).

Rule P: IfTi is positive-changeable at timetcfrom weightOwtoNw, then one of two actions

is taken: (i)ifd(Tij)tc >REM(Tij, tc)/Nw, then immediately,Tij is halted, the weight

change is enacted, a new job with an execution time of nextE(Tij, tc) is released (if nextE(Tij, tc) >0), and Tij becomes inactive; (ii) otherwise, at time d(T

j

i), the weight

change is enacted, i.e., the scheduling weight ofTi does not change until the end of its

current job.

Rule N: If Ti is negative-changeable at time tc from weight Ow to Nw, then one of two

actions is taken: (i)ifNw>Ow, then immediately, Tij is halted and its weight change is enacted, and at timetr, a new job with an execution time ofnextE(Tij, tc) is released

(ifnextE(Tij, tc)>0) andTij becomes inactive, wheretris the smallest time at or aftertc

such thatdev(Tij, tr) = 0 holds;(ii)otherwise, at timete, the weight change is enacted,

a new job with an execution time ofnextE(Tij, tc) is released (ifnextE(Tij, tc)>0), and

Tij becomes inactive, where te = min(tr,d(Tij)), and tr is smallest time at or after tc

such thatdev(Tij,tr) = 0 holds.

Intuitively, Rule P changes a task’s weight by halting its current job and issuing a new job with an execution time of nextE(Tij, tc) with the new weight if doing so would improve its

deadline.

Example (Figure 3.4). Consider the example in Figure 3.4, which depicts a one-processor system with four tasks (where the execution time of each job is one): T1, which haswt(T1) = 1/2 and leaves at time at time 2;T2andT3, both of which have a weight of 1/6; andT4, which has an initial weight of 1/6 that increases to 4/6 at time 2. In this system,T4initially has the

IDEAL and SW allocations for T 1 0 1 2 3 4 5 6 Time (a) Job deadline 0 1 2 3 4 5 6 Time 3 2 1 0 (b) Allocations 4 Drift = 1/3 CSW allocations for T4 T T T T 2 3 4

Job layout without reweighting Reweighting event einitiated Reweighting event enacted Scheduled Job released

Figure 3.4: A one-processor example of reweighting via Case (i) of Rule P under GEDF.

(a)The GEDFschedule. (b) T4’s allocations in theIDEAL,CSW, and SWschedules.

T 1 0 1 2 3 4 5 6 Time (a) Job deadline 0 1 2 3 4 Time 0 (b) Allocations 1 2 5 6 7

IDEAL allocations for T3

Drift = 1/6

SW and CSW allocations for T3

T 2

T

7 3

Job layout without reweighting Reweighting event einitiated Reweighting event enacted Scheduled Job released

Figure 3.5: A one-processor example of reweighting via Case (ii) of Rule P under GEDF.

lowest scheduling priority (there is a deadline tie). Inset (a) depicts theGEDFschedule. Inset (b) depictsT4’s allocations in theSWschedule and also in the other schedules, theIDEALand

CSW schedules, which are formally defined later in Section 3.5.2. Since T4 is not scheduled by time 2 and becaused(T41)tc >REM(T41, tc)/Nw, i.e.,d(T41)−2>0/(4/6), it has positive deviance and changes its weight via Case (i) of Rule P. This, in turn, causesT41 to be halted, T2

4 to be released at time 2 with a deadline of 7/2, and T4’s drift to become 2/6. Note that halting T4’s current job and issuing a new job with an execution time of one improves T4’s scheduling priority, i.e., d(T1

4) = 6> 72 =d(T42).

Example (Figure 3.5). Consider the example in Figure 3.5, which depicts a one-processor system with three tasks (where the execution time of each job is one): T1, which haswt(T1) = 1/3;T2, which haswt(T2) = 1/4; andT3, which has an initial weight of 1/4 that increases to 1/3 at time 2. Inset (a) depicts theGEDF schedule. Inset (b) depicts T3’s allocations in the

IDEAL,CSW, andSWschedules. (Again, theIDEALand CSWschedules are formally defined later in Section 3.5.2.) Since T31 has not been scheduled by time 2 its deviance is positive; furthermore, sinced(T31)2 < REM(T31,2)/(1/3), T1 enacts its weight change via Case (ii) of Rule P. Notice that ifT1

3 had been halted at time 2 and released a new job of weight 1/3, the deadline of this new job would equal time 5 (since 5 = 2 + 1/(1/3)). Thus, if we were to enact the change via Case (i) of Rule P, then we would increase the deadline of the first scheduled job ofT3, even though the weight of the task increased (i.e., such a change would decrease the scheduling priority of T3). Therefore, we enact the weight change via Case (ii) of Rule P, which delays enacting the weight change until the deadline ofT1

3.

Rule N changes the weight of a task by one of two approaches: (i) if a task increases

its weight, then Rule N causes the release time of its next job to be adjusted so that it is commensurate with the new weight; (ii) if a task decreases its weight, then Rule N causes the next job to be issued with a deadline that is commensurate with the new weight at the end of the current job.

Example (Figure 3.6). Consider the example in Figure 3.6, which depicts a one-processor system with four tasks (where the execution time of each job is one): T1, which haswt(T1) = 1/2 and leaves at time at time 2; T2 and T3, both of which have a weight of 1/6; and T4,

4 1 0 1 2 3 4 5 6 Time (a) 0 1 2 3 4 5 6 Time 3 2 1 0 (b) Allocations No Drift

Job layout without reweighting Reweighting event enacted

Scheduled Job released Job deadline

Reweighting event initiated CSW, IDEAL, and SW allocations for T

T T T T 2 3 4

Figure 3.6: A one-processor example of reweighting via Case (i) of Rule N under GEDF.

(a)The GEDFschedule. (b) T4’s allocations in theIDEAL,CSW, and SWschedules.

4 (b) T 1 Time (a)

Reweighting event einitiated Reweighting event enacted

Scheduled Job released Job deadline

0 Allocations 0 1 2 3 4 5 6 1 2 7 8

IDEAL allocations for T4

Drift = −1/3

CSW and SW allocations for T

Time T T T 2 3 4 0 1 2 3 4 5 6 7 8

Figure 3.7: A one-processor example of reweighting via Case (ii) of Rule N under GEDF.

which has an initial weight of 1/6 that increases to 4/6 at time 2. This is the same system as in Figure 3.4 except that T4 has a higher priority than both T2 and T3. Inset (a) depicts theGEDFschedule. Inset (b) depictsT4’s allocations in theIDEAL,CSW, and SWschedules. (Again, the IDEAL and CSW schedules are formally defined later in Section 3.5.2.) Since T4 has been scheduled by time 2, it has negative deviance and thus because it increases its weight, the change is enacted via Case (i) of Rule N. Thus, its next job is released time of 3, which is such that dev(T4, 3) =R03Swt(Ti, u)du−A(S,T4, 0, 3) = 1−1 = 0. By releasing the next job ofT4 at time 3, the drift incurred is zero.

Example (Figure 3.7). Consider the example in Figure 3.7, which depicts a one-processor system with four tasks (where the execution time of each job is one): T1, which joins the system at time 2 and haswt(T1) = 1/2;T2 and T3, both of which have a weight of 1/6; and T4, which has an initial weight of 1/2 that initiates a weight decrease to 1/6 at time 1 that is enacted at time 2. Inset (a) depicts theGEDF schedule. Inset (b) depicts T4’s allocations in the IDEAL, CSW, andSW schedules. (Again, the IDEAL and CSW schedules are formally defined later in Section 3.5.2.) Since T4 has negative deviance at time 1 and it decreases its weight, this weight change is enacted via Case (ii) of Rule N, causingT4’s next job to have a deadline of 8 andT4 to have a drift of −1/3.

Notice that ifTiinitiates a weight change at timetcwhile some jobTikofTi(not necessarily

its last-released job) has missed its deadline, then the Rules P and N specify that one of two actions is taken. If no job ofTi is active attc, then the weight change is enacted immediately.

If there is a job Tij that is active at tc, then since Tij has not been scheduled (because the

earlier jobTik has missed its deadline), it follows that Ti is positive-changeable, and thus the

weight change is enacted via Rule P (which may cause Tij but not Tik to halt). Notice that Tk

i is unaffected in both cases.

It is important to remember that when the Rules P and N halt a job, they do not abandon the computation that the job was performing. Rather, these rules split that computation across two jobs. Since these rules change the ordering of a task in the priority queues that determine scheduling, the time complexity for reweighting one task is O(logN), where N is the number of tasks in the system (assuming priority queues are implement using binomial

Time 1 T 2 T 3 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 T

Reweighting event enacted

Scheduled Job released Job deadline

Reweighting event initiated

Figure 3.8: A one-processor example of canceling a reweighting event. heaps).

Canceled reweighting events. We now introduce a property about the relationship be- tween the initiation and enactment of a reweighting event in the case that some such events are canceled due to later reweighting events. Notice that, once a task Ti initiates a weight

change at tc, this weight change is eventually either canceled by another weight change or

enacted. Further, Rules P and N enact any non-canceled reweighting event no later than the deadline of the last-released jobTij ofTi at tc (if it exists and if tc≤d(Tij)).

Example (Figure 3.8). Consider the example in Figure 3.8, which depicts a one-processor system with three tasks: T1 and T2, both of which have an execution time of 2 and a weight of 1/3; and T3, which has e(T3) = 2 and an initial weight of 1/3 that changes to 1/10 at time 3 via Case (ii) of Rule N and then to 1/4 at time 5 via Case (ii) of Rule N. Notice that, because the change initiated at time 3 is via Case (ii) of Rule N, the change is not enacted until time 6. As a result, when a change is initiated at time 5, this new change cancels the previous change. Even though the change initiated at time 3 is canceled, the time of the next weight enactment is still at time 6.

From Figure 3.8, we can see that, once a reweighting event has been initiated during an active job, some weight change will be enacted by the earlier of the deadline of that job

2 3 5 4 4 5 0 1 2 3 0 1 6 3 T 6 2 T 1 3 T T 2 T 1 7 T

Reweighting Event Enactment Job Release Job Deadline Job Release/Deadline

Scheduled

Time Time

Job Layout without Reweighting Original Initiation

(a) (b)

Figure 3.9: A one-processor example of NP-GEDF. (a) T3 has a lower scheduling-priority thanT2. (a) T2 has a lower scheduling-priority thanT3.

or when the job becomes inactive (which may be earlier, by Rules P and N). Property (X) formalizes this idea.

(X) If a taskTi initiates a weight change at timetc and the jobTij is active attc, then some

weight change is enacted according to Rule P or N by eitherd(Tij) or whenTij becomes inactive, whichever is first.

In document Contabilidad general I (página 33-35)

Documento similar