ysbaddaden / execution_context

10 stars 2 forks source link

Isolated: slow synchronization primitives #27

Open ysbaddaden opened 4 months ago

ysbaddaden commented 4 months ago

The Isolated context scheduler immediately parks the thread when it needs to wait on a synchronization primitive such as a Channel.

If a channel has a large enough buffer, then the thread will immediately pick a value and continue, otherwise if the buffer is small, the channel is regularly emptied and the thread will park itself immediately.

The scheduler could try to spin with exponential backoff (at least ease the CPU, maybe even yield), instead of parking and waiting on a condition variable.

Note: other contexts may be affected, though those already spin (a bit).