The interview problem
Share a GPU cluster between teams running distributed training jobs and smaller batch jobs, with quotas, priorities and recovery after worker failures.
Original practice question. Extends our general task scheduler; not a verified AI-lab interview prompt. Reviewed September 26, 2026. All workload numbers and acceptance thresholds below are illustrative practice assumptions.
1. Clarify the scheduling contract
Ask whether jobs require simultaneous workers, which GPU types they support, and whether they can checkpoint. Assume training jobs request a fixed number of compatible GPUs and start only when their required worker group can run. Interactive inference gets a separate reserved pool. Quota fairness is a policy choice: equal jobs, equal GPU-hours and weighted team shares produce different outcomes.
Allocate 5 interview minutes to constraints, 10 to admission/placement, 12 to lifecycle, 10 to failures and 8 to efficiency. A FIFO queue is a reasonable baseline for one team; the exercise is explaining where it stops meeting the contract.
2. Separate admission from placement
POST /jobs defines tenant, image digest, GPU count/type, memory, topology constraints, priority, maximum runtime and checkpoint location. The admission controller reserves quota; the placement scheduler chooses feasible nodes. Reserving eight GPUs of quota does not imply that eight suitable devices exist on the required network topology.
Maintain job states submitted, admitted, starting, running, checkpointing, preempted and terminal. Record attempt ID, worker-group generation, resource reservation and lease expiry. Bind the full worker group before committing launch, with a timeout that releases partial reservations. Use reconciliation loops to compare intended state with actual workers; an API response is not proof that every process started.
3. Quantify fragmentation and checkpoint cost
Consider eight nodes with eight GPUs each: 64 total. Reserve 16 for other workloads, leaving 48 nominal batch GPUs. If an eight-GPU single-node job requires all eight devices together, 16 free GPUs scattered as two on each node cannot run it. This is placement fragmentation, not a quota shortage. Backfill small jobs only if they can finish or be reclaimed before a promised large-job start.
Suppose a checkpoint is 400 GB and sustainable write throughput is 10 GB/second. Transfer alone takes at least 40 seconds, before coordination and metadata commit. Saving every 10 minutes therefore costs at least 6.7% of that interval. Under a simple uniform-failure assumption, expected lost work since the last completed checkpoint is roughly half the checkpoint interval; actual failure patterns and checkpoint duration can invalidate that shortcut.
4. Fence stale attempts and commit checkpoints
A worker heartbeat expires during a network partition. A replacement attempt may start while an old process still runs. Attach generations to output commits and checkpoint metadata so stale attempts cannot become authoritative. Process termination and network isolation are additional controls; a lease alone does not stop GPU computation.
Write checkpoint shards to temporary, immutable locations and publish a manifest only after all required shards are durable and consistent. Recovery loads a committed manifest, not whichever files happen to exist. Model, optimizer, RNG and data-progress state need compatible recovery semantics. If a job cannot checkpoint, preemption restarts it and should be priced into the scheduling policy.
5. Balance utilization and fairness
Strict reservations improve predictability but can leave capacity idle. Borrowing unused quota improves utilization but needs a reclamation rule. Priority without aging may starve small teams indefinitely. Report queue time by priority, achieved GPU-hours versus entitlement, allocation fragmentation, preemption waste and useful training progress. High GPU utilization alone can hide jobs repeatedly losing work.
For a rack outage, stop admitting jobs that cannot meet topology constraints and requeue recoverable jobs with bounded retries. Avoid restarting thousands of workers simultaneously against checkpoint storage; staged recovery protects the shared control plane and data path.
6. Defend the difficult case
Foundation: explain quota versus placement. Senior: schedule an eight-GPU job when free capacity is fragmented. Staff: reconcile team guarantees, urgent deadlines and storage bottlenecks during a partial-cluster failure.
Score 0–2 each for explicit resource contracts, gang launch, checkpoint correctness, fairness and failure recovery. Two points require a mechanism with limitations. Claiming that “Kubernetes will handle it” without defining admission and recovery earns no architectural credit.
Calculate whether preemption buys useful capacity
Additional original practice exercise · October 3, 2026. Numbers are illustrative assumptions.
Assume an urgent job needs one whole eight-GPU node. Eight one-GPU batch jobs occupy that node, although another rack has eight scattered free GPUs. Stopping just one batch job cannot satisfy the urgent job's placement constraint. Select a feasible set of victims before promising a start time.
Suppose all eight victims have 50 GB checkpoints and share a measured 10 GB/s storage bottleneck. Their 400 GB requires at least 40 seconds of transfer, even if uploads run concurrently. Add checkpoint coordination, manifest publication and process shutdown before reallocating devices. After that, validate that old workers have actually released resources; output fencing alone does not free GPU memory.
Trade-off: waiting for a nearly finished job may waste less useful computation than immediate preemption. Compare deadline slack against checkpoint time, lost work and restart cost. Test a victim that never acknowledges shutdown; a bounded forced-stop policy trades recovery work for admission progress.
Related practice: Design a lease service with fencing tokens · Store durable objects with erasure coding
Sources and next steps
References support the underlying concepts; the proposed architecture, exercises, and rubric are our own. Review the general scheduler and contrast online inference.
Continue your preparation
Choose a connected learning path or browse more System design questions. Read our editorial method and attribution policy.