Title: Towards Unit Testing RealTime Schedulers in LITMUSRT
1Towards Unit Testing Real-Time Schedulers in
LITMUSRT
- Mac Mollison
- Björn Brandenburg
- James H. Anderson
2Towards Unit Testing Real-Time Schedulers in
LITMUSRT
- What is LITMUSRT?
- What is this talk about?
- What is a typical scheduling policy?
- Why do we need a test tool?
- How do we test? (Answer Unit Testing)
- What are the specific tests?
3LITMUSRT
LInux Testbed for MUltiprocesor Scheduling in
Real-Time Systems
Patch to Linux 2.6.24 Kernel
Before the patch
Linux schedulers
CFS
SCHED_RR
SCHED_FIFO
4LITMUSRT
LInux Testbed for MUltiprocesor Scheduling in
Real-Time Systems
Patch to Linux 2.6.24 Kernel
After the patch
Linux schedulers
LITMUSRT schedulers
CFS
G-EDF
SCHED_RR
C-EDF
SCHED_FIFO
P-EDF
PD2
5Towards Unit Testing Real-Time Schedulers in
LITMUSRT
- What is LITMUSRT?
- What is this talk about?
- What is a typical scheduling policy?
- Why do we need a test tool?
- How do we test? (Answer Unit Testing)
- What are the specific tests?
6Overview
- What LITMUSRT is
- Why we want to test LITMUSRT schedulers
- Implementing real-time schedulers is nontrivial
bugs can be subtle - How to test LITMUSRT schedulers
- Unit Testing - testing small pieces of code
programmatically with a twist
7My Work
- Developed specification for a tool to test
schedulers - Implemented prototype of the tool for the G-EDF
scheduling policy
8Towards Unit Testing Real-Time Schedulers in
LITMUSRT
- What is LITMUSRT?
- What is this talk about?
- What is a typical scheduling policy?
- Why do we need a test tool?
- How do we test? (Answer Unit Testing)
- What are the specific tests?
9Sporadic Task Model
WCET
Period
Release
Deadline
T1 (2,4)
Job
Completion
Time (ms)
Execution on CPU
10Global Scheduling Policies
Ti
Ti
Ti
Ti
Ti
Ti
Ti
Ti
Ti
CPU 3
CPU 4
CPU 2
CPU 1
M CPUs
11Global Earliest Deadline First(G-EDF)
T1 (2,3)
At all times, the M jobs with earliest deadlines
should be executing.
T2 (3,5)
T3 (4,8)
Time (ms)
Execution on CPU1
Execution on CPU2
12Global Earliest Deadline First(G-EDF)
T1 (2,3)
T2 (3,5)
T3 (4,8)
Time (ms)
Execution on CPU1
Execution on CPU2
13Towards Unit Testing Real-Time Schedulers in
LITMUSRT
- What is LITMUSRT?
- What is this talk about?
- What is a typical scheduling policy?
- Why do we need a test tool?
- How do we test? (Answer Unit Testing)
- What are the specific tests?
14Why Develop a Test Tool?
- Code is very complex
- We cannot easily tell if the code is correct
- We need help debugging
15(No Transcript)
16Why Develop a Test Tool?
- Code is very complex
- We cannot easily tell if the code is correct
- We need help debugging
- Resulting schedules are very complex
- We cannot easily tell if correct schedules are
produced
17Global Earliest Deadline First(G-EDF) ???
T1 (2,3)
T2 (3,5)
T3 (4,8)
Time (ms)
Execution on CPU1
Execution on CPU2
18Global Earliest Deadline First(G-EDF)
Incorrect!
T1 (2,3)
T2 (3,5)
T3 (4,8)
Time (ms)
Execution on CPU1
Execution on CPU2
19Global Earliest Deadline First(G-EDF)
T1 (2,3)
T2 (3,5)
T3 (4,8)
Time (ms)
Execution on CPU1
Execution on CPU2
20Global Earliest Deadline First(G-EDF)
T1 (2,3)
T2 (3,5)
T3 (4,8)
Time (ms)
Execution on CPU1
Execution on CPU2
21Why Develop a Test Tool?
- Code is very complex
- We cannot easily tell if the code is correct
- We need help debugging
- Resulting schedules are very complex
- We cannot easily tell if correct schedules are
produced - We need to minimize overhead
- Detailed regression testing is necessary
22Overhead
T1 (2,3)
T2 (3,5)
T3 (4,8)
Time (ms)
Execution on CPU1
Execution on CPU2
Overhead
23Overhead
T1 (2,3)
T2 (3,5)
T3 (4,8)
Time (ms)
Execution on CPU1
Execution on CPU2
Overhead
24(No Transcript)
25Towards Unit Testing Real-Time Schedulers in
LITMUSRT
- What is LITMUSRT?
- What is this talk about?
- What is a typical scheduling policy?
- Why do we need a test tool?
- How do we test? (Answer Unit Testing)
- What are the specific tests?
26The Challenge
Without overhead, and if we did not need very
detailed feedback, we could check the
invariant At all times, the M jobs with earliest
deadlines should be executing.
27The Challenge
Instead, we have to use a series of specific
tests to detect anomalies in scheduling and to
measure overhead.
28Unit Testing
A series of specific tests with detailed
feedback that can be produced after each code
revision suggests Unit Testing
29Unit Testing
A series of specific tests with detailed
feedback that can be produced after each code
revision suggests Unit Testing
Unit Testing programmatically
testing small
modules of code after each revision
30Unit Testing
A series of specific tests with detailed
feedback that can be produced after each code
revision suggests Unit Testing
Unit Testing programmatically
testing small
modules of code after each revision
We test recorded schedule traces instead
31Feather-Trace
Event records
Release
Switch To
Switch Away
Completion
32Towards Unit Testing Real-Time Schedulers in
LITMUSRT
- What is LITMUSRT?
- What is this talk about?
- What is a typical scheduling policy?
- Why do we need a test tool?
- How do we test? (Answer Unit Testing)
- What are the specific tests?
33Unit Tests
Unit Tests
Deadline Test
Sporadic Task Model Test
Completion Test
G-EDF Decision Test
G-EDF Latency Test
34Unit Tests
Unit Tests
Deadline Test
Useful for any scheduling policy
Sporadic Task Model Test
Completion Test
G-EDF Decision Test
G-EDF Latency Test
35Deadline Test
- Did all jobs complete by their deadlines?
T1 (2,3)
T2 (3,5)
T3 (4,8)
Time (ms)
Execution on CPU1
Execution on CPU2
Overhead
36Deadline Test
- Did all jobs complete by their deadlines?
T1 (2,3)
T2 (3,5)
T3 (4,8)
Time (ms)
Execution on CPU1
Execution on CPU2
Overhead
37Deadline Test
- Did all jobs complete by their deadlines?
What about soft real-time?
T1 (2,3)
Scheduler developers can specify maximum
acceptable tardiness.
T2 (3,5)
T3 (4,8)
Time (ms)
Execution on CPU1
Execution on CPU2
Overhead
38Sporadic Task Model Test
- Were job releases separated by at least the
period of the task?
T1 (2,3)
T2 (3,5)
T3 (4,8)
Time (ms)
Execution on CPU1
Execution on CPU2
Overhead
39Sporadic Task Model Test
T1 (2,3)
T2 (3,5)
T3 (4,8)
Time (ms)
Execution on CPU1
Execution on CPU2
Overhead
40Sporadic Task Model Test
Scheduler developers can specify a tolerance
variable
T1 (2,3)
T2 (3,5)
T3 (4,8)
Time (ms)
Execution on CPU1
Execution on CPU2
Overhead
41Completion Test
- Did all released jobs actually complete?
T1 (2,3)
T2 (3,5)
T3 (4,8)
Time (ms)
Execution on CPU1
Execution on CPU2
Overhead
42Completion Test
- Did all released jobs actually complete?
T1 (2,3)
T2 (3,5)
T3 (4,8)
Time (ms)
Execution on CPU1
Execution on CPU2
Overhead
43Unit Tests
Unit Tests
Deadline Test
Sporadic Task Model Test
Completion Test
Check for G-EDF adherence in an overhead-agnostic
manner
G-EDF Decision Test
G-EDF Latency Test
44G-EDF Decision Test
- Are jobs switched to execution
- in EDF order?
T1 (2,3)
T2 (3,5)
T3 (4,8)
Time (ms)
Execution on CPU1
Execution on CPU2
Overhead
45G-EDF Decision Test
- Are jobs switched to execution
- in EDF order?
Test algorithm models execution state to check
for correct decisions.
T1 (2,3)
T2 (3,5)
T3 (4,8)
Time (ms)
Execution on CPU1
Execution on CPU2
Overhead
46G-EDF Decision Test
- Are jobs switched to execution
- in EDF order?
T1 (2,3)
T2 (3,5)
T3 (4,8)
Time (ms)
Execution on CPU1
Execution on CPU2
Overhead
47G-EDF Decision Test
- Are jobs switched to execution
- in EDF order?
Incorrect?
T1 (2,3)
T2 (3,5)
T3 (4,8)
Time (ms)
Execution on CPU1
Execution on CPU2
Overhead
48G-EDF Decision Test
This cannot be distinguished from overhead.
- Are jobs switched to execution
- in EDF order?
Incorrect?
T1 (2,3)
T2 (3,5)
T3 (4,8)
Time (ms)
Execution on CPU1
Execution on CPU2
Overhead
49Unit Tests
Unit Tests
Deadline Test
Sporadic Task Model Test
Completion Test
G-EDF Decision Test
Helps ensure acceptable amounts of overhead
G-EDF Latency Test
50G-EDF Latency Test
T1 (2,3)
T2 (3,5)
T3 (4,8)
Time (ms)
Execution on CPU1
Execution on CPU2
Overhead
51G-EDF Latency Test
Test algorithm can use sequence of events on each
processor to determine type of latency
Type 1
Type 2
Type 3
T1 (2,3)
T2 (3,5)
T3 (4,8)
Time (ms)
Execution on CPU1
Execution on CPU2
Overhead
52G-EDF Latency Test
Type 1
T1 (2,3)
T2 (3,5)
T3 (4,8)
Time (ms)
Execution on CPU1
Execution on CPU2
Overhead
53G-EDF Latency Test
Type 2
T1 (2,3)
T2 (3,5)
T3 (4,8)
Time (ms)
Execution on CPU1
Execution on CPU2
Overhead
54G-EDF Latency Test
Type 3
T1 (2,3)
T2 (3,5)
T3 (4,8)
Time (ms)
Execution on CPU1
Execution on CPU2
Overhead
55Summary
- What LITMUSRT is
- Why we want to test LITMUSRT schedulers
- Implementing real-time schedulers is nontrivial
bugs can be subtle - How to test LITMUSRT schedulers
- Unit Testing - testing small pieces of code
programmatically with a twist
56Questions?
Towards Unit Testing Real-Time Schedulers in
LITMUSRT