Online Scheduling Switch Based on Validity ... - Semantic Scholar

1 downloads 0 Views 99KB Size Report
In this paper we look at the scheduling problem of adjust- ing to the fluctuations of a real-time system. We propose to model each variation as a new set of ...
Online Scheduling Switch Based on Validity Constraint Song Han The University of Texas at Austin

Deji Chen Emerson Process Management

Ming Xiong Bell Labs, Alcatel-Lucent

[email protected]

[email protected]

[email protected]

Aloysius K. Mok The University of Texas at Austin [email protected]

Abstract In this paper we look at the scheduling problem of adjusting to the fluctuations of a real-time system. We propose to model each variation as a new set of real-time tasks, which would be scheduled by the same or different scheduling policies. Under this model, while each scheduling policy must be able to schedule the corresponding task set, realtime requirements also must be met during the switch for tasks that persist through the switch. In this paper we use validity interval to define the real-time criteria and study the scheduling issues arise during the task set switch. We then get into more details by looking at switching between two polarizing fixed-priority scheduling policies, namely Rate-Montonic scheduling (RMA) and Deferrable Scheduling (DS-FP).

1

Introduction

While some real time systems in the real world never change, many go through fluctuations. For example, the system load may temporarily increase and a task may decrease or increase its execution requirement frequently. To handle these fluctuations, typically a system designer assumes the worst case system load and execution time, and then designs the system accordingly. This approach, however, unnecessarily reserves too much resources and severely degrades the system performance. To address this problem, [3] proposed the concept of imprecise computation and reviewed workload models that quantify the trade-off between result quality and computation time. It also described scheduling algorithms that exploit this trade-off. To schedule the aperiodic task set and periodical task set simultaneously, [4] introduced the Deferrable Server algorithm to provide improved aperiodic response time performance while still guarantee the hard deadlines of the periodic tasks. In this paper we take a different approach. We model the system fluctuations as a series of task sets. Each task set deviates slightly from the previous one. The goal is to

meet the real-time requirement of each task in each task set and, for tasks that are included in two consecutive sets, meet their real-time requirements during the transition. Furthermore, this model allows the switching of different scheduling policies between task sets. There are many scheduling policies developed over the years and in general simpler ones have lower processor utilization and more complicated ones have higher processor utilization. If the system load is low, we would prefer to use as simple as possible the scheduling policy; when the system load increases, we would have to switch to more sophisticated policies to meet real-time requirements. The problems arise when we look at meeting the realtime requirement of a task during a switch. After the switch, the first job of a task might have met its deadline according to the new scheduling policy, but its finish time may be after the deadline according to the scheduling policy before the switch. In other words, even if the old task set is schedulable under the old scheduling policy and the new task set is schedulable under the new scheduling policy, a shared task may still miss its deadline during the switch. We shall illustrate this point later. We propose to use the concept of validity constraint to define the real-time requirement. Validity constraint describes quite well the real-time constraints during a scheduling policy change. In a successful policy switch, the jobs of any task that persists through the switch meet the validity constraint. We will provide insight of our idea through the switching of two polarizing scheduling policies, the simple Rate-Monotonic Algorithm (RMA) and Deferrable Scheduling (DS-FP), the more sophisticated but with more efficient use of the processor. The remainder of this paper is structured as follows. Section 2 reviews several algorithms for maintaining temporal validity like HH, ML and DS-FP. Section 3 studies the scheduling switch problem and gets into more details with the switching between RMA and DS-FP. We conclude the paper in Section 4 presents potential future works.

2

3

RMA and DS-FP

This section briefly reviews three scheduling algorithms proposed for maintaining the temporal validity of realtime data object, namely Half-Half (HH) [2], More-Less (ML) [5], and Deferrable Scheduling (DS-FP) [7]. Definition 2.1: A real-time data object (Xi ) at time t is tem-

