A slot is a promise that one job can occupy a physical resource until it finishes. Imagine eight numbered hooks beside a workshop door. A worker takes a key from a hook before using a machine and returns it when the machine is idle. Counting the hooks from across the room cannot reserve a machine. Another worker can take the last key while you walk to the door.
Eight permits protect eight workers
Eight jobs hold the eight permits. Job 9 waits at admission while every worker is busy.
Why it exists
A limit and a queue solve different problems. Eight slots bound active work. A queue of 100 bounds how many jobs the service agrees to keep waiting. Without the second bound, a burst can exhaust memory while the GPU remains perfectly within its limit.
View diagram · GPU admissionRelease capacity when the physical work actually ends. Full size
Words to know
Permit
An admission right to occupy one unit of a limited resource.
Backpressure
A signal that limits incoming work when a downstream stage is saturated.
How it works
Step through the idea, or press Play.
Step 1 of 3
Protect the transition. A mutex around the entire check and claim gives concurrent handlers a single order. A read lock can serve a status snapshot, but a later claim must check capacity again under exclusive access.
Count permits. A semaphore initialized to eight models eight simultaneous jobs. Return a permit on every exit path, including cancellation. A separate bounded queue controls how many callers may wait.
Find the boundary. Eight permits per process across five replicas allow forty jobs. Partition ownership by GPU or move admission to the service that owns the physical pool.
Understand it
Start here
The workshop key rack
Picture eight numbered keys on hooks beside a workshop door. Each key opens one machine. Watch the last hook while two people try to start jobs at the same time.
The workshop key rack
Release once after completion.
Structure
GPU admission
GPU admission
Release capacity when the physical work actually ends.
Eight slots on five hosts
Start nine jobs at a barrier. Eight should acquire permits and the ninth should wait or time out. Cancel one admitted job and confirm exactly one waiter proceeds. Repeat against two processes sharing a GPU to expose any accidental per-process quota.
A client can give up before acquiring a permit, after acquiring one, or while its job continues on a remote GPU. Only the owner of an acquired permit should release it. If client cancellation merely disconnects a listener, the remote job may still be running. Tie release to actual job completion or confirmed termination. Otherwise the ninth job can start while all eight GPUs are still occupied.
Observe both sides of the queue
Measure active jobs, wait time and rejected requests together. Eight busy slots and rising waits indicate sustained demand. Three busy slots and rising waits point elsewhere, such as admission code holding a mutex across a slow network call. A count of available slots alone cannot tell these situations apart.
Own the permit
Release once after completion.
Release on disconnect
A remote job may still be running.
A cap applied in five processes
5×8=40
If five independent processes each admit eight jobs, up to forty jobs can reach the same physical pool.
Summary
The whole topic in one minute.
A job owns capacity from successful acquisition until the resource becomes available again. Size the waiting room separately and place the limit where all contenders share it.