Algorithm to create histogram of Queue

39 Views Asked by At

Say we have a standard queue, where entities are waiting to be processed.

  1. A histogram can be generated which represents the "average length of the queue".

This should be somewhat equivalent to:

  1. a "continuous distribution" of time-waited for all entities.

Given a bunch of entities and their waiting times, it seems fairly obvious how to generate a plot of their waiting times, and do some simple curve fitting to see a continuous distribution.

However, for some reason it is not obvious to me, how to generate a discrete plot representing the size of the queue. The x-axis would be number of items in the queue, and the y-axis would represent the time spent with the queue at that length?

Is there some algorithm that's used to depict this type of information?

1

There are 1 best solutions below

0
On

If you have have the actual wait times for the $N$ items and you are looking to analyze the frequency distribution by wait time, you need to bin the wait times into intervals i.e., 0 to 5 seconds, 5 to 10 seconds etc., using a suitable interval width for your data and plot the frequency for each bin.

Also, what would help is if you could calculate the average $\mu$ and standard deviation $\sigma$ of the wait times. Then you could look at the bins in terms of number of standard deviations from the mean.

Wait times in real world generally follow a Poisson distribution. So you are likely to find the distribution to be skewed and following a Poisson model.