C12 Embedded systems in MicroPython and C · Practice
Preemptive scheduling: priorities, response times and priority inversion
Problems dealt one at a time, with new numbers every time. The kinds you miss come back more often, and you can keep going as long as you like.
Check
Task 1 runs 2 ms every 5 ms at high priority; task 2 needs 7 ms at lower priority.
(a)
What is task 2's worst-case response time?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
What share of the processor does task 1 take?
Check
Three tasks: 1 ms every 4 ms, 5 ms every 20 ms, 3 ms every 15 ms.
(a)
What is their total utilization?
(b)
Is it under the three-task bound of 78.0% (1 for yes)?
Check
A high-priority task waits for a mutex held for 1 ms by a low-priority task; a medium-priority task can run for 5 ms.
(a)
How long can it wait without priority inheritance?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
And with it?
Check
A 100 Hz tick costs 30 cycles, and 5000 context switches a second cost 400 cycles each, on the 10 MHz board.
(a)
What share of the processor is overhead?
(b)
How long is one context switch?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
Check
6 tasks get 256-byte stacks on a chip with 32 KB of RAM.
(a)
How much RAM do the stacks take?
(b)
What share of RAM is that?
Check
Response time of a 4 ms task under a 1 ms task every 5 ms?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
Worst wait without inheritance: 1 ms critical section, 10 ms medium task?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
Rate-monotonic bound for 5 tasks?
A kind of problem counts as solid once you've got it right on the first try twice in a row. Back to the lesson · Practice every topic in C12