compute num_procs in defragment_memory