• Tidak ada hasil yang ditemukan

3.3 Preemptive Scheduler Synthesis Framework

3.3.1 Task execution model

3.3 Preemptive Scheduler Synthesis Framework

Table 3.3: Description of events (for preemptive execution)

Event Description

ai Arrival of a task τi

pi Acceptance of a task τi ri Rejection of a taskτi

ei Execution of a segment of τi on the processor ci Execution of the last segment ofτi on the processor

event (t). All events in Σ are considered to be observable. SupposeEi is equal to 1, i.e., each instance of τi requires only a single segment of execution; then Σi ={ai, pi, ri, ci}.

In this work, the notion of acceptance captures the following fact: Once a real-time task is accepted by the scheduler, then it will not be rejected in the middle of its execution.

Similarly, rejection captures the scenario in which a real-time task is not accepted by the scheduler in order to guarantee timely execution of the already accepted tasks in the system. We have modeled the notion of acceptance and rejection using (mutually exclusive) transitions on events pi and ri, respectively. The transition structure of Ti (shown in Figure 3.12) is explained as follows:

T\Ti

ai pi ri

T\Ti T\Ti

ei t ci

t T\Ti

# of ei = Ei - 1 ei

#1 #2 #3

#4 #6

#7

#8

#5

Figure 3.12: Task execution model Ti for task τi hEi, Di, Pii.

• #1 −−−→Σ\Σi #1: Ti stays at State #1 until the occurrence of arrival event ai by executing the events in Σ\Σi. Here, Σ\Σi contains the events such as arrival, rejection, acceptance, execution and completion of a task, that may occur with respect to other tasks in the system. In addition, Σ\Σi contains t which is used to model the arbitrary arrival of τi, i.e., ai (no delay), tai (after a tick from the system start), ttai (after two ticks) etc.

• #1 −ai #2: On the occurrence of ai, Ti moves to State #2. Here, the scheduler takes the decision whether to accept (pi) or reject (ri).

• #2−→ri #1: Suppose, the scheduler rejects τi, then Ti transits back to State #1.

• #2 −pi #3: Suppose, the scheduler accepts τi, then Ti transits to State #3. The self-loop transition Σ\Σi is similar to the one present inState #1.

• #3−→ei #4: Ti moves from State #3 toState #4 through τi’s execution eventei.

• #4−→t #5: After the occurrence of tick (t),T reaches State#5 which is similar to State #3. It may be noted that eit represents execution of τi for one time unit.

• #5−→ei #6. . .#7−→ci #8: By continuing in this way,Ti reachesState#7 and moves to State #8 through the completion event ci. Note that the number of ei events executed between the acceptance (pi) event and the completion (ci) event isEi−1.

• #8 −→t #1: After the occurrence of a tick event, Ti moves back to the initial (as well as marked) state #1 to represent taskτi’s completion.

