Skip to content
Snippets Groups Projects
Commit 03bdd4c3 authored by Florian Fischer's avatar Florian Fischer
Browse files

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.
parent 7165f0c9
No related branches found
No related tags found
Loading
Checking pipeline status
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment