How Deadlock Can Be Detected