The didactic version of OpenEPOS you are currently working with implements thread synchronization with simple trick: yielding other threads to run.
1.
|
class Synchronizer_Common
|
Therefore, synchronization abstractions such as
Semaphore and Mutex continuously test for
changes on a control variable, invoking yield after
each test. This trick allows for empty implementations of
wakeup and wakeup_all, but bears little
predictability and performance. It is actually a faulty
implementation for Semaphore: replace the
Mutex synchronizing the table in the Philosophers' Dinner by a
Semaphore, insert a Delay before enabling
the philosopher threads to run and observe what happens.
Modify the implementation of EPOS-- synchronization mechanisms so that waiting threads block instead of sampling control variables. Ensure that scheduling is not affected by your modifications implementation.