Also, move it from "main" into lib/process
Note that procmon does *not* go here, since procmon needs to integrate with the event loop.