Understanding Deadlock: Causes, Types, and Resolution