![Page 1: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/1.jpg)
The Global Control-Flow GraphOptimizing an Event-Driven Real-Time System
Across Kernel Boundaries
Christian Dietrich, Martin Hoffmann, Daniel Lohmann
{dietrich,hoffmann,lohmann}@cs.fau.de
Friedrich-Alexander UniversityErlangen-Nuremberg
19. June 2015
supported by
![Page 2: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/2.jpg)
Compiler Optimization on Function Level
void compute (int a[], int len , int val) {for (int i = 0; i < len; i++) {
a[i] = a[i] + val + 1000;}
} Calculated in each Iteration
void compute (int a[], int len , int val) {int temp = val + 1000;for (int i = 0; i < len; i++) {
a[i] = a[i] + temp;}
}
Loop-Invariant Code Motion
FAU The Global Control-Flow Graph 2 – 19
![Page 3: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/3.jpg)
Compiler Optimization on Function Level
void compute (int a[], int len , int val) {for (int i = 0; i < len; i++) {
a[i] = a[i] + val + 1000;}
} Calculated in each Iteration
void compute (int a[], int len , int val) {int temp = val + 1000;for (int i = 0; i < len; i++) {
a[i] = a[i] + temp;}
}
Loop-Invariant Code Motion
FAU The Global Control-Flow Graph 2 – 19
![Page 4: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/4.jpg)
Compiler Optimization on Function Level
void compute (int a[], int len , int val) {for (int i = 0; i < len; i++) {
a[i] = a[i] + val + 1000;}
} Calculated in each Iteration
void compute (int a[], int len , int val) {int temp = val + 1000;for (int i = 0; i < len; i++) {
a[i] = a[i] + temp;}
}
Loop-Invariant Code Motion
FAU The Global Control-Flow Graph 2 – 19
![Page 5: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/5.jpg)
Compiler Optimization on Program Level
int lastVal , data [2];void compute (int a[], int len , int val) {
int temp = val + 1000;...
}void Task1 () {
compute (data , 2, lastVal );}
int lastVal , data [2];void Task1 (){
int temp = lastVal + 1000;data [0] = data [0] + temp;data [1] = data [1] + temp;
}
Inlining and Loop Unrolling
FAU The Global Control-Flow Graph 3 – 19
![Page 6: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/6.jpg)
Compiler Optimization on Program Level
int lastVal , data [2];void compute (int a[], int len , int val) {
int temp = val + 1000;...
}void Task1 () {
compute (data , 2, lastVal );}
int lastVal , data [2];void Task1 (){
int temp = lastVal + 1000;data [0] = data [0] + temp;data [1] = data [1] + temp;
}
Inlining and Loop Unrolling
FAU The Global Control-Flow Graph 3 – 19
![Page 7: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/7.jpg)
Compiler Optimization on Program Level
int lastVal , data [2];void compute (int a[], int len , int val) {
int temp = val + 1000;...
}void Task1 () {
compute (data , 2, lastVal );}
int lastVal , data [2];void Task1 (){
int temp = lastVal + 1000;data [0] = data [0] + temp;data [1] = data [1] + temp;
}
Inlining and Loop Unrolling
FAU The Global Control-Flow Graph 3 – 19
![Page 8: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/8.jpg)
Compiler Optimization on System Level (potential)
void Task1 (){int temp = lastVal + 1000;data [0] = data [0] + temp;data [1] = data [1] + temp;
}void Task2 () {
lastVal = 23;ActivateTask (Task1 ); // System Call
}
void Task1 (){data [0] = data [0] + 1023;data [1] = data [1] + 1023;
}void Task2 () {/* unchanged */}
Constant Propagation across Kernel Boundaries
FAU The Global Control-Flow Graph 4 – 19
![Page 9: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/9.jpg)
Compiler Optimization on System Level (potential)
void Task1 (){int temp = lastVal + 1000;data [0] = data [0] + temp;data [1] = data [1] + temp;
}void Task2 () {
lastVal = 23;ActivateTask (Task1 ); // System Call
}
void Task1 (){data [0] = data [0] + 1023;data [1] = data [1] + 1023;
}void Task2 () {/* unchanged */}
Constant Propagation across Kernel Boundaries
FAU The Global Control-Flow Graph 4 – 19
![Page 10: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/10.jpg)
Compiler Optimization on System Level (potential)
void Task1 (){int temp = lastVal + 1000;data [0] = data [0] + temp;data [1] = data [1] + temp;
}void Task2 () {
lastVal = 23;ActivateTask (Task1 ); // System Call
}
void Task1 (){data [0] = data [0] + 1023;data [1] = data [1] + 1023;
}void Task2 () {/* unchanged */}
Constant Propagation across Kernel Boundaries
FAU The Global Control-Flow Graph 4 – 19
![Page 11: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/11.jpg)
A System Model for the Compiler
Problem: System-Calls are not transparent for the compilerCompilers stay only within the language levelPossible operating-system decisions are not taken into account
Solution: We supply an OS execution modelKnowledge about application–OS interactionExecution model includes possible scheduling decisionSystem calls become more transparent for the compiler
Especially useful for embedded real-time systemsApplication and kernel are often statically combinedPrecise OS execution model through determinism
FAU The Global Control-Flow Graph 5 – 19
![Page 12: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/12.jpg)
A System Model for the Compiler
Problem: System-Calls are not transparent for the compilerCompilers stay only within the language levelPossible operating-system decisions are not taken into account
Solution: We supply an OS execution modelKnowledge about application–OS interactionExecution model includes possible scheduling decisionSystem calls become more transparent for the compiler
Especially useful for embedded real-time systemsApplication and kernel are often statically combinedPrecise OS execution model through determinism
FAU The Global Control-Flow Graph 5 – 19
![Page 13: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/13.jpg)
A System Model for the Compiler
Problem: System-Calls are not transparent for the compilerCompilers stay only within the language levelPossible operating-system decisions are not taken into account
Solution: We supply an OS execution modelKnowledge about application–OS interactionExecution model includes possible scheduling decisionSystem calls become more transparent for the compiler
Especially useful for embedded real-time systemsApplication and kernel are often statically combinedPrecise OS execution model through determinism
FAU The Global Control-Flow Graph 5 – 19
![Page 14: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/14.jpg)
Outline
Question 1:How to gather OS exeuction model for a static real-time systems?
Global Control-Flow Graph
Question 2:How to utilize the gathered information?
Specialized System CallsAssertions on the System StateKernel as a Statemachine. . .
Kernel Runtime: -30 %
Resilience Against Bitflips: +50 %
FSM with 728 States
![Page 15: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/15.jpg)
Outline
Question 1:How to gather OS exeuction model for a static real-time systems?
Global Control-Flow Graph
Question 2:How to utilize the gathered information?
Specialized System CallsAssertions on the System StateKernel as a Statemachine. . .
Kernel Runtime: -30 %
Resilience Against Bitflips: +50 %
FSM with 728 States
![Page 16: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/16.jpg)
Event-Triggered Static Real-Time Systems
Basic assumptions for our system-level analysisEvent-triggered real-time systems: execution threads, interrupts, etc.Static system design: fixed number of threads, fixed priorityDeterministic system-call semantic and schedulingSystem-calls are fixed in location and arguments
Assumption apply to a wide range of systems: OSEK, AUTOSARIndustry standard widely employed in the automotive industryStatic configuration at compile-time
FAU The Global Control-Flow Graph 7 – 19
![Page 17: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/17.jpg)
Event-Triggered Static Real-Time Systems
Basic assumptions for our system-level analysisEvent-triggered real-time systems: execution threads, interrupts, etc.Static system design: fixed number of threads, fixed priorityDeterministic system-call semantic and schedulingSystem-calls are fixed in location and arguments
Assumption apply to a wide range of systems: OSEK, AUTOSARIndustry standard widely employed in the automotive industryStatic configuration at compile-time
FAU The Global Control-Flow Graph 7 – 19
![Page 18: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/18.jpg)
Example Application
Static System ConfigurationTASK TaskA {
PRIORITY = 0;AUTOSTART = TRUE;
};
TASK TaskB {PRIORITY = 10;
};
Application Codevoid TaskA () {
int val = readData ();buf. append (val );if (val != ’\n’) {
buf. finalize ();ActivateTask (TaskB );buf.clear ();
}TerminateTask ();
}
void TaskB () {buf.print ();TerminateTask ();
}
FAU The Global Control-Flow Graph 8 – 19
![Page 19: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/19.jpg)
Control-Flow Graph
TaskA (priority: 0)
TaskB (priority: 10)
val = readData();buf.append(val);if (val != ’\n’)
buf.finalize();
ActivateTask(TaskB)
buf.clear();
TerminateTask();
buf.print();
TerminateTask();
GCFG CFG Computation System Call
FAU The Global Control-Flow Graph 9 – 19
![Page 20: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/20.jpg)
Global Control-Flow Graph (GCFG)
TaskA (priority: 0)
TaskB (priority: 10)
val = readData();buf.append(val);if (val != ’\n’)
buf.finalize();
ActivateTask(TaskB)
buf.clear();
TerminateTask();
buf.print();
TerminateTask();
GCFG CFG Computation System Call
FAU The Global Control-Flow Graph 9 – 19
![Page 21: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/21.jpg)
GCFG and System State Enumeration
The GCFG contains all possible scheduling decisionsGCFG is OS specificGCFG is application specific
Combine three information sources in System-State EnumerationSystem specificationStatic system configurationApplication structure from control-flow graphs
Basic principle of system-state enumerationInstantiate abstract OS model with system configurationSimulate the application structure on top of the OS modelDiscover all possible system states
FAU The Global Control-Flow Graph 10 – 19
![Page 22: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/22.jpg)
GCFG and System State Enumeration
The GCFG contains all possible scheduling decisionsGCFG is OS specificGCFG is application specific
Combine three information sources in System-State EnumerationSystem specificationStatic system configurationApplication structure from control-flow graphs
Basic principle of system-state enumerationInstantiate abstract OS model with system configurationSimulate the application structure on top of the OS modelDiscover all possible system states
FAU The Global Control-Flow Graph 10 – 19
![Page 23: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/23.jpg)
GCFG and System State Enumeration
The GCFG contains all possible scheduling decisionsGCFG is OS specificGCFG is application specific
Combine three information sources in System-State EnumerationSystem specificationStatic system configurationApplication structure from control-flow graphs
Basic principle of system-state enumerationInstantiate abstract OS model with system configurationSimulate the application structure on top of the OS modelDiscover all possible system states
FAU The Global Control-Flow Graph 10 – 19
![Page 24: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/24.jpg)
System-State Enumeration and the Transition Graph
TerminateTask()
State Transtion Graph
buf.clear()
TerminateTask()
Idle
ready
TaskATaskState
running
TaskB
0Priority 10
buf.clear();ResumePoint TerminateTask()– TerminateTask()–
TaskB TerminateTask()NextBlock TaskA buf.clear()NextBlock TaskA TerminateTask()NextBlock
– IdleNextBlock
Abstract System State
FAU The Global Control-Flow Graph 11 – 19
![Page 25: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/25.jpg)
System-State Enumeration and the Transition Graph
TerminateTask()
State Transtion Graph
buf.clear()
TerminateTask()
Idle
running
TaskATaskState suspended
TaskB
0Priority 10
buf.clear();ResumePoint TerminateTask()– TerminateTask()–
TaskB TerminateTask()NextBlock TaskA buf.clear()NextBlock TaskA TerminateTask()NextBlock
– IdleNextBlock
Abstract System State
FAU The Global Control-Flow Graph 11 – 19
![Page 26: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/26.jpg)
System-State Enumeration and the Transition Graph
TerminateTask()
State Transtion Graph
buf.clear()
TerminateTask()
Idle
running
TaskATaskState suspended
TaskB
0Priority 10
buf.clear();ResumePoint TerminateTask()– TerminateTask()–
TaskB TerminateTask()NextBlock TaskA buf.clear()NextBlock TaskA TerminateTask()NextBlock
– IdleNextBlock
Abstract System State
FAU The Global Control-Flow Graph 11 – 19
![Page 27: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/27.jpg)
System-State Enumeration and the Transition Graph
TerminateTask()
State Transtion Graph
buf.clear()
TerminateTask()
Idle
suspended
TaskATaskState suspended
TaskB
0Priority 10
buf.clear();ResumePoint TerminateTask()– TerminateTask()–
TaskB TerminateTask()NextBlock TaskA buf.clear()NextBlock TaskA TerminateTask()NextBlock
– IdleNextBlock
Abstract System State
FAU The Global Control-Flow Graph 11 – 19
![Page 28: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/28.jpg)
Transforming the State-Transition Graph
A
B
C D
A A
B B
C D
Group Statesby Next Block
FAU The Global Control-Flow Graph 12 – 19
![Page 29: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/29.jpg)
Transforming the State-Transition Graph
A
B
C D
A A
B B
C D
Group Statesby Next Block
FAU The Global Control-Flow Graph 12 – 19
![Page 30: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/30.jpg)
Transforming the State-Transition Graph
A
B
C D
A A
B B
C D
Group Statesby Next Block
FAU The Global Control-Flow Graph 12 – 19
![Page 31: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/31.jpg)
Outline
Question 1:How to gather OS exeuction model for a static real-time systems?
Global Control-Flow Graph
Question 2:How to utilize the gathered information?
Specialized System CallsAssertions on the System StateKernel as a Statemachine. . .
Kernel Runtime: -30 %
Resilience Against Bitflips: +50 %
FSM with 728 States
![Page 32: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/32.jpg)
Outline
Question 1:How to gather OS exeuction model for a static real-time systems?
Global Control-Flow Graph
Question 2:How to utilize the gathered information?
Specialized System CallsAssertions on the System StateKernel as a Statemachine. . .
Kernel Runtime: -30 %
Resilience Against Bitflips: +50 %
FSM with 728 States
![Page 33: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/33.jpg)
Control-Flow Graph
TaskA (priority: 0)
TaskB (priority: 10)
val = readData();buf.append(val);if (val != ’\n’)
buf.finalize();
ActivateTask(TaskB)
buf.clear();
TerminateTask();
buf.print();
TerminateTask();
GCFG CFG Computation System Call
FAU The Global Control-Flow Graph 14 – 19
![Page 34: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/34.jpg)
Traditional Library Operating System
ActivateTask(TaskB)
ActivateTask(Task task)
set_ready(task);Task next = schedule();dispatch(next);
set_ready(Task task)...
Task schedule()...
. . .
call
call
call
ApplicationOS Library
System-Call SiteOS Function
Dictate on generality: ”One size fits all”One system-call implementation for all system-call sitesSystem-call must be callable from anywhereCode reuse saves flash memory
FAU The Global Control-Flow Graph 15 – 19
![Page 35: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/35.jpg)
Specialized System Calls
set_ready(TaskB);dispatch_start(TaskB);
set_ready(Task task)...
Task schedule()...
dispatch_start(...)...
dispatch_resume(...)...
ApplicationOS Library
call
call
System-Call SiteOS Function
Specialize each system-call site:Strip out computation steps with predictable outcomeTrade-off between run time and code sizeOutgoing edges in the GCFG are possible schedule() results.
FAU The Global Control-Flow Graph 16 – 19
![Page 36: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/36.jpg)
Evaluation Scenario
dOSEKEvaluation System: dOSEK (dependable OSEK) (RTAS’15)
Fault-tolerant OSEK implementation for IA-32Generative Approach
Scenario: Quadrotor Flight Control11 tasks, 3 alarms, 1 ISR53 system-call sitesExecute system for 3 hyperperiods
FAU The Global Control-Flow Graph 17 – 19
![Page 37: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/37.jpg)
Evaluation Scenario
dOSEKEvaluation System: dOSEK (dependable OSEK) (RTAS’15)
Fault-tolerant OSEK implementation for IA-32Generative Approach
Scenario: Quadrotor Flight Control11 tasks, 3 alarms, 1 ISR53 system-call sitesExecute system for 3 hyperperiods
FAU The Global Control-Flow Graph 17 – 19
![Page 38: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/38.jpg)
Outline
Question 1:How to gather OS exeuction model for a static real-time systems?
Global Control-Flow Graph
Question 2:How to utilize the gathered information?
Specialized System CallsAssertions on the System StateKernel as a Statemachine. . .
Kernel Runtime: -30 %
Resilience Against Bitflips: +50 %
FSM with 728 States
![Page 39: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/39.jpg)
Conclusion and Future Work
“ With Great Knowledge comesGreat Optimization Potential .
– SpiderGCC ”Fine-Grained Analysis of Event-Triggered, Static Real-Time Systems
The Global Control-Flow Graph includes the application–OS interactionAdditional static knowledge from the state-transition graph
Fine-Grained Tailoring of Application and KernelReduction of kernel runtime by ∼ 30 percentMonitoring of static system properties: ∼ 50 pecent smaller SDC rate
Further ApplicationsImprove worst-case execution time analysis of whole applicationsReplace Kernel by a State Machine (→ OSPERT’15)
Source code available at https://github.com/danceos/dosek
FAU The Global Control-Flow Graph 19 – 19
![Page 40: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/40.jpg)
System State Assertions
TaskA TaskB
ActivateTask(TaskB)
assert ready(TaskA)assert suspended(TaskB)
/* Enter Hook */
assert ready(TaskA)assert suspended(TaskB)
/* Leave Hook */
buf.print();
(empty) TerminateTask()
assert ready(TaskA)assert ready(TaskB)
/* Enter Hook */
GCFG CFG Computation System Call
FAU The Global Control-Flow Graph 20 – 19
![Page 41: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/41.jpg)
System State Assertions
TaskA TaskB
ActivateTask(TaskB)
assert ready(TaskA)assert suspended(TaskB)
/* Enter Hook */
assert ready(TaskA)assert suspended(TaskB)
/* Leave Hook */
buf.print();
(empty) TerminateTask()
assert ready(TaskA)assert ready(TaskB)
/* Enter Hook */
GCFG CFG Computation System Call
FAU The Global Control-Flow Graph 20 – 19
![Page 42: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/42.jpg)
System State Assertions
TaskA TaskB
ActivateTask(TaskB)
assert ready(TaskA)assert suspended(TaskB)
/* Enter Hook */
assert ready(TaskA)assert suspended(TaskB)
/* Leave Hook */
buf.print();
(empty) TerminateTask()
assert ready(TaskA)assert ready(TaskB)
/* Enter Hook */
GCFG CFG Computation System Call
FAU The Global Control-Flow Graph 20 – 19
![Page 43: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/43.jpg)
System State Assertions
TaskA TaskB
ActivateTask(TaskB)
assert ready(TaskA)assert suspended(TaskB)
/* Enter Hook */
assert ready(TaskA)assert suspended(TaskB)
/* Leave Hook */
buf.print();
(empty) TerminateTask()
assert ready(TaskA)assert ready(TaskB)
/* Enter Hook */
GCFG CFG Computation System Call
FAU The Global Control-Flow Graph 20 – 19
![Page 44: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/44.jpg)
Fault Injectionof
System-State Assertions
![Page 45: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/45.jpg)
Results with 748 Assertions
Base . . . with Assertions0
500
1,000
1,500 ·106
−51%
1,39
1.51
685.
14
Abs
olut
eSD
CCo
unts
Unprotected dOSEK
Base . . . with Assertions0
0.05
0.1
0.15·106
−49%0.15
0.08
Protected dOSEK
Base . . . with Assertions0
20
40
60
80+25%
68
85
Inst
ruct
ions
per
Sysc
all
Base . . . with Assertions0
100
200
300+9%
270 29
3
FAU The Global Control-Flow Graph 22 – 19
![Page 46: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/46.jpg)
Results with 748 Assertions
Base . . . with Assertions0
500
1,000
1,500 ·106
−51%
1,39
1.51
685.
14
Abs
olut
eSD
CCo
unts
Unprotected dOSEK
Base . . . with Assertions0
0.05
0.1
0.15·106
−49%0.15
0.08
Protected dOSEK
Base . . . with Assertions0
20
40
60
80+25%
68
85
Inst
ruct
ions
per
Sysc
all
Base . . . with Assertions0
100
200
300+9%
270 29
3
FAU The Global Control-Flow Graph 22 – 19
![Page 47: The Global Control-Flow Graph - FAU · The Global Control-Flow Graph Optimizing an Event-Driven Real-Time System Across Kernel Boundaries Christian Dietrich, Martin Hoffmann, Daniel](https://reader034.vdocument.in/reader034/viewer/2022042803/5f49c1bd1645244c165b53fa/html5/thumbnails/47.jpg)
Results with 748 Assertions
Base . . . with Assertions0
500
1,000
1,500 ·106
−51%
1,39
1.51
685.
14
Abs
olut
eSD
CCo
unts
Unprotected dOSEK
Base . . . with Assertions0
0.05
0.1
0.15·106
−49%0.15
0.08
Protected dOSEK
Base . . . with Assertions0
20
40
60
80+25%
68
85
Inst
ruct
ions
per
Sysc
all
Base . . . with Assertions0
100
200
300+9%
270 29
3
FAU The Global Control-Flow Graph 22 – 19