Remark 3.3.1. Generated and Marked Behavior of Ti: The generated behavior L(Ti) is the set of all strings that Ti (shown in Figure 3.12) can generate. The marked be- havior Lm(Ti) is the subset of all strings in L(Ti) for which the terminal state belongs to Qm(= {#1}). The marked language may be described as: Lm(Ti) = (si0(ai(ri + pisi1eitsi2eit...siEicit))), where sij ∈(Σ\Σi) and j ={0,1, . . . , Ei}.

Definition: Deadline-meeting sequence (with respect to preemptive execution): A se- quencex=x1aix2cix3 ∈Lm(Ti), wherex1, x3 ∈Σ,x2 ∈(Σ\ {ci}) isdeadline-meeting, if tickcount(x2)≤ Di−1. Otherwise,x is a deadline-missing sequence.

Theorem 3.3.1. Lm(Ti) contains both deadline-meeting and deadline-missing sequences of task τi.

Proof. Let us consider the execution of task τi on the processor. According to Re- mark 3.3.1, such execution may be represented by a sequence, x =aipixijci, where xij

= xi1eitxi2xit...xiEi and xij ∈ (Σ\Σi) and j = {1,2, . . . , Ei}. It may be noted that xij represents the self-loop Σ\Σi in Ti and contains t in it. This models the waiting time of task τi in the ready queue before it is being assigned onto the processor for execution. Suppose, the task τi is not preempted at anytime after its acceptance to completion, then tickcount(xij) = Ei −1 (≤ Di, Assumption 3). However, τi may be preempted by the scheduler during its execution. Let y be the total amount of time that task τi is kept in the ready queue between its acceptance to completion. If this

3.3 Preemptive Scheduler Synthesis Framework

preemption time (captured by y) is greater than (Di−Ei) ticks from the arrival of τi, then τi is guaranteed to miss its deadline. Hence, the sequence x is deadline-meeting if (y+Ei −1) ≤ Di. Otherwise, x is deadline-missing. Thus, Lm(Ti) contains both deadline-meeting and deadline-missing sequences of τi.

As discussed earlier, deadline-misses cannot be tolerated in hard real-time systems.

In later section, we develop a model that can be used to eliminate deadline-missing sequences from Lm(Ti).

From the perspective of real-time task execution, a sporadic sequence may be con- sidered as the most generic one and subsumes within it the definitions periodic and aperiodic sequences. Therefore, models specifying the behavior of periodic and aperi- odic sequences may be easily derived from the model representing a sporadic sequence.

The synthesis approach presented here attempts to derive scheduling sequences that satisfy sporadic task execution behavior.

Definition: Work-conserving execution sequence [23]: An execution sequence is work- conserving if and only if it never idles the processor when there exists at least one accepted task awaiting execution in the system. Otherwise, it is non-work-conserving.

Work-conserving execution has certain inherent advantages. Specifically, task re- sponse times under work-conserving execution may be lower than non-work-conserving execution since no processor time is wasted. Additionally, the processor time saved due to such early response may be utilized to execute other useful applications. Hence, our finally synthesized scheduler is intended to be work-conserving.

By extending the arguments presented in Theorem 3.3.1, it may be proved that Lm(Ti) represented by the task execution model Ti includes (i) deadline-meeting, (ii) deadline-missing, (iii) sporadic, (iv) non-sporadic (v) work-conserving and (vi) non- work-conserving execution sequences for task τi.

Example: Let us consider a simple two task system τ1h3,6,6i and τ2h2,4,4i. The task execution models T1 for τ1 and T2 for τ2 are shown in Figures 3.13(a) and 3.13(b), respectively. Let us considerT1 corresponding to taskτ1 shown in Figure 3.13(a). Using T1, we illustrate the different types of execution sequences present inLm(T1).

• The sequenceseq1 =a1p1e1te1tc1t∈Lm(T1) isdeadline-meetingsincetickcount(a1

0 T\T1

a1 p1 r1

1 2

T\T1

3 6

T\T1

e1 t c1 7

t

4 T\T1

# of e1 = E1t 1 = 2 e1 5 t

0 T\T2

a2 p2

r2

1 2

T\T2

3 4

T\T2

e2 t c2 5

# of e2 = E2t 1 = 1 t (a)

(b)

Figure 3.13: TDES Models: (a) T1 for τ1h3,6,6i, (b)T2 for τ2h2,4,4i.

p1e1te1tc1) = 2≤ D1−1(= 5). In addition, this sequence is also work-conserving since the processor is never kept idle when the taskτ1 is waiting for execution.

• The sequenceseq2 =a1p1tttte1te1tc1t ∈Lm(T1) isdeadline-missing sincetickcount(a1 p1tttte1te1tc1) = 6 D1 −1(= 5). In addition, this sequence is also non-work- conserving since the processor is kept idle even when the task τ1 is waiting for execution.

• The sequenceseq3 =a1p1e1te1tc1tttta1p1e1te1tc1t ∈Lm(T1) issporadicsincetickcount (a1p1e1te1tc1tttta1) = 6 ≥P1(= 6).

• The sequence seq4 = a1p1e1te1tc1ta1p1e1te1tc1t ∈ Lm(T1) is non-sporadic since tickcount (a1p1e1te1tc1ta1) = 3 P1(= 6).

A similar discussion holds for T2.