A deadlock occurs when two or more transactions are waiting indefinitely for each other to release locks on resources. For example, Transaction 1 locks rows in the student table while needing to update the grade table locked by Transaction 2, and vice versa. The transactions reach a standstill waiting state until the DBMS detects the deadlock and aborts one transaction. Methods to prevent or detect deadlocks include maintaining a wait-for graph to check for cycles and prioritizing older transactions.