Computers are often used to book (reserve) air flights, seats in the cinema, rooms in a hotel, tables in a restaurant, etc.

In all of the above examples, there are a limited number of items (seats on a plane, rooms in a hotel, etc.) which need to be allocated.

It is very important that any booking system prevents the same item being booked twice (double-booking).
Stacks Image 5969

So How do Booking Systems Work?

If we were talking about a single, small cinema, where you had to queue up to buy tickets at the front door, the reservation system would be very simple: We could just use a piece of paper and tick off seats as they were reserved.

However, most booking systems are much more complex than this. A typical booking system must cope with booking requests from many different sources, all arriving at the same time. For example, flights can be booked by customers online, by travel agents in dozens of different offices, by businesses, etc.

How do booking systems manage all these bookings without making any double-bookings?

All Booking Systems are Real-Time

The Key to all booking systems is the fact that they are real-time systems.

A real-time system is one where every input is processed immediately, so that the resulting output is ready before the next input is processed.

In the case of a booking system...
  • The inputs are booking requests
  • The processing involves checking if bookings are possible, and if so making the bookings
  • The outputs are booking confirmations / rejections

Because a booking system is real-time, when a booking request arrives, the previous booking has already been fully processed. This is what prevents double-booking.
Stacks Image 5989
Stacks Image 5992
Stacks Image 5995

An Example...

Imagine that two people are using an airline's website to try and book seats on a flight. Both people try to book seat 38C and the same time...
Stacks Image 6008
Even though the booking requests are made at the same time, one request will be received by the airline's computer just before the other (since requests come into the system through a 'queue')

This is what happens:
  1. Input: Please reserve seat 38C
  2. Process: Has seat 38C already been booked? No... so book it
  3. Output: Booking confirmed for seat 38C
  4. Input: Please reserve seat 38C
  5. Process: Has seat 38C already been booked? Yes!
  6. Output: Booking rejected
You can see that the first input is fully processed before the next one. So seat 38C doesn't get booked twice.
Stacks Image 6015

Sorry to ask you this, but...

 

This site took quite a bit of time and effort to create, and it costs me money to keep it up and running. If the site has helped you, please consider showing your appreciation by donating a little towards the site's running costs.

Thank you!

Sponsored Links...