docs: add authoritative master implementation plan

This commit is contained in:
2026-05-04 14:45:21 +01:00
parent 50af2023f6
commit 4e439faae5
+19 -1
View File
@@ -303,7 +303,25 @@ No shared block layer exists. Each storage driver reinvents I/O dispatch. Linux:
---
## 13. Total Effort
## 14. Scheduler & Threading Assessment (2026-05-04)
### Architecture
- **Kernel**: DWRR scheduler (577 lines), 40 priority levels, per-CPU queues, futex (222 lines)
- **Userspace**: proc manager (2,638 lines), pthread (440 lines), signal delivery via proc scheme
- **IPC bridge**: 3 round-trips for thread creation vs Linux's single clone() syscall
### Strengths
- DWRR with geometric weights, CPU affinity masks, soft-blocking with monotonic timeout
- Full POSIX process model (PID/PGID/SID, job control, orphan detection)
- Futex with physical-address keys for cross-process synchronization
### Critical Gaps
1. **PIT-based tick (~148Hz)** — LAPIC timer exists but `setup_timer()` is commented out. Should use Periodic/TscDeadline mode at 1000Hz.
2. **Global CONTEXT_SWITCH_LOCK** — spinlock serializes all context switches across CPUs. Should be per-CPU.
3. **No load balancing** — idle CPUs don't steal work from busy CPUs
4. **No RT scheduling** — missing FIFO/RR/Deadline classes
5. **No cgroups** — no CPU bandwidth control or resource limits
6. **Thread creation latency** — 3 IPC hops vs single clone()
| Tier | Duration |
|------|----------|