porally valid (or absolutely consistent) if, for its j th update finished latest before t, the sampling time (ri,j ) plus the validity interval (Vi ) of the data object is not less than t, i.e., ri,j + Vi ≥ t [2]. 2 Half-Half: In HH, the period and relative deadline of a update transaction are each typically set to be one-half of the data validity length [2]. Thus the farthest distance of two consecutive jobs of a update transaction τi is 2Pi . If 2Pi ≤ Vi , then the validity of real-time object Xi is guaranteed as long as jobs of τi meet their deadlines. More-Less: ML adopts the periodic task model [1] and there are three constraints to follow for maintaining temporal validity: validity constraint, deadline constraint and schedulability constraint [5]. ML assigns priorities to transactions based on Shortest Validity First (SVF), i.e., in the inverse order of validity length, and ties are resolved in favor of transactions with larger execution time (Ci ). It assigns deadlines and periods to τi as follows: ml Di = fml i,0 − ri,0 , Pi = Vi − Di ,

(1) (2)

ml where fml i,0 and ri,0 are finishing and sampling times of the first job of τi , respectively. DS-FP: ML is pessimistic on the deadline and period assignment. This is because it uses a periodic task model that has a fixed period and relative deadline for each transaction, and the relative deadline Di is equal to the worst-case response time of the transaction. In order to increase the separation of two consecutive jobs (and thus reduce the sensor update workload), DS-FP adaptively derives the relative deadline and separation of one job from its previous job and preemptions from higher-priority transactions. Readers are referred to [7] for the details of the DS-FP algorithm. An important result of the schedulability analysis between ML and DS-FP are presented below:

Theorem 2.1: (Theorem 3.1 in [7]) Given a synchronous up-

date transaction set T with known Ci and Vi (1 ≤ i ≤ m), Vi if (∀i) fml i,0 ≤ 2 in ML, then WCRTi ≤

fml i,0

where WCRTi and fml i,0 denote the worst-case response time of τi in DS-FP and ML, respectively.

Constraint Based Scheduling Switch

We have already introduced our motivation in Section 1. In this section we will describe the concept of scheduling switch and its related properties. Given two real-time task sets Sb , Sa , and two scheduling policies Ψb , Ψa in which Sb is schedulable under T Ψb and Sa is schedulable under Ψa . Let task set Sc be Sb Sa , the set of common tasks between the two sets. Define tw to be a point in the time line. Our study is focused on the following scenario. A real-time system of Sb is initially controlled by Ψb starting at time 0. At time tw , the system is changed to Sa and a new policy Ψa is in control. The problem is to meet the real-time properties of all tasks in Sc . A related problem is to find valid candidates of tw that preserves Sc ’s requirements. First we should define the real-time requirement during the switch. Define Sb− = Sb − Sc and Sa− = Sa − Sc . Since all tasks S are schedulable by their respective Ψ, all tasks in Sb− Sa− are schedulable. However, if a task in Sb− has outstanding execution at tw , this last job is undetermined. If we simply drop it, then Ψb fails it; if we let it run to finish, then it interferes with Ψa ; also how it should be scheduled after tw is unspecified. Based on these observations, we conclude that we shall only study the cases where the last jobs of all tasks in Sb− are completed before tw . For tasks in Sc , they are schedulable up until tw . Ψa may be affected by their last jobs before tw . Some scheduling policies are preconditioned upon the fixed starting times of the first jobs. For example all tasks start at time 0. Similar problems arise if a task in Sc has outstanding execution at tw . Should this job be considered the first job under Ψa ? If so then it no longer has full execution requirement. If not then it may not meet its deadline defined in Ψb depending on how Ψa schedules it; further more, it also interferes with Ψa just as those tasks in Sb− could do. In either case Ψa cannot have a clean start. Example 3.1: Figure 1 depicts a non-clean switch of simple

periodic task sets in which all tasks start at time 0 and deadline equals period. Sb = Sa = {T1 = (2, 4), T2 = (3, 8)}, Ψb = Ψa = RMA, and tw = 6. In the figure, (a) is the schedule of Ψb plus what could have been after tw ; (b) is the schedule of Ψa which treats tw as time 0. In this run, T2 ’s outstanding job is run to the finish but preempted by T1 ’s first job after tw . So it misses its deadline defined in Ψb . Interestingly all jobs after tw meet deadlines in spite of this extra execution. 2 We do not want to trivialize our study because of this and further conclude that we shall only study the switch cases where: • The last jobs of all tasks in Sb are completed before tw , i.e, there is not out standing execution at time tw .

  

    

   !"#$%" &'(

 :   ;" 



