QoS is determined by the network administrator and an essential part of any traffic engineering strategy. When routers experience congestion or otherwise have insufficient resources to handle the incoming traffic volume, they have to make decisions about what traffic to expedite, what traffic can wait, and under extreme circumstances, what traffic to drop.
How they’re able to determine this on a per-packet basis is through DSCP markings. DSCP is simply a value that goes into the IP packet header that routers can read to understand a packet’s intended priority level. Packets get a marking, which maps to a queue on the router, and those queues are emptied according to some algorithm like round-robin or WRED.
Packets pass through multiple administrative domains (AD) on their way from A to B on the public internet, and so there are some DSCP values that have an agreed upon meaning like EF and AF. But it’s not mandatory that those values be honored; they may be rewritten at any hop along the path; and there are also non-standard values which you may use within your AD, but have no agreed upon meaning in the outside world.