-
- Downloads
introduce new CRTP based worker sleep algorithm abstraction
Introduce AbstractWorkerSleepStrategy a CRTP interface class for a worker sleep algorithm. A concrete WorkerSleepStrategy must implement the following functions: template <CallerEnvironment callerEnvironment> void notifyMany(unsigned count); template <CallerEnvironment callerEnvironment> void notifyOne(); template <CallerEnvironment callerEnvironment> void notifyAll(); void notifySpecific(workerid_t workerId); void sleep(); The runtime uses this interface to notify the workers about new work as well as ensuring that all workers get notified on termination. All sempahore based worker sleep algorithm code was moved from the Runtime into SemaphoreWorkerSleepStrategy which takes the used Semaphore as a template parameter. This interface should be an zero-cost abstraction. Encapsulating the worker sleep algorithm behind an interface allows us to easier experiment with different approaches not based on semaphores ("Wait in the io_uring", "Empty flag per WSQ"). Implement a generic notifySpecific algorithm for SemaphoreWorkerSleepStrategy. This algorithm comes with runtime overhead and is only used when it is used by the runtime and the semaphore implementation does not provide a own implementation.
Showing
- emper/Runtime.cpp 4 additions, 7 deletionsemper/Runtime.cpp
- emper/Runtime.hpp 7 additions, 56 deletionsemper/Runtime.hpp
- emper/io/GlobalIoContext.cpp 6 additions, 3 deletionsemper/io/GlobalIoContext.cpp
- emper/io/IoContext.hpp 16 additions, 3 deletionsemper/io/IoContext.hpp
- emper/lib/sync/WorkerWakeupSemaphore.hpp 0 additions, 30 deletionsemper/lib/sync/WorkerWakeupSemaphore.hpp
- emper/meson.build 1 addition, 0 deletionsemper/meson.build
- emper/sleep_strategy/AbstractWorkerSleepStrategy.hpp 47 additions, 0 deletionsemper/sleep_strategy/AbstractWorkerSleepStrategy.hpp
- emper/sleep_strategy/SemaphoreWorkerSleepStrategy.cpp 14 additions, 0 deletionsemper/sleep_strategy/SemaphoreWorkerSleepStrategy.cpp
- emper/sleep_strategy/SemaphoreWorkerSleepStrategy.hpp 226 additions, 0 deletionsemper/sleep_strategy/SemaphoreWorkerSleepStrategy.hpp
- emper/sleep_strategy/WorkerSleepStrategy.hpp 16 additions, 0 deletionsemper/sleep_strategy/WorkerSleepStrategy.hpp
- emper/sleep_strategy/meson.build 3 additions, 0 deletionsemper/sleep_strategy/meson.build
Loading
Please register or sign in to comment