Device | Service Time | Interrupt Frequency | Allowable Latency |
---|---|---|---|
D1 | 400 us | 1/(800us) | 400us |
D2 | 250 us | 1/(1000us) | 50us |
D3 | 100 us | 1/(800us) | 300us |
Device | Interrupt Frequency | Service Time |
---|---|---|
A | 1/(1000 us) | 600 us |
B | 1/(500 us) | 100 us |
C | 1/(1000000 us) | 100000 us |
Device | Interrupt service time | Interrupt frequency | response-time requirement |
Printer | 1000 us | 1/(2000 us) | 1000 us |
Disk | 300 us | 1/(1000 us) | 200 us |
Keyboard | 2000 us | 1/(100000 us) | 2000 us |
Display | 100 us | 1/(1000 us) | 200 us |
time interrupt running 0 p,disk,k,dpy Display (100) 100 Disk (300) 200 " 300 " 400 Printer (1000) 500 " 600 " 700 " 800 " 900 " 1000 disk,dpy Display (100); interrupts printer 1100 Disk (300) 1200 " 1300 " 1400 Printer (resume with 400 left) 1500 " 1600 " 1700 " 1800 Keyboard (2000) 1900 " 2000 p,disk,dpy Display (100); interrupts keyboard ...At time 2000 the cycle starts over again with the exception of the keyboard interrupt which will happen next at time 100,000. The keyboard handers runs for 200us in every 2000us cycle and so will complete its task by time 20000.
Device | Service time (ms) | Maximum Frequency (1/ms) | Priority |
D1 | 10 | 1/100 | 3 (highest) |
D2 | 50 | 1/1000 | 2 |
D3 | 200 | 1/5000 | 1 (lowest) |
time interrupt running 0 d1,d2,d3 D1 (10) 10 D2 (50) 20 " 30 " 40 " 50 " 60 D3 (200) 70 " 80 " 90 " 100 d1 D1 (10); interrupting D3 110 D3 (resume with 160 left) 120 " 130 " 140 " 150 " 160 " 170 " 180 " 190 " 200 d1 D1 (10); interrupting D3 210 D3 (resume with 70 left) 220 " 230 " 240 " 250 " 260 " 270 " 280 idle!!! 290 ...From the diagram we can see that the maximum time to completion is is 10ms for D1, 60ms for D2 and 280ms for D3. Note that the D1 interrupt occurs several times during the handler for D3 which complicates the calculation and is why is usually best to draw out the diagram shown above.
Task | Service time (ms) | Maximum allowed latency (ms) | Maximum Frequency (1/ms) |
A | 30 | 500 | 1/3000 |
B | 20 | 70 | 1/1000 |
C | 50 | 25 | 1/500 |
D | 10 | 10 | 1/50 |
time interrupt running 0 A,B,C,D D (10) 10 C (50) 20 " 30 " 40 " 50 D D (10); interrupting C 60 C (resume with 10 left) 70 B (20) 80 " 90 A (30) 100 D D (10); interrupting A 110 A (resume with 20 left) 120 " 130 idle... ...Looking at the table, the maximum time between interrupt and completion is: