The depletion time for M/G/1 systems and a related limit theorem