Britannica Sources used in this answer

How does locking prevent two users from booking the same airline seat?

Created from Britannica articles using AI. AI can make mistakes, so verify using Britannica articles.

In the context of computer science and information management, locking is a concurrency control mechanism used by a database management system (DBMS) to maintain data integrity when multiple users attempt to access or modify the same data simultaneously.1

When two travel agents attempt to book the last available seat on a flight at the same time, the DBMS uses locking to serialize these requests. By applying a lock to the specific data record representing that seat, the system ensures that only one transaction can modify the record at a time. If one user successfully locks the record to complete their booking, the system prevents the second user from accessing or modifying that same record until the first transaction is finished. This process ensures that the database remains in a consistent state and prevents the error of overbooking, where both users might otherwise believe they have secured the same seat.1