  We determine how long a diffusing particle spends in a given spatial range
before it dies at an absorbing boundary. In one dimension, for a particle that
starts at $x_0$ and is absorbed at $x=0$, the average residence time in the
range $[x,x+dx]$ is $T(x)=\frac{x}{D}\,dx$ for $x<x_0$ and $\frac{x_0}{D}\,dx$
for $x>x_0$, where $D$ is the diffusion coefficient. We extend our approach to
biased diffusion, to a particle confined to a finite interval, and to general
spatial dimensions. We use the generating function technique to derive parallel
results for the average residence time of the one-dimensional symmetric
nearest-neighbor random walk that starts at $x_0=1$ and is absorbed at $x=0$.
We also determine the distribution of times at which the random walk first
revisits $x=1$ before being absorbed.
