Open In App

Queuing Models in Operating System

In general, there is no fixed set of processes that run on systems; thus, measuring the exact processing requirements of processes is impossible. We can, however, measure the distributions of CPU bursts and I/O bursts over the course of a process and derive a mathematical formula that identifies the probability of a specific CPU burst. The arrival rate of processes in the system can be approximated in the same way. The development of queuing theory, a branch of mathematics, resulted from the use of mathematical models for evaluating the performance of various systems. 

The fundamental model of queuing theories is the same as the model of a computer system. Each computer system is represented as a collection of servers such as CPUs and I/O devices, each with its own queue. The article focuses on discussing the Queuing System in Operating System.



The following topics will be discussed here:

  1. Components of Queuing System
  2. Number of Servers
  3. Measures of Performance for Queuing Systems
  4. Notation for Queues
  5. Queue Discipline
  6. Queuing Models

Let’s start discussing each of these topics in detail.



Components of Queuing System

A queuing system typically includes the following elements:

Optional extras include multiple servers or channels, priority service, and feedback or renege mechanism.

Number of Servers

The number of servers in a queuing system can vary depending on the application and the level of service desired. In some cases, a single server may suffice, whereas, in others, multiple servers may be required to meet demand.

Various methods, such as queuing analysis, simulation, and optimization techniques, can be used to determine the number of servers in a queuing system. The goal is typically to find the optimal number of servers that minimizes system costs (e.g., staff wages) while providing an acceptable level of service.

Measures of Performance for Queuing Systems

Performance measures for queuing systems are used to assess how well the system is performing and to identify areas for improvement. Some common performance indicators for queuing systems are:

These performance measures are not all applicable to every system; the most common and important are determined by the queueing model used to represent the system and the performance objectives.

Notation for Queues

Kendall’s notation and A/S/n notation are two popular notations for describing queues.

M/M/1, for example, denotes a queue with a Poisson arrival process, an exponential service time distribution, and one server. M/M/c denotes a queue with Poisson Arrival and Exponential service with c servers, implying that the service is provided by more than one server while the service time remains exponential.
These notations are widely used in queueing theory and analysis because they allow for a quick understanding of the queue’s characteristics and the selection of appropriate mathematical models to represent the queueing system and thus evaluate its performance.

Queue Discipline

The order in which customers are served in a queuing system is referred to as queue discipline. In practice, there are several queue disciplines that are used, including:

Each queue discipline has advantages and disadvantages, so the discipline chosen will be determined by the system requirements and performance objectives.

Queuing Models

Below are the four queuing models that will be discussed here:

