Some operating systems use a periodic timer
bound to
a tick counter
to manage time smoothly throughout the
system. The didactic version of OpenEPOS you are currently working
with, follows this strategy:
1. |
void Alarm::timer_handler(void) |
To implement the timed event concept, EPOS-- uses a event queue that is handled by the timer's interrupt handling routine as follows:
1.
|
void Alarm::timer_handler(void)
|
In order to avoid searching the requests
queue on
every time tick, the queue is kept ordered and its elements are
ranked relatively to each other (i.e. the rank of each element is an
offset to the previous).
The main issue in this implementation is that the
handler
indicated by the user to be invoked when the
given time arrives is executed within the context of the interrupt
handling routing, thus compromising the system timin.
You are requested to modify the implementation of
Alarm
to eliminate the busy-waiting in method
delay()
and also to remodel the interrupt handling
routine so that user's handler functions no longer have a chance to
disrupt the system timing.