Arcesium interview question

Explain Deadlocks and their avoidance.Also asked to write banker's alogirithm program.