Priority queue with a shared buffer (source code)

= Priority queue with a shared buffer

A two-class <queue> has one total buffer but serves the high-priority class before the other. A preemptive-resume <service discipline> interrupts low-priority work immediately and later resumes it without wasting completed work. Under <first come first served> within the high-priority class, a new high-priority packet waits $V/C$ when $V$ is the high-priority workload immediately before its arrival. The total workload determines shared-buffer overflow, while $V$ determines the high-priority waiting time. An additional admission gate rejects high-priority packets when $V/C$ exceeds a prescribed delay limit. Finite packets require a fit test against the remaining buffer space, and nonpreemptive service adds residual low-priority service time.