Pergunta de entrevista da empresa AKUNA CAPITAL

What is deadlock? How to prevent deadlock?

Respostas da entrevista

Sigiloso

15 de out. de 2015

Deadlocks can occur for many reasons but the most basic case is when a thread or thread pool is waiting for information or results from another set of threads or processes. Can be prevented by many techniques but timeout and atomic functions help as well as event based programming.

Sigiloso

19 de nov. de 2019

- There are 4 conditions to cause deadlock: - the resource they try to hold is **exclusive**. - the process **hold** a resource and **waiting** for another resource. - the resource cannot be **preempted** - wait for each other like a circle (**circular wait**) - Strategies: - ignore it (in OS) - check(use DAG) and recover it - how to recover? break the conditions above: - preempt the resource - user Banker's Algorithm to avoid a circular wait