summaryrefslogtreecommitdiffstats
path: root/DESIGN
blob: 2ffc535073b019eebc243f14f8a9ae6ce80ea6eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
SCHEDULER
- 4-heap (or 2-heap) with linked nodes
- epoll
- edge-triggered monitoring for file i/o (no syscalls to modify fdset)
- signalfd for signal handling
- eventfd for thread pool wakeup

FIBERS
- timer node on fiber control data (for delayed heapify; and reuse on timeouts)
- fd, signal, pid wait struct on stack of wait function
- fiber_kill can interrupt wait

SCHEDULER <-> THREAD POOL
- scheduler queues to thread pool array fifo queue,
    - semaphore protects threads so no underqueueing happens
    - eventfd notifies scheduler when queue has free space again
    - head/tail updated atomically and item position recovered
- thread pool atomically pushes to resume atomic stack and sets eventfd
    - scheduler thread atomically pops all and updates fiber states