# QoS-Aware Resource Management in 5G and 6G Cloud-Based Architectures with Priorities
## 2 Scheduler Priority Queue
### q Service Class Buffer Delay Analysis
Indeed, state (0,3) means that the system serves zero class p services and three class q services; then, on receiving a new class p request, due to its priority over class q, one of the three (usually the latest arrived since the buffer is assumed to be FIFO) class q services on the buffer will be pre-empted and the system will end up into new state (1,3). On the contrary, \((2,3)\
otin y_{in}\) since state (2,3) means that the system serves two class p services and three class q services; then, on receiving a new class p service, due to its priority over class q service, one of the three class q services on the buffer will not be pre-empted (the queue has only two positions) but it will be discarded and the system will end up into new state (3,2), that is (2,3) \(\rightarrow\) (3,2). Due to the same reasoning, \(\{(3,2),(3,1),(3,0)\}\
otin y_{in}\), due to capacity management (admission control), any new class p service will be immediately rejected since the maximum capacity resource C = 3 would be exceeded. On the other hand, the only allowed state transitions into \(y_{in}\) set are (0,3) \(\rightarrow\) (1,3) or (0,3) \(\rightarrow\) (1,3) \(\rightarrow\) (2,3) or (1,3) \(\rightarrow\) (2,3) or (1,2) \(\rightarrow\) (2,2) or (3,2) or (1,2) \(\rightarrow\) (2,2) \(\rightarrow\) (3,2) or (2,1) \(\rightarrow\) (3,1). Output \(y_{out}\) set is the set of states where one previously pre-empted packet (pre-empted due to the acceptance of a new class p request in the system) has found a resource and has already been served, thus \(y_{out}=\{(i,j):(i,j)\in\{(0,2),(1,1),(2,0)\}\}\) for total C = 3 resources and Q = 2 positions in the queue. As an example, state (0,2) meaning is that the system serves zero class p services and two class q services. The following output transitions are valid:  
* (2,3) \(\rightarrow\) (1,3) \(\rightarrow\) (0,3) \(\rightarrow\) (0,2). State (2,3) means two active class p services, one active class q service already in service, and two pre-empted class q services on queue. Then, with certain probability, before the impatience time expires, one class p service is terminated, one pre-empted class q service obtains a free resource, and the system jumps into state (1,3), where now one active class p connection is in service, two active class q connections are already in service, and one pre-empted class q service exists on the queue. Then, with certain probability, before impatience time expires, the last class p service is terminated, the last pre-empted class q service obtains a free resource, and the system jumps into state (0,3), where three class q services are in service. Finally, one class q service is terminated, and the system jumps into state (0,2) as the output state. * Any other path is forbidden since it must pass through state transitions (1,3) \(\rightarrow\) (1,2) or (2,3) \(\rightarrow\) (2,2). In the previous statement, the \(y_{out}\) state indicates any combination of class p and class q occupied resources leaving one extra system resource empty, which according to Figure 3 can be the states \((0,2)\), \((1,1)\), or \((2,0)\), respectively. \(T_{yout/(i,j)}\) is defined as the sum of all possible transition probabilities from any possible state (i,j) into any possible \(y_{out}\) state. Consequently, following previous analysis and generalizing the method to all possible transition cases, an existing class q service will be blocked based on the following blocking probability formula: \[P_{B|Q\
eq 0}=\sum_{i=0}^{C-1}a(i,C-i-1)\cdot P_{Q+i,n-i}|_{if} \begin{array}{l}Q+i >n\\ Q+i=n\end{array} +\sum_{i=1}^{C}\sum_{ \begin{subarray}{c}q=0\\ q\leq i\end{subarray} }^{Q-1}a(i,C-i)\cdot\Big{(}1-T_{yout/(i,n-i+q)}\Big{)}P_{ i,n-i+q}.\] (4)  
To calculate the probability, \(T_{yout/(i,j)}\), we must calculate each transition probability separately.