Exam 1, Question 2 Solution

Q2. Resource Management. (20 pts.)

A.     List and explain an event that can cause a process to move from the running state to the waiting state. If no such event exists, explain why.

        An event of this kind would be: when a process makes a resource request (say an I/O or any other devices), it "waits" for the job with resource to be completed and will not require any CPU time for a while. So it moves from a running state to a waiting state.
 
 

B.     List and explain an event that can cause a process to move from the running state to the ready state. If no such event exists, explain why.

      An event of this kind would be: when a process execution times out. In most cases a process scheduler (part of the OS kernel) allocates time slices for every process. Either this allocation happens in a round-robin fashion or there may be a different mechanism of process scheduling based on priorities of the processes.  When an allocated time slice of a process is over the scheduler moves it from a running state to a ready state and will let some other process take CPU cycles.
 

C.     List and explain an event that can cause a process to move from the ready state to the waiting state. If no such event exists, explain why.

        No such event exists. Waiting state as explained earlier involves a process waiting for a resource to become available. Ready state on the other hand is associated with processes that are ready to utilize CPU cycles and are probably waiting for a process scheduler to allocate CPU time.  In such a case, it doesn't make sense for the process to go to a waiting state immediately.
 

D.     List and explain an event that can cause a process to move from the waiting state to the ready state. If no such event exists, explain why.

        An event of this kind would be: when a process is waiting for a resource and the resource becomes available. In such a case it moves from waiting state to the ready state.