[ Class Overview ]
Task 3: Interrupt synchronization for OOStuBS with the pro/epilogue model
Learning objectives
- Protection of critical sections with the help of the pro/epilogue model
Task description
The synchronization of the activities within OOStuBS should be changed to the use of the pro/epilogue model. Your previous program (task 2) has to be modified so that the synchronization is no longer done by interrupt locks (hard synchronization).
To achieve this, the classes Keyboard, Panic, Gate and the function guardian() must be adapted or extended.
The classes Locker,
Guard and Secure must be newly created.
Of course, you also need to modify your application accordingly.
In addition, a global Guard
object should be created, to protect all critical sections.
Implementation notes
- The test program can be taken 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, all corresponding calls should first be removed again. - Since in our implementation the interrupts are disabled before
guardian()is called, they must be enabled again "manually" at a suitable point.
Specifications
For the creation of the epilogue queue the helper classesQueue and
Chain are given.
However, the implementations are not interrupt-transparent!
So either you synchronize hard at a suitable place,
or you write your own interrupt-transparent implementation.