Q122: Plotting processes III

This  question is in continuation with questions #117 & #119.

Question #122: Is there any way by which both processes can finish without having deadlock.

Options:

  1. No, there will always be a deadlock.
  2. Yes, A and B can proceed in any way, and there won’t be a deadlock ever.
  3. After reaching ‘t’, A has to proceed till I4 and only then B should proceed.
  4. After reaching ‘t’, A can reach till I3, then B can reach till I8 and then A can finish.

Solution: The correct answer is option 3rd. Either A or B has to finish first and only then other process should start to avoid deadlock.

Q119: Plotting processes II

This question is in continuation of question #117.

Question #119: What is true for rectangle I1 I2 I5 I6?

Options:

  1. System can never enter this state.
  2. System can enter this state but there will eventually be a deadlock.
  3. This is a deadlock state.
  4. System can enter into this state and can eventually reach ‘u’ (finish the job).

Solution: The correct answer is 2nd one. Once the system enters this state, it means that A has acquired printer and B has acquired plotter. Now after some time, A needs plotter and B needs printer, hence there will be a deadlock in the system.

Q117: Plotting processes I

shaded_regions

The above figure depicts two processes A and B on the two axis, and there is one plotter and one printer in the system. Process A needs printer from time I1 to I3 and needs plotter from time I2 to I4. Similarly, the timeline is shown for Process B where it needs plotter from I5 to I7 and printer from I6 to I8. Answer the following questions based on the given information.

 

Question #117: What do the shaded regions indicate?

1. Deadlock

2. Mutual exclusion not satisfied

3. Safe Region

4. None of the above

Solution: The correct answer is 2nd one. Since there is only one instance of printer, it must not be shared by both processes for mutual exclusion.