import os import signal if not os.fork(): signal.alarm(5) while True: pass raise SystemExit os.wait() print os.times()[2] + os.times()[3] # Should be close to 5.