Explicit Preemption Placement for Real- Time Conditional Code via Graph Grammars and Dynamic...
-
Upload
giancarlo-flash -
Category
Documents
-
view
217 -
download
0
Transcript of Explicit Preemption Placement for Real- Time Conditional Code via Graph Grammars and Dynamic...
Explicit Preemption Placement for Real-Time Conditional Code via Graph Grammars and Dynamic Programming
Bo Peng, Nathan Fisher, and Marko Bertogna
Department of Computer Science, Wayne State University, USA
Algorithmic Research Group, University of Modena, Italy
211
1
2
This research has been supported by US National Science Foundation and the European Commission.
Graph grammars; Dynamic programming.
Optimize the WCET+CRPD of the flowgraphs.
Series-parallel flowgraphs.
Limited-preemption scheduling model in real -time code.
22
Outline
Background
Model
Problem Statement
Solution
44
IntroductionBackgroundBackgroundModelModelProblem StatementProblem StatementSolutionsSolutionsConclusionsConclusions
WCET+CRPD analysis
Real-time schedulability analysis
Limited preemption scheduling
Reduce WCET+CRPD
Write A Read A
Write B
55
Limited Preemption SchedulingBackgroundBackgroundModelModelProblem StatementProblem StatementSolutionsSolutionsConclusionsConclusions
CRPD
Cache evictions by preempting higher-priority tasks.
Precise upper bounds on the cache-related preemption delays (CRPD).Delay the preemption to maintain a job's locality.
Reduce WCET when arbitrarily preempt
Cache
TAG AB
Cache eviction
Cache reload
66
Limited Preemption SchedulingBackgroundBackgroundModelModelProblem StatementProblem StatementSolutionsSolutionsConclusionsConclusions
Precise upper bounds on the cache-related preemption delays (CRPD).Delay the preemption to maintain a job's locality.
Reduce WCET when arbitrarily preempt
Reduce CRPD via limited preemption while preserving system schedulability.
Our goal
77
Related WorkBackgroundBackgroundModelModelProblem StatementProblem StatementSolutionsSolutionsConclusionsConclusions
Fixed preemption
point models
Floating preemption point
models
EDF scheduled systems
Burns ['94]Baruah ['05]Bertogna and Baruah ['10]
Fixed Priority scheduled systems
Burns ['94], Bril et al. ['09],Bertogna et al. ['11], Davis et al. ['12]
Yao et al. ['09]
Preemption model
Scheduling algorithm
Code structure
Linear code structure
Bertogna et al.['10, '11]
Conditional code structure
Our work ?
Control flowgraph: : set of basic blocks (BBs) : set of edges : WCET function of BBs : CRPD function of edges : Potential Preemption Point : Effective Preemption Point
88
Model),,,( zsP EVG
},...,,{ 21 nV
VVE ),( 21
0:
0:
E
VC
BackgroundBackgroundModelModelProblem StatementProblem StatementSolutionsSolutionsConclusionsConclusions
PPP
EPP
1
2
3
4s z
99
Can handle "if else" and "switch" statements.
Observation
Model Series-parallel graphs:
Graph Creation
Series Composition
Parallel Composition
BackgroundBackgroundModelModelProblem StatementProblem StatementSolutionsSolutionsConclusionsConclusions
1010
Problem StatementBackgroundBackgroundModelModelProblem StatementProblem StatementSolutionsSolutionsConclusionsConclusions
Series-parallel graphs
Sum of BBs' WCETSum of selected
edges' CRPDChoose the path with max WCET+CRPD
NPR from e1 to xUpper bound of NPR from schedulability
analysis
1111
Problem Statement
Find a selection of EPPs that minimizes the WCET+CRPD of a flowgraph.
The cost of any non-preemptive region should less than Q.
A B C D E F G H I3 4 1 2 1 2 1 3 2
1 3 5 5 1 6 3 1
BackgroundBackgroundModelModelProblem StatementProblem StatementSolutionsSolutionsConclusionsConclusions
1NPR 2NPR 3NPR 4NPR
Cost=7 Cost=7 Cost=7 Cost=3
Cost = 24
Q=8
Bertogna et al.['11]
Optimal selection of EPPsin sequential flowgraphs
1212
Previous algorithm is not optimal for conditional structure.Use graph grammar and dynamic programming technique.
Upper path: 28Lower path: 25Combined result: 32(U)Optimal result: 27(L)
Observation
Problem Statement
How about the previous algorithm for conditional structure?
A B C
D E F
J K L
3 4 1
2 1 2
1 3 2
1 3
55 1 6
3 1
G H I1 2 3
1 6
7 5
BackgroundBackgroundModelModelProblem StatementProblem StatementSolutionsSolutionsConclusionsConclusions
WCET+CRPD
Q=8
1313
Graph Grammar Decompose control flowgraphs (Linear time
parsing) Extended Backus-Naur Form (EBNF)
BackgroundBackgroundModelModelProblem StatementProblem StatementSolutionsSolutionsConclusionsConclusions
04/18/23
1414
<SB> <SB>
Dynamic Programming:Sequential Block
BackgroundBackgroundModelModelProblem StatementProblem StatementSolutionsSolutionsConclusionsConclusions
0 1 2 3 4 5 6 70 4 4 4 4 4 INF INF INF1 4 4 4 4 INF INF INF INF2 4 4 4 INF INF INF INF INF3 4 4 INF INF INF INF INF INF4 4 INF INF INF INF INF INF INF5 INF INF INF INF INF INF INF INF6 INF INF INF INF INF INF INF INF7 INF INF INF INF INF INF INF INF
0 1 2 3 4 5 6 70 7 7 8 8 INF INF INF INF1 7 8 8 8 INF INF INF INF2 8 8 8 8 INF INF INF INF3 8 8 8 8 INF INF INF INF4 8 8 8 8 INF INF INF INF5 8 8 8 8 INF INF INF INF6 INF INF INF INF INF INF INF INF7 INF INF INF INF INF INF INF INF
Q=84
s z3 1
s A zB
]][[ zsCost Blocks contains and :A B ]][[ zsCost Blocks only contains :B
Cost matrices reflect optimal substructures
4]0][4[]][[:2
4]0][1[]][[:1
CostCost
Cost),,(Cost
ZAS
ZBBA
743)(]][[:2
8413)(]][[:1
prevAZS
prevBAAZS
CostCCost
Cost),(CCost
1515
Corollary
(1)For each pathFour possible situations: whether take the preemption before and after the middle block;Choose the min WCET+CRPD from the four situations.(2)Choose the max WCET+CRPD among all paths.
Theorem
A optimal EPP selection of a CB is combined by optimal selections of all sequential paths.
Theorem
A optimal EPP selection of a larger block is combined by the optimal selections of left block and right block.
Dynamic Programming:Conditional Block and Block Union
Corollary
(1)Preempt at the edge between the two blocks.Left block: cost[i][0];Right block: cost[edge_value][j];WCET+CRPD: cost[i][0]+ edge_value + cost[edge_value][j].(2)Do not preempt at the edge between the two blocks.Leftblock: cost[i][x];Rightblock: cost[Q-x][j];x from 1to Q;WCET+CRPD:min{cost[i][x]+cost[Q-x][j]}. min{cost[i][x]+cost[Q-x][j]}.(3)Choose the smaller WCET+CRPD between (1) and (2) as cost[i][j] of the larger block.
A B C
D E F
J K L
3 4 1
2 1 2
1 3 2
1 3
55 1 6
3 1
G H I1 2 3
1 6
7 5
]0][0[CostQQ
)|(| 3QVO
<SB> <SB>
B4
z3
s
1
A
Q=8
BackgroundBackgroundModelModelProblem StatementProblem StatementSolutionsSolutionsConclusionsConclusions
(1) Get the optimal value of when preempt.
(2) Get the optimal value of when do not preempt.
1616
Dynamic Programming:Conditional Block and Block Union
A B C
D E F
J K L
3 4 1
2 1 2
1 3 2
1 3
55 1 6
3 1
G H I1 2 3
1 6
7 5
]0][0[Cost )|(| 3QVO
Q=8
BackgroundBackgroundModelModelProblem StatementProblem StatementSolutionsSolutionsConclusionsConclusions
In conditional structure:Optimal EPPs selection in pseudo-polynomial time.
Contribution
Approximate flexible matrix The WCET+CRPD will be larger than the optimal one. Reduce running time. Time complexity:
1717
An Alternative HeuristicBackgroundBackgroundModelModelProblem StatementProblem StatementSolutionsSolutionsConclusionsConclusions
... ...
...
...
)|(| 3VO:0i:0j
A B C
D E F
J K L
3 4 1
2 1 2
1 3 2
1 3
55 1 6
3 1
G H I1 2 3
1 6
7 5
]0][0[Cost QQ
Q
i
Q
Q
i0
Q
2
Q
Q
2
0
Q step each time
1818
Computational Complexity Consider parse tree and cost matrix:
Optimal solution: Heuristic solution:
)|(| 3QVO
)|(| 3VO
BackgroundBackgroundModelModelProblem StatementProblem StatementSolutionsSolutionsConclusionsConclusions
Randomly generate control flowgraphs: number of BBs. number of CBs.
WCET of BBs: Gaussian distribution.
CRPD: Correlates adjacent EPPs. Randomly generated
with a gaussian factor.
1919
Simulations
Bertogna et al.['11]
Similar to a realistic distribution
BackgroundBackgroundModelModelProblem StatementProblem StatementSolutionsSolutionsConclusionsConclusions
2020
Simulations: WCETBackgroundBackgroundModelModelProblem StatementProblem StatementSolutionsSolutionsConclusionsConclusions
OPT (green mesh)<Alternative heuristic (black mesh)<SEQ (red mesh)
WCET trend
CRPD +
2121
Simulations: Running timeBackgroundBackgroundModelModelProblem StatementProblem StatementSolutionsSolutionsConclusionsConclusions
Alternative heuristic (black mesh) dominates over OPT and SEQ
Time trend
2222
Simulations: WCETBackgroundBackgroundModelModelProblem StatementProblem StatementSolutionsSolutionsConclusionsConclusions
Smaller size of matrices does not significantly increase WCET+CRPD
Comparison of different setting for heuristics
CRPD +
2323
Simulations: Running timeBackgroundBackgroundModelModelProblem StatementProblem StatementSolutionsSolutionsConclusionsConclusions
Smaller size of matrices significantly decreases running time
Comparison of different setting for heuristics
2424
Additional Structure
Unrolled LoopNon-Unrolled Loop
(a) Loops:
Calculate the cost matrix of FiEmbed Fi to the main control flowgraph
(b) Function call:
Conlusions: Extend the structure to conditional blocks Optimal algorithm for selection of EPPs An alternative heuristic to reduce running time Exhaustive simulation
Future work: Planar separator theory Parameterized theory NP-Completeness Or, is the problem NP-
Complete?
Do optimal algorithms using polynomial time exist?
2525
Conlusions and Future WorkBackgroundBackgroundModelModelProblem StatementProblem StatementSolutionsSolutionsFuture WorkFuture Work
2727
Related WorkEDF scheduled
systemsFixed
preemption point models
Burns ['94] : [11] A. Burns. Preemptive priority based scheduling: An appropriate engineering approach
EDF scheduled systemsFloating
preemption point models
Baruah ['05] : [4] S. Baruah. The limited-preemption uniprocessor scheduling of sporadic task systems.Bertogna and S. Baruah ['10] : [5] M. Bertogna and S. Baruah. Limited preemption EDF scheduling of sporadic task systems.
Fixed Priority scheduled
systemFixed
preemption point models
Burns ['94] : [11] A. Burns. Preemptive priority based scheduling: An appropriate engineering approachBril et al.['12]: [10]Worst-case response time analysis of real-time tasks under fixed-priority scheduling with deferred preemption.Bertogna et al. ['11]: [7] M. Bertogna et al. Improving feasibility of fixed priority tasks using non-preemptive regions.Davis et al. ['12] : [13] R. Davis and M. Bertogna. Optimal fixed priority scheduling with deferred preemption.
Fixed Priority scheduled
systemFloating preemption
point models
Yao et al. ['09]: [19] G. Yao, G. Buttazzo, and M. Bertogna. Bounding the maximum length of non-preemptive regions under fixed priority scheduling.
linear code structure
Fixed preemption
point models
Bertogna et al. ['10]: [6] M. Bertogna et al. Preemption points placement for sporadic task sets.Bertogna et al. ['11]: [8] M. Bertogna et al. Optimal selection of preemption points to minimize preemption overhead.