Blocking Thread Synchronization

The didactic version of OpenEPOS you are currently working with implements thread synchronization with simple trick: yielding other threads to run.

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
  class Synchronizer_Common
{
protected:
      Synchronizer_Common() {}

protected:
      void sleep() { Thread::yield(); }
      void wakeup() {}
      void wakeup_all() {}
};

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.

To do

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.