# Queueing theory - one server and two queues with priority

I want to study a scheduling scenario by using queuing theory.

This is the situation:

• one CPU with mean service time $$1/μ$$
• two infinite queues with arrival rate $$λ$$
• queue B has priority over queue A, i.e if the CPU is executing a job of A type, it stops (preemption) that job and executes (for all) the B job. Then if the B queue is empty it continues to execute the A jobs until a new B job/s arrives.

I would calculate some stability conditions, but I have never worked on systems like this.

If I would see the system as M/M/1 with only the queue with higher priority I could use $$λ < \mu$$ relation, but what about the queue A behaviour?

In the end, I have to do some simulations (with different parameters) and get some results about waiting times in the queues. I am doing some queuing theory modelling first to calibrate a bit the parameters of the system (inter-arr times and job tasks time, both exponential for both queues, CPU speed..)

I have read this question, but it is slightly different for my case/

What can I do?

• I think you are just describing a priority queuing system with preemption; see, e.g., this link. In terms of stability conditions, I believe it's just $(\lambda_A+\lambda_B)/\mu < 1$ since, in terms of stability, it doesn't matter which priority class the job came from. – LarrySnyder610 May 18 at 12:45
• @LarrySnyder610 thank you for the reply! I have one other question: since the tasks have lengths that are exponentially distributed (one for A and one for B) and the CPU has a fixed clock. Should I consider different service time depending on the queue? $1/μ_A$ and $1/μ_B$ – linofex May 19 at 15:20
• Oh, if the service times are different for the different priority classes then the stability condition isn't as simple. If I recall, it's not too hard, but you'll find it when you look into the priority queuing literature. – LarrySnyder610 May 19 at 20:02
• I found some material about this. I am asking if, it Is correct to consider two serving time if I have task duration from two different distributions – linofex May 19 at 20:04
• Yes, but I don't remember the details. – LarrySnyder610 May 19 at 20:06