Operating Systems
Deadlock
When processes wait on each other for ever, and how to prevent, avoid or detect it.
In two minutes
One idea to a line
Deadlock needs all four: mutual exclusion, hold and wait, no preemption and circular wait. Break one and it cannot happen.
Prevention removes one condition (for example, order all resources and request them in that order to stop circular wait).
Avoidance, like the banker's algorithm, grants a request only if the system stays in a safe state, where some order lets every process finish.
Need = Max − Allocation. A state is safe if there is a sequence in which each process's need fits what is free after the ones before it finish.
An unsafe state does not mean deadlock has happened; it means deadlock is possible.
Slips people make here
Interviewers know them too
Treating "unsafe" as "deadlocked".
Comparing Max instead of Need with the free resources.
Forgetting to add back what a finished process holds before checking the next one.
Your practice here
Not started
10 written questions, and 3 kinds of calculation that change every time
No answers yet