The problem
Your laptop is on a voice call while a backup PC uploads photos, all through one 10 Mb/s uplink. With no quality of service (QoS) rules, every packet joins one first-in, first-out line. Your voice packet waits behind 665 others: 798 ms.
A call sends 50 small packets a second, 80 kb/s. Each must arrive within about 150 ms, evenly spaced: uneven delay, called jitter, makes speech choppy. The backup needs throughput, lots of bits per second; a second of delay does not matter to it.
Sort and mark
QoS starts by sorting. The router looks at each packet's addresses, ports and protocol and puts it in a class: voice for the call, bulk for the backup, standard for everything else, such as web pages.
It writes the class into the IP header's DSCP (Differentiated Services Code Point) field: 6 bits, 64 possible values (RFC 2474). Voice gets EF, value 46 (RFC 3246). The backup gets LE, value 1 (RFC 8622). The rest stays DF, value 0.
Who goes first
Each class now waits in its own queue in front of the same exit. If the scheduler, which picks the next packet to send, simply took turns, your voice packet would wait at most two 1,500-byte packets: 2.4 ms.
With strict priority, the scheduler always sends a waiting voice packet before anything else. It never interrupts a packet already on the wire, so voice waits at most 1.2 ms, for one 1,500-byte packet.
Every voice packet now waits between 0 and 1.2 ms at this hop, so the gaps between them stay even: jitter of at most 1.2 ms. In the single line it could swing from 0 to 798 ms.
Whatever voice leaves, 9.92 Mb/s, is shared by weight. With weights 3 to 1, busy web traffic gets 7.44 Mb/s and the backup 2.48 Mb/s. Nobody starves, and when web is quiet the backup may use it all.
Keeping rates in check
Strict priority could starve everyone if any program marked its packets EF. So the router polices the voice class to 1 Mb/s: EF packets above that rate are dropped at once, not queued. Your 80 kb/s call fits easily.
A shaper holds extra packets in its queue and lets them out at a steady rate instead of dropping them. Here the backup is shaped to 2 Mb/s: smooth, a little slower, nothing lost. Policing cuts bursts; shaping smooths them.
The arithmetic
;; step 1/10 · one-line · fifo ;; your laptop → isp voice 192.168.1.20 → 192.0.2.40 UDP/RTP, 200 bytes backup 192.168.1.30 → 203.0.113.20:443 TCP, 1,500 bytes one FIFO line, full (queues-buffers lesson: 1 MB buffer) ahead 665 × 1,500 B × 8 / 10 Mb/s = 665 × 1.2 ms = 798 ms budget ITU-T G.114: about 150 ms one way for the whole trip
Each tray draws at most 7 envelopes; real queues can hold hundreds of packets. QoS only matters where packets queue: at the slowest link, usually your uplink. Many networks, including most of the internet, ignore or reset DSCP marks they do not trust.