wire / wire-format / cfs-scheduler
CFS is the default Linux CPU scheduler. It uses a red-black tree ordered by vruntime (virtual runtime). Each task's vruntime increases at a rate inversely proportional to its weight (priority). The scheduler picks the task with the smallest vruntime. Nice values (-20 to +19) map to weights (higher nice = lower weight = less CPU). CFS aims to give each task a fair share of CPU time.
aka: Linux CFS (Completely Fair Scheduler)
spec: Linux kernel (CFS)
CFS is the default Linux CPU scheduler. It uses a red-black tree ordered by vruntime (virtual runtime). Each task's vruntime increases at a rate inversely proportional to its weight (priority). The scheduler picks the task with the smallest vruntime. Nice values (-20 to +19) map to weights (higher nice = lower weight = less CPU). CFS aims to give each task a fair share of CPU time.
| field | size | meaning |
|---|---|---|
| vruntime | u64 (nanoseconds) | Virtual runtime: accumulated CPU time weighted by priority. Lower = higher priority. |
| weight | u32 | Task weight (from nice value). Higher weight = more CPU time. nice -20 = weight 88761, nice 0 = 1024, nice +19 = 15. |
| rb-tree | data structure | Red-black tree ordered by vruntime. The leftmost node is the next task to run. |
| sched_latency | 6ms (default) | Target latency: the period in which every runnable task should get at least one time slice. |
| min_granularity | 0.75ms (default) | Minimum time slice per task. |
| nice to weight | mapping | nice -20..+19 maps to weights via a lookup table (sched_prio_to_weight). Each nice level is ~10% CPU difference. |
| CFS bandwidth | cgroup | cgroup v2 CPU controller: cpu.max = 'quota period' (e.g., '100000 100000' = 1 CPU). Throttles tasks exceeding the quota. |
example:
00 00 00 00 00 00 00 00
CFS (placeholder)
agent: curl -H 'accept: application/json' wire.phall.io/wire-format/cfs-scheduler
or /wire-format/cfs-scheduler.json