&)(





*+, -. /01 . /1 23/-/'4546 703/24 &8'95( Figure 1. Non-clean switch from RMA to RMA • Ψa shall schedule Sa independent of the prior schedule as if tw is its time 0. We call such switch clean switch. And we shall only study clean switch from now on. For a task in Sc , although its last job before tw and first job after tw meet the deadlines in their respective Ψ, we could not say that its real-time requirement is met. Figure 2 depicts a clean switch of validity constrained task sets. Sb = {T1 = (C1 , V1 ) = (4, 16), T2 = (C2 , V2 ) = (5, 26)}. We switch the same task set from Ψb = DS-FP to Ψa = RMA at tw = 18. modeled in HH, Sa = {(4, 8), (5, 13)}. In the figure, (a) is the schedule of Ψb plus what could have been after tw ; (b) is the schedule of Ψa which treats tw as time 0. For T1 , its last job before tw starts at time 12 and its first job after tw finishes at time 22. The distance is 10, which is less than V1 . For T2 , however, its last job before tw starts at time 4 and its first job after tw finishes at time 31. The distance is 27, which is bigger than V2 . So T2 ’s validity constraint is violated during the switch. 2 Example 3.2:

Example 3.2 exposes hidden real-time requirements that could be missed. After all, all tasks meet their real-time requirements before and after the switch. What else should we consider? Introducing validity constraint has many advantages. First, it enables to model the same real-time application in both Sb and Sa , potentially different task models. Second, it abstracts out the real-time constraints during the switch so that Ψb and Ψa could be independently applied as they are originally devised. Third, it allows the same task to fluctuate as well. For example, the execution time of a task in Sc may change to a different value after tw . We define a successful switch to be one that for all task T, T ∈ Sc , T ’s first job finishes within V from the start time of its last job before tw . Our problem now becomes how to find a time point at which a successful switch is possible. This is also reasonable in practice. A real-time system normally tolerates some delay in its adjustment to the fluctua-

tions. Or a successful switch point could be pre-calculated and the switch be applied before the anticipated fluctuation occurs. Next we shall study the properties of tw . An idle period (t1 , t2 ) of a schedule begins when the last outstanding execution of any task is finished right before t1 and there is no new job request until t2 . The process does not execute any jobs within (t1 , t2 ). Our definition includes trivial periods in which t1 = t2 . Since we are talking about clean switch, obviously tw falls within some idle period. If tw ∈ (t1 , t2 ) is a successful switch point, any time point in (t1 , tw ) must also be a successful switch point because the new switch shifts Ψa ’s schedule closer to time 0. Any first job in Sc will have an earlier finish time hence will meet validity constraint. We have the following lemma. Any successful switch point falls in an idle period and any time point from the beginning of the idle period to this switch point is also a successful switch point.

Lemma 3.1:

Note in Figure 2, 18 is not a successful switch point, but both 16 and 17 are successful switch points. This gives us the following search algorithm for tw . Algorithm 3.1 SearchSwitchPoint: Input: Sb , Sa , Ψb , Ψa , and the search start time t0 Output: tw . 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

for t = t0 to t0 + Pl do // Pl is the length of the shortest pattern of Sb in Ψb if t = t1 ; // t1 is the begin point of an idle period then f = 1; // whether t is a possible candidate for tw T foreach Ti ∈ Sb Sa do ts = request time of Ti ’s last job in Ψb ; l = time to finish Ti ’s first job inΨa ; if (t − ts + l > Vi ) then f = 0; fi od if (f = 1) then return t; fi; fi od return no tw exists ;

As all schedulable schedules have a repeating pattern in discrete time system [6], Algorithm 3.1 runs at most the length of the shortest pattern of the schedule, Pl , and will eventually terminate. It will report no tw exists if there is no successful switch point. Otherwise, if there is any successful switch point, then the algorithm will always return one. Note in above algorithm we do not require that the task parameters of a task in Sc to be the same before and after the switch. A task may have increased execution time, or even shortened period, validity length, etc.

?@=ABC D=AEFG fgh

H RSTUVW XYTZU

J

IH

?@KALC MKANFG

Suggest Documents