advanced25 min studyLesson 365 in Engineering

Gang scheduling and co-scheduling

Coordinate multi-worker admission while distinguishing resource readiness from synchronized execution and eventual job progress.

On this page

What you’ll understand

  • Explain partial-allocation stalls in multi-worker training.
  • Distinguish minimum-member admission from simultaneous execution.
  • Analyze starvation and reservation tradeoffs for large gangs.

A synchronous training job needs four workers before its first collective can complete. Starting one worker and letting it wait indefinitely may reserve a GPU without producing useful progress. Starting partial workers from several jobs can strand the entire fleet. Gang-aware admission coordinates the required group, but it must still handle placement constraints, failures, queue fairness, and application startup rather than promising that all workers execute instructions at the same instant.

Admit the unit that can make progress

Define the minimum useful group: all workers, a minimum elastic membership, or a set of different roles such as trainers and parameter services. Its combined resource requirement includes those roles and their topology constraints. Gang scheduling checks whether enough of that group can be admitted together. A minimum-member threshold is a policy, not necessarily every replica ever requested by an elastic job. Confirm that the application can actually start and operate with the admitted membership before treating the threshold as useful progress.

Admission and physical placement are related but distinct stages in some platforms. Reserving quota does not by itself create nodes or guarantee that each pod binds successfully. After admission, workers still initialize devices, load data, discover peers, and join their communication group. A slow or failed member can delay the first collective. Observe time to useful training progress separately from time to quota reservation, pod creation, and all-workers-ready. These boundaries reveal whether the bottleneck is policy, placement, or application startup.

∑j∈Gqjr≤Crfor every resource r\sum_{j\in G}q_{jr}\leq C_r\quad\text{for every resource }r
This aggregate condition for a required group G is necessary but not sufficient. Per-node assignments, role compatibility, topology, and availability must also hold. Resource q_jr and capacity C_r use matching units for each r.↔ Scroll wide equations horizontally.

Avoid hold-and-wait without promising universal progress

Partial allocation can create a resource deadlock when each job holds some devices while waiting for the rest and none releases them. Gang admission or a bounded reservation-and-rollback protocol can prevent that particular hold-and-wait pattern. Define what happens when a reservation times out or one pod fails to bind. Release stale allocations through the actual controller lifecycle rather than assuming a timeout instantly frees every device. Another job’s readiness check must not rely on resources still owned by an unresolved reservation.

A large gang can also starve if a stream of small jobs continually consumes each newly free device. Reserving future capacity, aging, backfilling, or controlled preemption can help, with different utilization and disruption costs. A scheduler that starts many small jobs quickly can still be unfair to a feasible large job. Conversely, waiting for a huge gang whose requirements exceed the entire eligible cluster can block useful work forever unless infeasibility is recognized and the queue policy handles it.

Eidle=gheld twaitE_{\mathrm{idle}}=g_{\mathrm{held}}\,t_{\mathrm{wait}}
If g_held allocated GPUs do no useful work while waiting for missing peers for t_wait hours, the wasted allocation exposure is GPU-hours. This is a resource-time accounting measure, not electrical energy or a complete job-efficiency metric.↔ Scroll wide equations horizontally.

Co-scheduling adds execution concerns

Co-scheduling can also refer to giving communicating tasks compatible execution opportunities after placement. Time-slicing one worker independently can delay the rest of a synchronous collective. Checkpointing, elasticity, and migration require runtime support and can change job semantics or performance. Gandiva and Tiresias examine different scheduling and placement choices for deep learning; their workload-specific designs do not establish that every gang policy or sharing configuration improves every model. Reproduce the assumptions before adopting a scheduling technique.

Use the queue lab to reason only about admission pressure. Reset, set arrival rate to 4 and service rate to 3, predict backlog after one second, then Step twice. Compare a new run after Reset with both arrival rate at 2 and service rate at 3, predicting before two Steps. Each run begins with four equal abstract jobs. The fluid model has no job sizes, gangs, reservations, or workers and cannot demonstrate resource deadlock; draw the partial-allocation example separately and identify who owns each device.

A stalled partial allocation

A cluster has four GPUs. Jobs A and B each require all four workers, one GPU per worker, before useful computation starts. A naive allocator gives two GPUs to A and two to B. Neither job releases them while waiting; assume no other recovery mechanism.

  1. All four GPUs are allocated, but each job lacks two workers. Under the stated application requirement, neither can perform useful training.

  2. If this lasts ten minutes, idle allocation exposure is 4 × (10/60) = two thirds of a GPU-hour. Allocation utilization is 100%, while useful training progress is zero.

  3. Admitting one complete four-worker gang instead can let that job start if its other constraints and initialization succeed. The other job waits without holding a useless partial allocation.

The result

Gang-aware admission addresses this specific partial-allocation stall. It does not remove startup failures, fairness decisions, or the need to release stale reservations.

Explore the model

Interactive lab

Interactive lab · queue

Admission pressure without gang semantics

Reset, set arrival rate λ = 4 and service rate μ = 3, predict the one-second backlog, then Step twice. Compare a fresh Reset with both λ = 2 and μ = 3. This equal-job fluid model does not contain worker groups, placement, or deadlock.

Admission pressure without gang semanticsFluid backlog starts at 4 and follows max(0, 4 + (λ − μ)t). The separate M/M/1 residence-time formula assumes Poisson arrivals, exponential service and λ < μ. Current readings: Fluid backlog: 4; Net rate · λ − μ: −1 /s; M/M/1 mean residence: 1 s. All parameters are adjustable with the labeled controls below.02.557.51001.534.56Elapsed time · sFluid backlogλ < μ
Fluid backlogCurrent time
Fluid backlog
4
Net rate · λ − μ
−1 /s
M/M/1 mean residence
1 s
t = 0 s

Fluid backlog starts at 4 and follows max(0, 4 + (λ − μ)t). The separate M/M/1 residence-time formula assumes Poisson arrivals, exponential service and λ < μ. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forRate pressure and atomic group admission are different aspects of scheduler behavior.

Check your understanding

A four-worker synchronous job has quota reserved and three workers running, while the fourth cannot bind. What is justified?

Try it yourself

Six allocated GPUs wait without useful work for missing peers for five minutes. Compute idle allocation exposure. Explain why that number cannot be called wasted electrical energy without additional measurements.

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

Convert minutes to hours and keep the GPU-hour unit explicit.

Compare with the solution

Exposure is 6 × (5/60) = 0.5 GPU-hours. GPU-hours measure allocated device-time, not joules or kilowatt-hours. Electrical energy depends on actual power draw over time and the accounting boundary. The scheduler should also record useful progress and why the group remained incomplete instead of equating allocation with computation.

Take it with you

  • Gang admission targets the minimum resource group needed for useful progress.
  • Quota reservation, placement, readiness, and synchronized execution are separate boundaries.
  • Preventing partial-allocation stalls still leaves starvation, failure recovery, and disruption tradeoffs.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.