A Machine receives two kinds of jobs following two Independent Poisson Processes $1$ and $2$ with arrival rates $\lambda_{1}$ and $\lambda_{2}$, respectively. The machine process the jobs in the following way:
- If the $1^{st}$ job is coming from process $1$, it will have $0$ wait, and process repeats.
- If the $1^{st}$ job is coming from process $2$, it will either wait for time $T$, OR another job from process $1$ before $T$ expires. Process repeats.
Focusing on Point $2$: What is the probability that $1^{st}$ job of process $2$ is served due to a job coming from process $1$ before $T$ expiry?
My answer is: $$P\ (1\ or \ more \ arrivals \ from\ Process\ 1 \ in [0-T]\ )=1-e^{-\lambda_{1}T}$$
I developed a simulator to check this probability value.
When $\lambda_{1} >= \lambda_{2}$, both simulator and above expression results matches, and probability gets $1$ for higher rates.
When $\lambda_{1} <$ $\lambda_{2}$, both simulator and the above expression results do not match for higher rates. Surprisingly, simulation results get constant to a value lower than 1, as $\lambda$ increases.
What would be the right expression for calculating this probability in case if $\lambda_{1} <$ $\lambda_{2}$?
What you need is $$\mathbb{P}(\tau<\mu)$$
that is, the probability that a job from process 1 arrives before $k$ jobs from process 2 arrive.
The time of arrival for process 1 is indeed exponentially distributed with parameter $\lambda_1$. However the time of arrival of $k$ processes is Erlang distributed, i.e. its density is
$$f_{\lambda_2,k}(t)=\frac{\lambda_2^k t^{k-1}e^{-\lambda_2 t}}{(k-1)!}$$
I worked out the end result, it is:
$$\frac{\Gamma(k;(\lambda_2) T)}{(k-1)!}-\left(\frac{\lambda_2}{\lambda_1+\lambda_2}\right)^k\frac{\Gamma(k;(\lambda_1+\lambda_2) T)}{(k-1)!}$$
in which $\Gamma(\alpha,x)$ is the incomplete Gamma function with parameter $\alpha$.