← all systems · see it in The System
Scheduler (computing)
| boundary | Inside: the waiting work (runqueues, pending queues, crontabs, batch queues), the scheduler's picture of the resources (loads, machine states, leases, the cell state in its store), the decision (pick next, place, balance, pre-empt) and the policy it applies (priorities, shares, quotas, deadlines), with the mechanisms that hand a resource over and take it back (the timer interrupt and context switch; the machine agents that start, throttle and kill). Outside: the hardware and the time being shared, the programs that do the work, the people who set policy, the lock services and consensus stores the cluster schedulers lean on, and the operating system or cloud the scheduler is part of. |
| nested level | Rung 12 technology: one part of an operating system (its resource managers) and one part of a cloud's resource pooling layer (the cluster manager); built from queues, a decision procedure and the agents and interrupts that carry its decisions out; set by people. |
| scale | technological |
From the walk
Linux's scheduler is meant to be 'work-conserving': it should never leave a processor core idle while there is work to do. Researchers found four bugs, introduced as the scheduler was adapted to more complex hardware, that broke this rule in ways hard to notice with standard monitoring tools; in one database workload the idle spells lasted only a few hundred milliseconds each, too short for tools like htop, sar or perf to see. The bugs cost typical workloads 13 to 24 percent; one scientific program, hit by a bug that appears only after a core is switched off and on again, ran 138 times faster once it was fixed (src:lozi-2016).
Definition. In computing, scheduling is the action of assigning resources to perform tasks; the scheduling activity is carried out by a mechanism called a scheduler. Walked as operating-systems and cluster-computing research describe it: the part that decides which waiting work runs where and when, from the time-sharing supervisor and the kernel's CPU scheduler (time slices, priorities, fair shares, the Linux schedulers) to batch queues, cron and the cluster managers (Borg, Mesos, Kubernetes) with admission, placement, pre-emption, leases and heartbeats. Definition drawn from the encyclopedia entries listed under Sources (Wikipedia, CC BY-SA).
On this page: Properties 3 · Measures 30 · Open contentions 5 · Cross-scale patterns 24 · Valence partners 10 · Partners and parts 68 · Notes 3 · Layers 49 · Sources 36
Properties published scienceour proposal
Sourced fields, and our own readings.
| aliases | Scheduler |
| born at | by 1962 (time-sharing supervisor on the IBM 7090; batch monitors before it were not read) |
| born precision | earlier than 1962 if batch monitors count (not read) |
Measures (30) published science
| CFS scheduling period, fewer than 8 runnable threads on a core | 48 ms |
| Linux load-balancing interval | 4 ms |
| performance lost to the four Linux scheduler bugs | 13-24% typical; up to 138 times in corner cases ratio |
| ULE and CFS code size | 2,950 lines (ULE, FreeBSD 11.1) against 17,900 (CFS, Linux 4.9) lines of code |
| rate-monotonic sufficient utilization bound for large task sets (Liu-Layland test; not an exact limit) | ln 2 = 0.6931 (about 70 percent) processor utilization |
| Borg median cell size | about 10,000 machines |
| Borg task arrival rate, busiest cells | above 10,000 tasks per minute |
| Borgmaster fail-over time | about 10 s; up to a minute in a big cell |
| Borg online scheduling pass | under 0.5 s |
| Borg task start-up latency, median | about 25 (80% of it package installation) |
| pre-emption notice delivered | about 80 % of the time |
| extra machines needed to segregate production and batch | 20-30 % more machines (median cell) |
| CPU performance cost of shared cells | about 3 % worse (CPI) |
| Borg reservation decay start | 300 s |
| work running in reclaimed resources | about 20 % of workload (median cell) |
| Borgmaster availability | 99.99 % |
| Borg job arrival rate, 2011 against 2019 (mean) | 964 to 3360 jobs per hour per cell |
| share of resources used by the top 1% of jobs (2019) | over 99 % |
| rescheduled to new task rate (median) | 0.66:1 (2011) to 2.26:1 (2019) ratio |
| collections with any eviction, 2019 | 3.2% (0.79M of 24.8M) |
| delay-scheduling wait for near-optimal data locality | 1-5 s |
| job wait-time objective (Google production) | 30 s |
| Sparrow median queueing delay | under 9 ms |
| Chubby default lease and KeepAlive interval | 12 s lease; KeepAlives every 7 s |
| Kubernetes node eviction rate (default) | 0.1 (1 node per 10 s) per second |
| CronJob controller check interval | 10 s |
| load multiplication from retries at five layers of three | 243 times |
| kernel rollout cadence tolerated in a large fleet | about a month at the shortest time |
| UNIX process lifetimes: chance a process aged 1 s uses more than T s | about 1/T (over a million processes measured) probability |
| Linux scheduler sanity-checker overhead | under 0.5 % |
Open contentions (5) open contention
Where sources or readings disagree. Both stay on the map.
- C-4647 Should a computer's task scheduler (which decides which program runs next) aim to share time fairly so none is starved, or treat fairness as one goal traded off against others?
booked: The map keeps both readings side by side and rules on neither.
the other reading: Fairness that prevents starvation is the goal: CFS runs every thread within a period (src:bouron-2018; src:lozi-2016); Fairness should be multi-resource and strategy-proof (DRF) (src:ghodsi-2011-drf); in Borg, quotas and priorities make DRF less needed (src:verma-2015-borg) - C-4659 What exactly happened when the 1997 Mars Pathfinder lander's computer kept restarting? Accounts of the cause, what was lost and how it was fixed differ in their details.
booked: The map keeps both readings side by side and rules on neither.
the other reading: Jones's account of Wilner's keynote (src:jones-1997-pathfinder): a watchdog timer reset the system with losses of data; the lock guarded an 'information bus' in shared memory; one long-running medium-priority communications task; the trace facility fortuitously left in; a short C program interpreted onboard; pre-flight resets put down to hardware glitches; Reeves himself says the description he gave Wilner before the talk was improvised and wrong (o-reeves-winged) - C-4663 Should large computer clusters be run by one central program deciding where every task goes, or by several schedulers sharing the work? No design has been shown to win.
booked: The map keeps both readings side by side and rules on neither.
the other reading: Monolithic schedulers restrict new features and 'will eventually limit cluster growth'; shared state with optimistic concurrency is the answer (src:schwarzkopf-2013-omega); Two-level scheduling by offers lets frameworks keep their own schedulers and reaches near-optimal locality (src:hindman-2011-mesos); For sub-second tasks a decentralized, stateless, sampling design is needed and comes within 12% of ideal (src:ousterhout-2013-sparrow); The move away from a monolithic scheduler was mainly for software engineering, not scalability, by its own authors (src:schwarzkopf-2013-omega); offers hold a pessimistic lock per decision (same source); A central resource manager with per-application masters (YARN; abstract only, src:vavilapalli-2013-yarn) - C-4664 Is deciding which program runs next on a multi-core computer a solved problem, or still unsolved, given that long-hidden bugs were found in Linux?
booked: The map keeps both readings side by side and rules on neither.
the other reading: By 2000 designers considered scheduling solved; Torvalds 2001: 'scheduling is easy' (quoted in src:lozi-2016); The remedy is tooling that checks the invariant, since new designs come and go (src:lozi-2016); The remedy is moving policy out of the kernel to user-space agents (src:humphries-2021-ghost); A third remedy, now upstream: sched_ext lets policy be loaded as BPF programs, and the kernel restores the default scheduler when a runnable task stalls (src:kernel-doc-sched-ext) - C-4665 Should fast-response services and slower background jobs share the same machines to save hardware, or run on separate machines because they slow each other down?
booked: The map keeps both readings side by side and rules on neither.
the other reading: Many other organisations run user-facing and batch work in separate clusters (named in src:verma-2015-borg); Container isolation is imperfect: caches and memory bandwidth are not managed by the kernel and leak between tenants (src:burns-2016)
Cross-scale patterns seen here (24) our proposal
Shapes that recur when the same kind of problem is solved at different scales, and how each shows in Scheduler (computing). Each links to every other system that shows it.
- causal ceiling (structural)
A scheduler cannot know from where it sits whether a silent machine has failed or is cut off: Borg 'cannot distinguish between large-scale machine failure and a network partition' and so rate-limits rescheduling; a Chubby client whose lease runs out 'becomes unsure whether the master has terminated - holding / entrainment (structural)
The scheduler sets when its tasks run, how many there are and when they die: it pre-empts and kills them, restarts the unhealthy, keeps the replica count, and kills a child job when its parent ends. - runaway from an unstable balance (structural)
Past a critical number of users N, round-robin time-sharing collapses abruptly as swapping takes over (Corbató 1962); past the point where retries add more load than they clear, retries 'delay recovery by keeping the load high long after the original issue is resolved'; a pre-emption can cascade dow - same role, different builds (structural)
One job, choosing which waiting work gets the shared resource next, is done by unrelated builds: CFS's weighted fair queue ordered by vruntime, ULE's interactivity score and FIFOs, lottery tickets drawn at random, rate-monotonic fixed priorities, Borg's priority scan with feasibility and scoring, Me - same toolkit, independent builds (structural)
FreeBSD's ULE and Linux's CFS, built separately, both adopted per-core runqueues with periodic and idle-time load balancing for the same reason (scalability); they then differ in what they balance (thread counts against load). - templating (structural)
One module reused unchanged: the Kubernetes pod object underlies three different controllers (run forever, one per node, run to completion); a container image runs the same on any machine; Borg's alloc became Kubernetes's pod. - The carry (structural)
All three faces. Overflow passed on: a machine out of memory kills tasks from the lowest priority up and they return to the pending queue for another machine; pre-empted tasks pass down to the queue. The wait: work waits for a place (Borg start-up median about 25 s, Google's 30 s wait objective, Spa - the whole sets the local reference (structural)
Each Linux core is fair within its own runqueue, yet the per-core readings need not close into one global picture: a group's average load hid idle cores, and groups built from one core's view hid a two-hop imbalance, so cores idled for seconds while threads waited. CFS also re-references each arrivi - trade one property for another (structural)
Settled at different points along one trade: spreading load (E-PVM, 'worst fit') buys headroom and pays in fragmentation, best fit packs tightly and pays when estimates are wrong, and Borg's hybrid sits between; short leases buy fault tolerance and pay in traffic, long ones the reverse (Andrew went - who opens the door (structural)
Work reaches a machine only through a port the machine opened ahead of time: the Borglet or kubelet installed and reporting before any task is sent, a node Lease the node renews itself; in Mesos the receiving framework decides which offers to take, rejecting the rest. - barrier-gates-complexity (partial)
Mixing services and batch on one machine became possible only once containers walled them apart: before, two separate systems ran them (Babysitter and the Global Work Queue); with the walls, Borg shares 98% of machines in shared cells and saves 20-30% of machines. The without case is shown; what is - conservation law plus closure (partial)
Lottery scheduling's ticket transfers conserve tickets ('they cannot be created or destroyed'), which protects clients but leaves natural policies awkward; a second rule, ticket inflation inside currencies among trusting clients, closes the gap. - coordination-before-mapping (partial)
Sparrow's many schedulers keep no state about cluster load and still spread tasks well, each probing two random servers at the moment it places a task; Linux cores coordinate by stealing from busier neighbours. The probes are a moment's sensing, not a held map. - lightning (partial)
A stored synchrony released at once: many waiters woken for one event (the thundering herd), periodic jobs all due on the first seconds after midnight, retries released together; and Pathfinder's whole-computer reset (a per-cycle deadline check by the bus scheduler, per Reeves). The reset is a held, - nested ladder (partial)
Rungs of schedulability tests for rate-monotonic priorities: Liu and Layland's utilization bound is a cheap sufficient test (passing it guarantees the deadlines; failing it says nothing), exact tests (Lehoczky and others onward) decide every case at higher cost, and deadline-driven priorities reach - same shape, opposite sign (partial)
The lottery run the other way: a resource is granted by drawing a winning ticket and revoked by an 'inverse lottery' that picks a loser (Waldspurger names it and prefers a deterministic alternative). One mechanism, sign reversed; read in the thesis only as named, so partial. - symmetry breaking (name the cut) (partial)
Equal-scoring nodes are a symmetric state; kube-scheduler breaks the tie at random. Clients on the same period are a synchronized state; jitter breaks it with a random or per-host offset so the work spreads out. - The Payment to Entropy (partial)
Every hand-off of the machine between programs costs something: the quantum 'should be as small as possible without excessive overhead losses when the supervisor switches' (Corbató); pre-emption 'comes at the cost of wasting some work in the preempted tasks' (Omega); load balancing costs cache misse - Umwelt: each system carves its own slice of one shared medium (partial)
The scheduler's channels pick a narrow slice of what its tasks are: requests, use, liveness, health and time, never what the work means; even its own idle cores were invisible to the usual tools when they idled for only hundreds of milliseconds. - borrowed-then-held (surface)
Borg leans on Chubby to make its elected master findable (borrowed); Kubernetes holds leader election in its own Lease objects (held). Two systems, not one system's history, so surface. - namespace completeness (the map predicts its gaps) (surface)
Omega lays out the option space of cluster schedulers (monolithic, two-level, shared state; no, pessimistic or optimistic concurrency) and fills the optimistic shared-state cell; the grid is a taxonomy, and no empty cell is shown predicting a later member. - partner-becomes-part (surface)
Omega was built as Borg's successor and 'many of Omega's innovations (including multiple schedulers) have since been folded into Borg': parts of one system became parts of another. No gain-gain partnership with shared inheritance is shown. - red-queen (surface)
Move and counter-move between users and the scheduler, with no enemy: users overbuy quota as insurance and Borg answers by overselling low-priority quota; users ask for more than they use and Borg reclaims the gap. One turn each is shown, not a run. A malicious user abusing priority is named by Kube - seed (surface)
Time-sharing was expected to open 'several new forms of computer usage' (Corbató); the walk does not show new combinatorics unpacked by a scheduler itself.
Valence: what it trades, and with whom (10) published science
Each exchange with a neighbour, read from both sides: who gains, who pays, and what carries it.
- Human (Homo sapiens) via The world through the senses (sensory environment) · Scheduler (computing) gain
- Data centre via Electricity · Scheduler (computing) gain
- Operating system via Computer hardware · Scheduler (computing) gain
- Real-time OS (hard and soft) via Computer memory · Scheduler (computing) mixed
- Computer hardware via Computer hardware · Scheduler (computing) mixed
- Cloud computing via Computer hardware · Scheduler (computing) gain
- Container (OS-level virtualization) via Computer hardware · Scheduler (computing) gain
- Byzantine fault via Computer network · Scheduler (computing) even
- Message queue and work queue via Computer hardware · Scheduler (computing) gain
- Distributed lock service (Chubby, ZooKeeper, Kubernetes Leases) via Computer network · Scheduler (computing) gain
Partners and parts published science
Built from / builds (7)
- Operating system
- Run queue / pending queue
- Load balancer (between cores)
- Dispatcher and context switch
- Cluster master (Borgmaster, kube-scheduler with its API server)
- Node agent (Borglet, kubelet)
- Admission control (quota)
Sits inside / holds (2)
expressed by (34)
- Scaffolding/Enablement (Meta-Tooling)
- Templating / Standardization
- Niche Construction (alter environment)
- Interoperability/Transduction (Bridging)
- Encapsulation & Modularity (Abstraction)
- Symbiosis/Co-Creation (Collaborative Specialization)
- Evolvability/Plasticity Engineering (Design for Future Variation)
- Distributed Autonomy/Decentralized Execution (Subsidiarity)
- Internal Coordination/Regulation
- Sensing/Scanning
- Search/Foraging
- Mapping/Modeling
- Uncertainty Reduction/Learning
- Risk-managed Exploration
- Active Experimentation / Probing (Optimal Experimental Design)
- Trail-Marking / Externalized Memory (Stigmergy)
- Surprise / Change-Point Detection
- Optimal Stopping & Patch-Switching
- Offline Simulation & Replay-Guided Planning
- Resource Denial/Attrition
- Quick Harm Avoidance
- Reactive Response
- Proactive Defense
- Physical/Virtual Barrier
- Self-Monitoring
- Validation of Identity/Intention
- Validation of Effectiveness
- Enclave/Segregation
- Resilience & Repair
- Redundancy & Diversity
- Triage & Prioritized Allocation
- Quality Control & Error Correction
- Positional Identity (Body Map)
- Bridging Supply Gaps (Store & Dormancy)
floor filled by (17)
- Operating system
- Human (Homo sapiens)
- Time
- Data centre
- Computer hardware
- Cloud computing
- Container (OS-level virtualization)
- Run queue / pending queue
- Load balancer (between cores)
- Dispatcher and context switch
- Cluster master (Borgmaster, kube-scheduler with its API server)
- Node agent (Borglet, kubelet)
- Admission control (quota)
- cron (time-based job scheduler)
- Proportional-share scheduler (lottery, stride, weighted fair queueing, EEVDF)
- Distributed lock service (Chubby, ZooKeeper, Kubernetes Leases)
- Framework scheduler (Mesos frameworks)
Kinds (7)
- Cluster managers (Borg, Kubernetes)
- Process (short-term) scheduler
- Long-term (admission) scheduler
- Medium-term scheduler
- Real-time scheduler
- Job (batch) scheduler
- Network (packet) scheduler
wired (1)
Notes published science
- Linux's scheduler is meant to be 'work-conserving': it should never leave a processor core idle while there is work to do. Researchers found four bugs, introduced as the scheduler was adapted to more complex hardware, that broke this rule in ways hard to notice with standard monitoring tools; in one database workload the idle spells lasted only a few hundred milliseconds each, too short for tools like htop, sar or perf to see. The bugs cost typical workloads 13 to 24 percent; one scientific program, hit by a bug that appears only after a core is switched off and on again, ran 138 times faster once it was fixed (src:lozi-2016).
- Mars Pathfinder's computer kept resetting itself a few days after its 4 July 1997 landing. A low-priority weather task held a lock inside the operating system's message-waiting code, several medium-priority tasks kept it from running, and a high-priority data task stuck behind it missed its deadline in the spacecraft's 8-times-a-second bus cycle, which the software answered with a reset. The team reproduced it on Earth in under 18 hours with tracing left in by design, and fixed it by sending the spacecraft a patch that turned on 'priority inheritance' for that kind of lock (src:reeves-1997-pathfinder; landing date from src:jones-1997-pathfinder).
- In measurements of over a million Unix processes, a process's median remaining lifetime equalled its current age: the longer a program has already run, the longer it is likely to keep running. The researchers used this to choose which running programs are worth moving to another machine to balance the load: the older ones, which are likely to live long enough to repay the cost of the move (src:harchol-balter-downey-1997).
Layers
The ways it takes in its world, where they meet, and how it acts back, each from L1 (where it meets the world) up.
the boardroom (shared floors)
- L3: The scheduler's picture: machines up or down and what is free, what each task uses and whether it is healthy, who is master
- L4: The waiting work, admitted: runqueue or pending queue in priority order
- L5: The decision: pick next, place (feasibility then scoring), balance, pre-empt
- L6: The policy: priorities, shares, quotas, deadlines, objectives
- L7: The purpose: responsive computers, deadlines met, a fleet kept busy for its users
the scheduler as operating-systems and cluster-computing researchers describe it: the shared resources (each core's time, memory, the machines of a cell) up to the work done for people (reader's view)
- L1: The resources shared out: each core's time, memory, disks and ports on a machine, the machines of a cell, network links; and the time in which they are shared
- L2: The levers that hand a resource over and take it back: the timer interrupt and the context switch on a core; on a cluster machine the local agent (Borglet, kubelet) that starts, stops, throttles and kills tasks in containers
- L3: The scheduler's picture of the resources: per-core runqueues and their load, the cell state (machines, tasks, allocs) held in memory and in a Paxos store, kept current by polls, heartbeats and leases; who is master
- L4: The waiting work, admitted at the door: ready threads in a runqueue (CFS: a red-black tree by vruntime), pending tasks scanned from high to low priority, a batch queue, a crontab's next entries
- L5: The decision: which thread runs next on which core, or which machine a task goes to (feasibility, then scoring), with load balancing between cores and pre-emption of lower-priority work
- L6: The policy and its promises: priorities and priority bands, fair shares (weighted fair queueing, tickets, Dominant Resource Fairness), quotas, deadlines, service-level objectives; always a compromise between goals
- L7: The purpose: work done for people and organisations: each user sees a responsive computer; control tasks meet their deadlines; a fleet kept busy so programs run without their authors managing machines
way in: Application health (the work's own report)
- L1: The running program's built-in HTTP server with its health and metrics
- L2: The probe: /healthz, or a user-specified endpoint or command
way in: Machine state (polls and heartbeats)
- L1: Each machine and what it has free (CPU, RAM, disk, ports), and whether it is up
- L2: The agent's report: the Borglet answers a poll every few seconds with its full state; the kubelet renews its node Lease as a heartbeat
way in: Other scheduler instances (replicas, rivals, elections)
- L1: Messages between the scheduler's own replicas and between parallel schedulers
- L2: Something only one holder can win: a Paxos election, a Chubby lock with its sequencer, a Kubernetes Lease, an atomic commit to shared cell state
way in: People setting what should run (priorities, quotas, crontabs, desired state)
- L1: Developers and site reliability engineers deciding what runs, how important it is and how much it may use
- L2: Written as configuration: BCL, YAML objects, a crontab line, a nice value
- L3: Validated, defaulted and versioned by the API server
- L4: Kept as desired state (Spec) beside observed state (Status)
- L5: Controllers' reconciliation loops compare desired with observed and act
way in: Resource use (what each thread or task actually consumes)
- L1: Cycles and memory actually consumed, mostly below what was asked for
- L2: Counted by the kernel and the agent: CFS's load (weight times average CPU use); per-task usage sampled by the Borglet
way in: Synchronisation (threads blocking on and released by locks)
- L1: Shared data in memory guarded by locks (on Pathfinder: the pipe-based message channel to the weather task; Jones's account names the 'information bus')
- L2: The mutex: acquiring a lock someone holds blocks the thread (on Pathfinder, the semaphore inside select() guarding the file-descriptor wait list)
- L3: The blocked thread waits off the runqueue; with priority inheritance the holder runs at the waiter's priority
way in: Time (ticks, quanta, leases, due times)
- L1: Time passing, counted by a hardware clock
- L2: The timer interrupt that ends a quantum (idle cores may skip the periodic tick)
- L3: Accounting: a running thread accumulates vruntime; leases and timeouts count down; cron compares the clock with its event list
- L4: A deadline reached: the timeslice spent, a lease expired, a cron entry due
way in: Work asking to run (submissions, new and woken threads)
- L1: A program started, a thread created or woken, a job description sent by a user or another program
- L2: The door it comes through: an RPC to the Borgmaster, a request to the Kubernetes API server, a fork or a wakeup in the kernel
- L3: Admission: quota checked before anything is scheduled; a job without quota is rejected at once (the long-term scheduler's job)
way out: Dispatch (the chosen work starts)
- L1: The core runs the thread; the machine runs the task (start-up takes a median of about 25 s in Borg)
- L2: The agent starts the task's processes in a container (on a core: the context switch loads the thread)
- L3: The master prepares the order for the machine's agent and applies its answer
- L5: The chosen thread or task
way out: Pre-emption and eviction (work taken off)
- L1: The resource freed for the waiting work
- L2: SIGTERM first if the task asked, then SIGKILL; on a core, the context switch out
- L4: The victims go back into the pending queue
- L5: Victims chosen from the lowest priority up
way out: Reports to people (UIs, events, mailed output)
- L1: Text on a screen or in a mailbox for the job's owner
- L2: Sigma's web UI; cron's mail
- L7: The choice to show debugging information to every user
way out: Throttling and out-of-memory kills (the machine's own enforcement)
- L1: Cycles withheld; memory returned
- L2: The agent kills tasks from the lowest priority up when memory runs out
- L6: Compressible resources (CPU, disk bandwidth) can be taken back by lowering quality; non-compressible ones (memory, disk space) only by killing