Breaktime fraction and tasks between breaks have reciprocal mean


Is your queue free one tenth of the time? Expect to work ten tasks between breaks.

If I have 1 worker dedicated to a stream of independently distributed tasks each with fixed unit time, and this stream averages \( \mu \in (0,1) \) new tasks per unit time, then the distribution for freeing the queue after exactly \( x \) units of work is

\[ \text{Borel}_\mu(x) = \frac{ e^{- x \mu} (x \mu)^{x-1}}{x!} \]

Numerical summation of \( \sum_{x=1}^{\infty} \text{Borel}_\mu(x) = 1 \) for any \( \mu \in ( 0, 1) \), which demonstrates a valid distribution. Performing a similar numerical summation in this same range to find the mean also converges:

\[ E(X) = \sum_{x=1}^{\infty} x \text{Borel}_\mu(x) \approx \frac{1}{1-\mu} \]

So, quite simply, by this distribution, if my minion spends 1/5 of his time with a free queue, then I should expect him to work 5 tasks (on average) before the queue is again free. Also, by the exponential distribution, having 4/5 of his time busy, I should expect a free queue to last about 5/4 task units.

Pondering flexible task lengths

Fixed task lengths may make this result seem trivial, so I could assign an exponential random variable to the time on each task, with unit mean. Keeping the mean arrival rate of \( \frac{1}{\mu} \) will leave \( \mu \in ( 0, 1) \) time free on average just like \( \text{Borel}_\mu(x) \). Specifically, I have the following:

Time to next decrement from queue (non-empty) has a distribution

\[ ~ Exp(X,1) = e^{-x} \]

Time to next increment to queue has a distribution

\[ ~ Exp(x, \mu) = \mu e^{- x \mu} \]

Because decrement and increment is memory-less, I can quickly explore the function of a working queue. Before I begin, at \( x = 0 \), I have an empty queue (0-job state). There is no chance of decrement, so work start is predicted by \( ~ Exp(x,\mu) \). At that moment the queue will be active on the first job; I'll call this the 1-job state. The 1-job state lasts until the job finishes, or a second job is queued. If a second job is queued, I have the 2-job state, which this will last until either a job finishes (returning to the 1-job state), or else a third job will be queued (3-job state). And so on.

Will this FRIFRO (First random-in, first random-out) look like the continuous variant of the next \( \text{Borel}_\mu(x) \) distribution? I'm not expecting any surprises but I'm still working on it so in time I'll get around to it.