Question: The suspend and activate functions. The following pseudo code implements the suspend() and activate() functions. Two new states are introduced, suspended_ready and suspended_blocked, to keep
The suspend and activate functions.
The following pseudo code implements the suspend() and activate() functions. Two new states are introduced, suspended_ready and suspended_blocked, to keep track of the state in which a process was suspended. That is, a ready process moves to the suspended_ready state by the suspend function. Similarly, a blocked process moves to the suspended_blocked state by the suspend function. The activate function reverses the transitions.
suspend(p) { if (p.process_state == blocked) p.process_state = suspended_blocked else p.process_state = suspended_ready } activate(p) { if (p.process_state == suspended_ready) p.process_state = ready else p.process_state = blocked scheduler() } (a) What changes must be made to the scheduler or other functions to make suspend/activate work correctly?
(b) Why is the scheduler called only in activate but not in suspend?
c) A process must be prevented from calling suspend() or activate() on itself. Why?
(d) A process must be prevented from calling suspend() on an already suspended process, or calling activate() on a currently active (ready) process. Why?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
