generalized task_manager::calculate_new_state