Index Exchange interview question

What is a deadlock?how to avoid deadlock?