Beruflich Dokumente
Kultur Dokumente
function-queue-scheduling
architecture and real time OS
Reference: Simon chapter 5
Function-Queue-Scheduling
Architecture
Function-Queue-Scheduling
Architecture
In this architecture, the interrupt routines add function pointers
to a queue of function pointers for the main function to call.
All you need is some coding in the routines that queue up the
function pointers.
Function Queue
Schedule
appropriate data-handling
function needs to be
executed soon.
Function Queue
Schedule
Function Queue
Schedule
is empty)
void main(void)
{
while (TRUE)
{
while (!!Queue of function pointers
!! Call first function on queue
} //end of while (TRUE)
} //end of void main()
Example
functionA, another
interrupt occurs, for
DeviceA.
is empty)
Priorities
Big advantage!
This worst case happens if the longest task code function has
This worst case happens if the longest task code function has
worse.
Thats right... Since interrupts now only add functions
(and dont execute
them
immediately),
If to
onethe
of queue
the lower-priority
task code
functions
is quite long, it
need
wait untilfor
thethe
current
function that
is
willyou
affect
thetoresponse
higher-priority
functions.
being executed to end.
code
function
is
the
length
of
the
longest
of
the
task
code
Yes. If an higher priority interrupt keeps happening,
functions.
then that particular function will always be the first in
the queue
behappens
processed.
This
worst to
case
if the longest task code function has
just started when the interrupt for the highest-priority device
occurs.
This worst case happens if the longest task code function has
executed, and if its really slow... then the higher
just started when the interrupt for the highest-priority device
priority functions will have to wait until the slower
occurs.
function is done.
Summary of software
architectures
Round-robin
Round-robin
with interrupts
Priorities
available
Worst time
response for task
code
Stability of
response when
code changes
Simplicity
None.
Poor.
Very simple.
Relatively good.
Very good.
Most complex
(although much of the
complexity is in the
operating system
itself).
Total of execution
Interrupt routines in
time for all task code
priority order, then all
(plus execution time
task code with the
for interrupt
same priority.
routines).