Expected time until a given interval between Poisson process events The system I am trying to model is as follows:


*

*A program takes time $T$ to run

*The computer crashes on average every $\text{MTBF}$ time units

*The program is repeatedly run until it completes without a crash

*What is the expected time to completion?


I tried to calculate this by working out how many times the program is expected to fail before it completes:
If failures are modelled by a Poisson process of rate $\frac{1}{\text{MTBF}}$ then the probability of no failure occurring during the program is $e^{-\frac{T}{\text{MTBF}}}$
Therefore the number of failures until a success is modelled by a Geometric distribution and hence the expected number of failures is $e^{\frac{T}{\text{MTBF}}}-1$ (by standard result that the expectation $=\frac{1-p}{p}$)
Therefore the time to completion is given by $(e^{\frac{T}{\text{MTBF}}}-1)*t+T$ where $t$ is the expected length of each failed run. But I'm not sure how to calculate this value $t$? Is this just going to be the expected time between events in the Poisson process conditioned on this time being $<T$?
Is there a more direct way of working out this expected time until a gap $T$ between two Poisson process events?
 A: Let $X$ denote the time of the first crash and $C$ the time to completion, thus $X$ is exponentially distributed with parameter $a=1/\textrm{MTBF}$, and $C=T$ if $X>T$ while $C=X+C'$ if $X<T$, where $C'$ is distributed as $C$ and independent of $X$. Thus, $$E(C)=E(T\mathbf 1_{X>T})+E((X+C')\mathbf 1_{X<T})=TP(X>T)+E(X\mathbf 1_{X<T})+E(C)P(X<T)$$ which implies that the expected time to completion $E(C)$ is $$E(C)=\frac{TP(X>T)+E(X\mathbf 1_{X<T})}{P(X>T)}=T+\frac{E(X\mathbf 1_{X<T})}{P(X>T)}$$
Now, $P(X>T)=e^{-aT}$ and 
$$E(X\mathbf 1_{X<T})=\int_0^Tx\,ae^{-ax}dx=\left[-(x+a^{-1})e^{-ax}\right]_0^T=a^{-1}-(T+a^{-1})e^{-aT}$$ which yields
$$E(C)=\frac{e^{aT}-1}a$$
that is,
$$E(C)=\textrm{MTBF}\cdot(e^{T/\textrm{MTBF}}-1)$$
A: 
t is the expected length of each failed run

You already have the value of t, you state it in bullet #2 in your premise.

The computer crashes on average every MTBF time units

The expected length of each failed run equals how long (on average) it runs before it crashes.  So, t = MTBF.

Is this just going to be the expected time between events in the Poisson process conditioned on this time being less than T?

No.
In your Poisson distribution, you use λ = T/MTBF (a time rate).
The expected number of crashes during time T therefore is T/MTBF.
I was initially tempted to calculate the "inter crash rate" of 1/λ (i.e. MTBF/T) but this doesn't apply in your case.
Since you start over the process after a crash, you "re-set" the timer on the Poison process.
