introduce helper functions

max_procs(), running_procs() and wait_for_available_procs()