1. [M/M/1]: {//FCFS} Queue System

M/M/1 denotes a queueing system with one server and a Poisson distribution for customer interarrival times and service times. The notation /FCFS indicates that a first-come-first-served (FCFS) service discipline is being used, which means that customers are served in the order in which they arrive. This type of queue is also known as an M/M/1/FCFS queue or an M/M/1/FIFO (first-in-first-out) queue. It is one of the most basic and widely studied queueing models in queuing theory, and it is frequently used as a starting point for understanding the performance of more complex queueing systems. To analyze and evaluate an M/M/1 queue, several performance measures are commonly used. Among the most important measures are: 

  1. The average number of customers in the system.
  2. The average waiting time in the queue.
  3. The system utilization.
  4. The probability of a customer finding the server busy.

These metrics can be computed using a variety of analytical techniques, including Queueing formulae, Markov Chain analysis, and even numerical methods. In the case of the M/M/1 queueing model, closed-form solutions for these measures are available, making the analysis relatively simple.

Example:

A solved example of an M/M/1 queue system with FCFS scheduling could look like the following:

The arrival rate of customers is 2 per minute, and the service rate of each server is 3 per minute.

The probability of the system being empty is calculated using the Erlang-C formula: P0 = (2/(2+3)) = 0.4

The average number of customers in the system is calculated as: L = (2/3) / (1-(2/(2+3))) = 0.8

The average time a customer spends in the system is calculated as: W = 1 / (3 – 2) = 1 minute

The probability of there being n customers in the system is calculated using the Poisson distribution with lambda = 2.

This is just a high-level example and parameters such as arrival, service rate or utilization are often used to solve this in real-world scenarios.

2. [M/M/1]: {N//FCFS} System (Limited queue length system)

It is a single-server queueing system with a Poisson arrival process and an exponential service time distribution. N denotes a limited queue length, implying that the queue can only hold a certain number of customers. The notation N/FCFS indicates that the service discipline is first-come-first-served (FCFS), which means that customers are served in the order in which they arrive, but also that when the queue is full, new arriving customers are blocked or rejected, a practice is known as Balking and Reneging. An M/M/1/FCFS/N or M/M/1/FIFO/N queue is another name for this type of queuing system. It is a variant of the basic M/M/1 queue with a limited buffer capacity, which means that the number of customers in the system is limited by N. When the buffer is full, additional customers may be blocked or rejected, complicating the analysis and necessitating the modification of some performance measures to include the blocked/rejected customers. Some of the most important performance measures that can be calculated, similar to an M/M/1 system, are:

  1. The average number of customers in the system (including those blocked or rejected).
  2. The average waiting time in the queue.
  3. The system utilization.
  4. The probability of a customer finding the server busy.
  5. The probability of customers being blocked/reneged.

Due to the bounded nature of the system, calculating these performance measures may necessitate the use of more complex analytical techniques than in the case of the M/M/1 model.

Example:

A solved example of an M/M/1/N queue system with FCFS scheduling could look like the following:

The arrival rate of customers is 2 per minute, the service rate of each server is 3 per minute and the maximum queue length is N=5.

The probability of the system being empty is calculated using the Erlang-C formula: P0 = (2/(2+3)) = 0.4

The average number of customers in the system is calculated as: L = (2/3) / (1-(2/(2+3))) = 0.8

The average time a customer spends in the system is calculated as: W = 1 / (3 – 2) = 1 minute

The probability of there being n customers in the queue is calculated using the Poisson distribution with lambda = 2, But with the condition that once the queue reaches the limit (n=N), the additional customers will be lost or rejected.

The probability of rejection P_R = P(n > N) = probability of customers waiting in the queue when n > N = P(n= N+1) + P(n= N+2) + … (by using Poisson formula)

Note that when the queue length is limited, and if the arrival rate exceeds the service rate, it will eventually leads to a high rejection rate, and customers will experience long waiting time before being served.

3. M/D/1 Queue

The M/D/1 queue is a queuing system in which customer arrival times follow a Poisson distribution (M), service times are deterministic (D) and have a constant value, and the system has one server. This is also known as an M/D/1/FCFS or M/D/1/FIFO queue, where FCFS or FIFO denotes the first-come-first-served service discipline. This type of queuing system is useful for simulating situations where customer service times are known in advance and are consistent, such as a carwash service. The queue will be stable if the arrival rate is less than the service rate, otherwise, it will be unstable due to the deterministic service time. The performance measures for this system are similar to those for the M/M/1 queue, but because the service time is deterministic, closed-form solutions for these measures are frequently easier to obtain. Among the most important measures are: 

  1. The average number of customers in the system.
  2. The average waiting time in the queue.
  3. The system utilization.
  4. The probability of a customer finding the server busy.

Furthermore, the queue length is predictable in this case, which means that given a specific arrival rate and service time, the number of customers in the system will always be the same, rather than being dependent on the randomness of the service time as it is in M/M/1.

Example:

A solved example of an M/D/1 queue system could look like the following:

The arrival rate of customers is 2 per minute and the service rate of each server is 3 per minute.

The utilization of the server is calculated as: U = 2 / (2 + 3) = 0.4

The probability of the system being empty is calculated using the Erlang-B formula: P0 = (2 / 3) / (1 + (2 / 3)) = 0.4

The average number of customers in the system is calculated as: L = 2 * (2 / (2 + 3)) / (1 – (2 / (2 + 3))) = 0.8

The average time a customer spends in the system is calculated as: W = 1 / (3 – 2) = 1 minute

This is just a high-level example, in practice there are other parameters that can be used in real-world scenarios such as the average service time, variance of service time. Also, one important aspect to consider is that M/D/1 is a specific case of a more general queueing system called G/D/1 where the service time is general and not necessarily follows a Markov Process.

4. M/M/c Queue

The M/M/c queue is a queuing system in which customer arrival times follow a Poisson distribution (M), service times are also exponentially distributed (M), and the system has c servers. This is also known as an M/M/c/FCFS or M/M/c/FIFO queue, where FCFS or FIFO denotes the first-come-first-served service discipline. It is also known as the Erlang-c queue. This type of queuing system is useful for simulating situations in which multiple servers provide service. This queuing system allows customers to be served concurrently by the c servers, increasing system capacity and decreasing average customer wait time. This system’s performance metrics are similar to those of the M/M/1 queue. However, some measures are more difficult to calculate because the number of servers c influences the queue’s behavior. The most important measures are as follows:

  1. The average number of customers in the system.
  2. The average waiting time in the queue.
  3. The system utilization.
  4. The probability of a customer finding the server busy.
  5. The probability of customers waiting in the queue.
  6. The probability of customers being blocked.

The M/M/c queue is a more complex model than the M/M/1 queue, and the performance measures are calculated using various approximate and numerical methods. Furthermore, when the number of servers is large, as in many industrial and telecommunications systems, the system can be approximated as an M/M/c queue.

Example:

A solved example of an M/M/c queue system could look like the following:

The arrival rate of customers is λ per minute, the service rate of each server is μ per minute, and there are c=3 servers.

The utilization of the servers is calculated as U = λ / (c*μ)

The probability of the system being empty is calculated using Erlang-C formula: P0 = (λ/(cμ))^c / (c! * (1-(λ/(cμ))) ), where c! = c*(c-1)(c-2)…1

The average number of customers in the system is calculated as: L = (λ/(c*(μ-λ)))

The average time a customer spends in the system is calculated as: W = 1 / (c*(μ-λ))

This is just a high-level example, in practice there are other parameters that can be used in real-world scenarios such as utilization, number of customer in queue, in service, probability of n customer in the system, and etc.

It’s worth mentioning that for large value of c the system is considered as an Erlang-C queue and this approximation is becoming accurate. Also, this formula is only valid when the arrival rate is less than the service rate (λ < μ), so the system is stable and the queue length remains finite.

These are just a few examples of common queuing models; there are many other variations and extensions that can be used to analyze more complex systems.


Article Tags :