[ Class Overview ]
Task 3: Interrupt synchronization for OOStuBS with the pro/epilogue model
Learning objectives
- Protection of critical sections using the pro/epilogue model
Task description
You should change the synchronization of the activities within OOStuBS to use the pro/epilogue model. You have to modify your previous solution (task 2) so that the synchronization is no longer done by interrupt locks (hard synchronization).
To achieve this, you have to adapt or extend classes
Keyboard
,
Panic
,
Gate
and function
guardian()
.
Classes Locker
,
Guard
and Secure
must be newly created.
Of course, you also need to modify your application accordingly.
In addition, you should create a global
Guard
object to protect all critical sections.
Implementation notes
- You can reuse the test program from task 2. Again, outputs should be placed at different positions in the main program and the interrupt handler.
- Because the use of the pro/epilogue model makes the protection
of critical sections with the help of
CPU::disable_int()
andCPU::enable_int()
(mostly) redundant, you should remove all corresponding calls first. - Since in our implementation interrupts are disabled before
guardian()
is called, they must be enabled again "manually" at a suitable point.
Template code
For the creation of the epilogue queue, we provide the helper classesQueue
and
Chain
.
However, the implementation is not interrupt-transparent!
So either you have to synchronize "hard" at a suitable place,
or you have to write your own interrupt-transparent implementation.