This paper consideres an M/M/1 queue model with preemptive and non-preemptive priorities. Customers are divided into three priority levels. The first category of customers enjoy the priority of preemptive, the second category of customers enjoy the priority of non-preemptive, and the third category of customers have no priority. When the first kind of customers arrive, they will interrupt the second or third kind of customers who are receiving the service immediately; When
the second type of customers arrive, if there are only the third type of customers in the system, the customer must wait for the current service to be completed before accepting the service. Customers of the same type follow the queuing rule of FCFS. A multi-dimensional vector Markov process is constructed here using the supplementary variable method, and the probability generating functions of three types of joint distribution of queue length are obtained. Then, each category of customer's average queue length and the probabilities in service are obtained. The influence of the change of service rate on the average queue length of all kinds of customers in the system is studied using MATLAB software. Finally, different cost functions are constructed for optimization analysis.