In: Computer Science
What causes deadlock in an operating system?
excessive resource swapping
a new processor interrupts in the middle of servicing an existing attempt
too much resource sharing
a process requests a resource that is held by another waiting process
Here the correct answer will be the the option number 4 which is given as "a process requests a resource that is held by another waiting process".This basically means A process has asked for a resource for example memory, or a output device,etc which is already held by another process which is in waiting state meaning it is also waiting for some resource that is held by some other process and like this a cycle forms in which none of the process can carry on with execution .So This leads to deadlock.
The first option which is excessive resource swapping does not lead to deadlock ,it simply means resources are being swapped excessively.
The second option does not lead to deadlock because when such interrupts occur ,if the new process is more important which means it has higher priority then the existing process will be put on hold and new process will be executed and then the old process will resume back so no deadlock here either.
Too much resource sharing which is option 3 also does not lead to a deadlock because it is simply sharing of resources and not blocking or holding a resource that is needed by another process.