summaryrefslogtreecommitdiffstats
path: root/DESIGN
diff options
context:
space:
mode:
Diffstat (limited to 'DESIGN')
-rw-r--r--DESIGN19
1 files changed, 19 insertions, 0 deletions
diff --git a/DESIGN b/DESIGN
new file mode 100644
index 0000000..2ffc535
--- /dev/null
+++ b/DESIGN
@@ -0,0 +1,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