predictable scheduling for a soft modem stefan saroiu – university of washington...
TRANSCRIPT
Predictable Scheduling for a Soft Modem
Stefan Saroiu – University of [email protected]
www.cs.washington.edu/homes/tzoompy/
Michael B. Jones – Microsoft [email protected]
research.microsoft.com/~mbj/
Modem Taxonomy• Traditional Modem Components:
– Interface between analog phone lines and digital computer components – A/D and D/A
– Signal modulations at different rates – on DSP– AT command set control and interpret - controller– Asynchronous interface between the modem and
computer – UART
• Some modems move functions to host software– Traditional modems – all on modem hardware– Controllerless modems (winmodems) – software
controller, onboard signal processing– Soft modems – host CPU controller and signal processing
Why Study Soft Modems ?
• Signal Processing done on host CPU:– requires predictable scheduling– requires low latency responses
• While coexisting with other system activities– Soft Modem is a background real-time task
• Successful in home computer market:– Low cost– Easy to update – software upgrade
Driver versions (INT/DPC/THR/RES)
• Vendor version (INT) :1. DMA transfers between A/D and D/A and physical
memory2. when enough data samples, the modem raises an
interrupt3. inside ISR, process incoming data and provide
outgoing samples, before buffers exhausted
• Signal processing routines executed:– in a DPC context (DPC)– in a thread context (THR) scheduled by NT scheduler– in a thread context (RES) scheduled by a real-time
scheduler based on Rialto/NT
Interrupt Rate3 different phases, interrupts very regular
Rate of Interrupts (INT)
0
5
10
15
20
25
30
35
0 5 10 15 20 25 30
Time (seconds)
Mil
lise
con
ds
On-hook ConnectedTrainingDialing
Elapsed Times in ISR (INT)
PC 99 recommends maximum time during which a driver-based modem disables interrupts should not exceed 100 µs
1.8 ms on a Pentium II 450 with a repeatable worst case of 3.3 ms
Elapsed Times in Interrupt Handler (INT)
0
0.5
1
1.5
2
2.5
3
3.5
4
0 5 10 15 20 25 30
Time (seconds)
Mill
isec
on
ds
On-hook ConnectedTrainingDialing
CPU Utilization16% sustained CPU load
CPU Load
0%
5%
10%
15%
20%
25%
30%
35%
0 5 10 15 20 25 30
Time (seconds)
CP
U L
oad
On-hook ConnectedTrainingDialing
Elapsed Times in Queued DPC
PC 99 recommends at any instant in time, the total execution time required for all DPCs that have been queued but not executed should
not exceed 500 µs
Interrupt durations now typically < 6µsBut now long DPCs (as long as old interrupts)
Elapsed Times In Queued DPC (DPC)
0
0.5
1
1.5
2
2.5
3
3.5
4
0 5 10 15 20 25 30
Time (seconds)
Mill
isec
on
ds
On-hook ConnectedTrainingDialing
Samples Pending to be Processed
(INT & THR 24)Small relative to 512 sample buffer sizeSamples Pending to be Processed (INT)
0
5
10
15
20
25
30
35
0 5 10 15 20 25 30
Time (seconds)
Un
pro
ce
ss
ed
Sa
mp
les
On-hook ConnectedTrainingDialing
Samples Pending to be Processed (THR 24)
0
5
10
15
20
25
30
35
0 5 10 15 20 25 30
Time (seconds)
Un
pro
ce
ss
ed
Sa
mp
les
On-hook ConnectedTrainingDialing
Coexisting Thread Latencies (INT)
Minimum 8 µs, Maximum: 5313 µsINT Version
0100200300400500600700800900
1000
Latency (microseconds)
Num
ber o
f Tria
ls
24955
Without Modem
0
200
400
600
800
1000
Latency (microseconds)
Num
ber o
f Tria
ls
29044
Long distribution tail in INT version
Coexisting Thread Latencies (THR 24)
Minimum 8 µs, Maximum: 2239 µsTHR Version (24)
0
200
400
600
800
1000
Latency (microseconds)
Num
ber o
f Tria
ls
28156
Without Modem
0
200
400
600
800
1000
Latency (microseconds)
Num
ber o
f Tria
ls
29044
Nearly as good as with no modem
CPU Reservation Abstraction and Implementation
• CPU Reservation abstraction:– ongoing reservation for X time units out
of every Y units for a thread
• Implementation limitation:– CPU Reservations must be multiples of
milliseconds
Samples Pending to be Processed CPU RES 2ms every
8ms – 25 %Works well relative to 512 sample buffer size
DialingOn-hook Training Connected
Samples Pending to be Processed (RES 2/8)
0
20
40
60
80
100
120
140
160
0 5 10 15 20 25 30 35
Time (seconds)
Un
pro
ce
ss
ed
Sa
mp
les
On-hook ConnectedTrainingDialing
File Transfer Times
Min Max Mean Std Dev Passed
INT 36.334 36.398 36.367 0.029 10DPC 36.272 36.447 36.396 0.048 10THR Pri 24 36.319 36.475 36.384 0.056 10RES 1ms/7ms 36.333 36.724 36.426 0.112 10RES 2ms/13ms 36.288 36.975 36.547 0.232 10RES 2ms/14ms 38.631 91.713 65.172 37.535 2RES 3ms/15ms 36.275 36.586 36.387 0.108 10RES 3ms/16ms 97.289 180.415 110.523 26.408 9RES 4ms/16ms 36.255 37.116 36.415 0.256 10RES 8ms/20ms 36.347 36.476 36.394 0.039 10
Results for 10 copies of 200,000 bytes each
For 1/8, 2/15, 3/17, 4/17, 7/20 no test passed
Modem Reservation RangesNonlinear behaviorModem Reservation Operating Ranges
0
1
2
3
4
5
6
7
8
9
0 2 4 6 8 10 12 14 16 18 20 22Reservation Period (ms)
Re
se
rva
tio
n A
mo
un
t (m
s)
Sufficient MarginalInsufficient Actual
SufficientRegion
InsufficientRegion
If period < 12.5ms, must get 16% to work
If period > 12.5ms, (period – amount) >= 12.5ms must also hold
Conclusions• Signal Processing in interrupt context is:
– Unnecessary– Detrimental to the predictability and
latencies of the coexisting activities
• The DPC version has similar problems• Threads help alleviate these problems
– Modem runs well with real-time priorities and non-real-time competition
• Real-time scheduler allows control over modem’s degree of interference with other time-sensitive activities