DeadLock detection and prevention