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

AbstractIoSleepStrategy: remove erroneous assertion

In my master's thesis, I described in listing 4.4 an io_uring-based
suspension and notification algorithm, which is slightly different from
what emper does.

The described algorithm does not reset the sleep state if a worker
skips sleeping because of a global sleeper count of less than 0 (line 21).

Emper does always reset the sleep state to SleeperState::Running if
the sleep method returned early (either the worker was specifically
notified or the global sleep count indicated to skip the sleep attempt).

Both variants are sound, but invariably resetting the sleeper count to
running minimizes the windows of useless specific notifications.

However, the assertion in onNewWorkNotification assumes the sleep state
is always SleeperState::Notified if a specific notification is received
through the worker's io_uring.

Emper, resetting the sleep state, introduces a race between the notifier
observing the state as sleeping, setting it to notified, and posting a
notification to the potential sleeper's io_uring.
But the sleeper skips the sleep attempt because the global sleeper count
righteously resetting its state to running while invalidating the
assertion.

Therefore we remove the assertion because it is not invariant.
parent 3dceb877
No related merge requests found
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