Reply To: Computer Science and Information Technology (CS)- Jobs [GATE 2012]

All About Education Forums Computer Science and Information Technology Computer Science and Information Technology (CS)- Jobs [GATE 2012] Reply To: Computer Science and Information Technology (CS)- Jobs [GATE 2012]

  1. @ Anusha,
    Your Ques:A computer has 6 tape drives with N process competing for them.. each process need 2 drives… then the max value for N to b deadlock free is??????

    Answer: first of all we need to know that what causes a deadlock?? When several process hold their resources and wait for more resources for completion, we cannot preempt the resources they hold hold unless they complete…But the resources they are waiting for are held by some other process which are again waiting for some resource which are held by some other process, and when this form a cycle… We can be sure that all the process will keep on waiting for the resources which are already held by some other resource and thus, All of the process will wait forever and Thus DEADLOCKED.

    The Ques says there are total of 6 tape drives(resource) and n processes where each require 2 drives… thus for the system to be deadlock free, the total no. of process should not be such that it forms a hold and wait cycle… Suppose we have max n=6 i.e. 6 process then, what can happen is each process holding 1 drive and waiting for the 2nd drive to complete execution, but since no extra drive is left, and no process will pre empt the resource they are holding b4 they complete, all the process will wait forever and thus will be in deadlock… While if we take max n=5 , In the worst situation each process will have 1 tape drive but still there will be an extra tape drive left, which any of the 5 process can use and complete releasing both of the tape drives it needed… Thus the system will never go into deadlock… So the answer of your question is
    n=5.

    I m bad in explaining things, i tried my best.. Hope you understood. 🙂