# How did transportation companies avoid double booking, before enterprise-wide IT systems?

**URL:** <https://boards.straightdope.com/t/how-did-transportation-companies-avoid-double-booking-before-enterprise-wide-it-systems/739383>\
**Category:** Factual Questions\
**Created:** [December 4, 2015, 4:06am UTC](https://boards.straightdope.com/t/how-did-transportation-companies-avoid-double-booking-before-enterprise-wide-it-systems/739383 "2015-12-04T04:06:17Z")\
**Posts on this page:** 10\
**Page:** 2

<div class="post-metadata">

**Author:** ![Habeed](https://avatars.discourse-cdn.com/v4/letter/h/a587f6/32.png) [@Habeed](https://boards.straightdope.com/u/Habeed)\
**Post date:** [December 5, 2015, 5:18pm UTC](https://boards.straightdope.com/t/how-did-transportation-companies-avoid-double-booking-before-enterprise-wide-it-systems/739383/21 "2015-12-05T17:18:28Z")

</div>

> [@wolfpup](#):
>
> For the record, that’s not true. Locks are a standard method of resource management in any multitasking or multi-threaded environment. Even the most primitive modern OS will have many simultaneous processes and execution threads even with a single processor. “Simultaneous” simply means they are transparently scheduled by the OS based on events or clock cycles, and constructs like locks, mutexes, and semaphores are a means of coordinating their shared resources so they don’t trample all over each other.

In that case, the purpose of a lock is to prevent 2 non-simultaenous tasks from conflicting. Since the tasks are _not_ simultaneous and memory writes are atomic, you don’t need locks here, either.

For example, you have a comm buffer where the incoming data from the modems goes to. One thread/process handling the modems/network populates the buffer and another thread/process reads from it and uses it to book seats.

The lock-free solution is to make sure the populating thread updates the index to the bottom of this buffer **after** writing an element (so if it gets yanked away immediately after by an OS interrupt it will be in a valid state) and the thread reading does the same thing. Each thread should use it’s own index for this, and not share with the others.

---

<div class="post-metadata">

**Author:** ![wolfpup](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/wolfpup/32/10618_2.png) [@wolfpup](https://boards.straightdope.com/u/wolfpup)\
**Post date:** [December 5, 2015, 8:11pm UTC](https://boards.straightdope.com/t/how-did-transportation-companies-avoid-double-booking-before-enterprise-wide-it-systems/739383/22 "2015-12-05T20:11:42Z")

</div>

> [@Habeed](#):
>
> In that case, the purpose of a lock is to prevent 2 non-simultaenous tasks from conflicting. Since the tasks are _not_ simultaneous and memory writes are atomic, you don’t need locks here, either.

If that were true it would still be true with multiple processors, which you claimed was the only reason to use locks. But it isn’t true because the real world doesn’t work that way or even remotely close to that way.

In the real world, resources that need to be synchronized are much larger than the minimum hardware-addressable units like memory bytes or disk blocks and may need to be kept locked until some potentially lengthy processing activity completes. This is pretty basic computer science. Windows, for instance, makes extensive use of both [mutexes](https://msdn.microsoft.com/en-us/library/windows/desktop/ms686927%28v=vs.85%29.aspx) and [semaphores](https://msdn.microsoft.com/en-us/library/windows/desktop/ms686946%28v=vs.85%29.aspx). So does Unix, and any other OS that supports concurrency.

---

<div class="post-metadata">

**Author:** ![ftg](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/ftg/32/2801_2.png) [@ftg](https://boards.straightdope.com/u/ftg)\
**Post date:** [December 5, 2015, 9:25pm UTC](https://boards.straightdope.com/t/how-did-transportation-companies-avoid-double-booking-before-enterprise-wide-it-systems/739383/23 "2015-12-05T21:25:55Z")

</div>

> [@Isilder](#):
>
> Is trivial programming.

This is the problem with concurrent control. It is far, far, far harder than one thinks.

Your code isn’t anywhere close to handling all the events that arise in this situation. People wanting a block of seats together or just one. Not caring about the day. Some want a particular type of seat (aisle seat on a plane, for example) but the sets of types overlap horribly. All while other people are checking on other groups of sets under other circumstances. Which could lead to seats that could be sold Right Now not being sold Right Now which is the company’s goal. There’s a many-many mapping with conditions problem here. PhD theses can be written about it.

Also note an obvious flaw in your code: The sleep timeout is something that should never be done in a case like this. Consider the cycle: Someone gets the lock first, you sleep, they unlock, someone else gets it, you wake up, still locked, go back to sleep, lather and repeat.

If you have decent locks to begin with, this is avoided. DIY hope and pray queuing is a _bad_ idea. It goes bad far more often than you would guess. And if you have to implement your own queuing, then you are programming in the wrong decade.

At least 99% of sequential programmers are terrible concurrent programmers.

---

<div class="post-metadata">

**Author:** ![Voyager](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/voyager/32/133_2.png) [@Voyager](https://boards.straightdope.com/u/Voyager)\
**Post date:** [December 5, 2015, 11:23pm UTC](https://boards.straightdope.com/t/how-did-transportation-companies-avoid-double-booking-before-enterprise-wide-it-systems/739383/24 "2015-12-05T23:23:23Z")

</div>

> [@Derleth](#):
>
> It’s a specialized topic, but, really, it always has been. Java, for example, has a multithreading library with a built-in semaphore class which is identical to what Dijkstra wrote about. As for the “guts”, that’s inherently hardware-dependent and can be implemented in terms of compare-and-swap opcodes (x86 does this) or LL/SC (load-link/store-conditional) opcodes (the various ARM flavors have these) and probably others.
> 
> As for implementing the hardware, that’s more specialized still, and further into EE territory.

The theory is the same if it is done in software or in hardware. When Dijkstra wrote, and when I took it, the hardware pretty much didn’t support this except in the sense that you could mask interrupts in critical regions. I am involved in implementing hardware, but I’ve never had a reason to look at this particular part of it. The instruction set level is way above where I work these days.  
So my question was if students just learned what OS calls or instructions to use to deal with this problem, or if they learned the reason you need special instructions.  
ETA: I’m particularly interested because I used this basic principle in a system I built, though the problem was pretty far from the basic one.

---

<div class="post-metadata">

**Author:** ![Hail\_Ants](https://avatars.discourse-cdn.com/v4/letter/h/dc4da7/32.png) [@Hail\_Ants](https://boards.straightdope.com/u/Hail_Ants)\
**Post date:** [December 6, 2015, 8:19am UTC](https://boards.straightdope.com/t/how-did-transportation-companies-avoid-double-booking-before-enterprise-wide-it-systems/739383/25 "2015-12-06T08:19:58Z")

</div>

In terms of air travel, before deregulation, no-shows were not nearly as common. Flying was something mostly only the rich did, the so-called ‘jet set’. Middle class people might only take a few flights in their entire lives. And since tickets were so expensive people did not change their plans and not show up for a flight so casually.

> [@Kevbo](#):
>
> In the days of dial-up US travel agents used a system called SABRE (sp?) to book airline tickets. Apparently SABRE accounts were either expensive or limited or something. When my boss started our own in-house travel agency in the mid 1990s he bought out an existing (but failing) travel agent just to get their SABRE account.

I remember being able to access SABRE thru CompuServe dialup in the later 90s. It was annoyingly slow and glitchy, nothing like Travelocity today, but you could do it…

---

<div class="post-metadata">

**Author:** ![Melbourne](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@Melbourne](https://boards.straightdope.com/u/Melbourne)\
**Post date:** [December 7, 2015, 9:02am UTC](https://boards.straightdope.com/t/how-did-transportation-companies-avoid-double-booking-before-enterprise-wide-it-systems/739383/26 "2015-12-07T09:02:18Z")

</div>

> [@Hail\_Ants](#):
>
> In terms of air travel, before deregulation, no-shows were not nearly as common. Flying was something mostly only the rich did, the so-called ‘jet set’. Middle class people might only take a few flights in their entire lives. And since tickets were so expensive people did not change their plans and not show up for a flight so casually.

But, if you did change your plans and not turn up in the late 60’s, you didn’t loose your whole airfare. Since the planes rane with vacent seats anyway, when you missed your booking you could still get on the next flight\*.

\*which might be next week.

---

<div class="post-metadata">

**Author:** ![LSLGuy](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/lslguy/32/5813_2.png) [@LSLGuy](https://boards.straightdope.com/u/LSLGuy)\
**Post date:** [December 7, 2015, 12:46pm UTC](https://boards.straightdope.com/t/how-did-transportation-companies-avoid-double-booking-before-enterprise-wide-it-systems/739383/27 "2015-12-07T12:46:30Z")

</div>

> [@Hail\_Ants](#):
>
> In terms of air travel, before deregulation, no-shows were not nearly as common. Flying was something mostly only the rich did, the so-called ‘jet set’. Middle class people might only take a few flights in their entire lives. And since tickets were so expensive people did not change their plans and not show up for a flight so casually.  
> …

You’ve mixed apples and oranges here.

In the Olden Dayes of the 1960s and 1970s pre-deregulation a “ticket” was an unrestricted right to fly between a city pair on a flight of the customer’s choosing. Because even fares were regulated, you could even use the ticket on a different airline than you bought it on. A separate thing called a “reservation” was a soft commitment by the customer to show up on a particular day for a particular flight. You could have a ticket and no reservation, or a reservation and no ticket.

The situation was much more like a reservation at a restaurant is today than like a baseball game is today. IOW, no binding commitment by the customer at all.

No-showing for a flight carried exactly zero penalty to the customer. Changing plans at the last minute carried exactly zero penalty to the customer. Cancelling a ticket carried exactly zero penalty for the customer.

It didn’t take long as society became more consumerist and air travel got cheaper before some customers noticed an opportunity to game the system with one ticket and multiple reservations for their convenience. “Why not? It’s free so it must be OK” they rationalized. Soon the airlines were inundated with “full” flights that left 2/3rds full day after day.

The airlines counter-attacked with overbooking. The consumers, via the government, counter-counter-attacked with denied boarding compensation laws. The airlines counter-counter-attacked with yield management, change fees, non-refundable tickets, different fare levels, and all the rest.

And now we’re locked in this MAR doctrine (Mutually Assured Rip-off). How we climb down from here is about as easy to figure out as how countries can climb down from the nuclear MAD doctrine.

---

<div class="post-metadata">

**Author:** ![Voyager](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/voyager/32/133_2.png) [@Voyager](https://boards.straightdope.com/u/Voyager)\
**Post date:** [December 7, 2015, 6:07pm UTC](https://boards.straightdope.com/t/how-did-transportation-companies-avoid-double-booking-before-enterprise-wide-it-systems/739383/28 "2015-12-07T18:07:00Z")

</div>

> [@LSLGuy](#):
>
> It didn’t take long as society became more consumerist and air travel got cheaper before some customers noticed an opportunity to game the system with one ticket and multiple reservations for their convenience. “Why not? It’s free so it must be OK” they rationalized. Soon the airlines were inundated with “full” flights that left 2/3rds full day after day.

In my experience business people did this a lot, since if they were uncertain when their meetings would end they could book several flights and be sure they would be on the earliest they could make. As you said, there was no penalty for no-shows or ticket exchanges. It took a while for the exchange penalty to start - in the early 1980s when I flew a lot for work I’d often change tickets if I got there early, though I never multiple-booked.

However I disagree with\*\* Hail Ants\*\* about air travel being mostly for the elite. Maybe in the 1950s, and early 1960s, but by the early 1970s when I was in college I flew all the time and it was no big deal. They had student discounts, and my flight from Boston to New York was under $30. Not much more than than the bus. As a grad student in 1976 I flew on my own dime to a conference in Boulder, and it wasn’t a big hit to my budget. It is relatively cheaper now, but it wasn’t expensive enough back then to be out of the range of the masses.  
And you got fed also.

---

<div class="post-metadata">

**Author:** ![Schnitte](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/schnitte/32/9033_2.png) [@Schnitte](https://boards.straightdope.com/u/Schnitte)\
**Post date:** [December 7, 2015, 8:09pm UTC](https://boards.straightdope.com/t/how-did-transportation-companies-avoid-double-booking-before-enterprise-wide-it-systems/739383/29 "2015-12-07T20:09:23Z")

</div>

> [@md2000](#):
>
> Hmmm… I bought train tickets from Naples to Venice in 2001, and there were quite a few people ended up sitting on their luggage in the corridors of the train cars. So another strategy is “[shrug] who cares?”

It depends on the railway company in question. Deutsche Bahn does not require mandatory seat reservations for its trains, not even the ICE high-speed network (although you can, at an additional fee, opt to book a seat); it is quite common even today to have an overcrowded train with people sitting on the floor. In some other countries, trains, or at least the high-speed ones, operate on a basis that more closely resembles airlines, with mandatory seat reservations.

---

<div class="post-metadata">

**Author:** ![Hail\_Ants](https://avatars.discourse-cdn.com/v4/letter/h/dc4da7/32.png) [@Hail\_Ants](https://boards.straightdope.com/u/Hail_Ants)\
**Post date:** [December 8, 2015, 1:26am UTC](https://boards.straightdope.com/t/how-did-transportation-companies-avoid-double-booking-before-enterprise-wide-it-systems/739383/30 "2015-12-08T01:26:30Z")

</div>

> [@LSLGuy](#):
>
> You’ve mixed apples and oranges here.
> 
> In the Olden Dayes of the 1960s and 1970s pre-deregulation a “ticket” was an unrestricted right to fly between a city pair on a flight of the customer’s choosing. Because even fares were regulated, you could even use the ticket on a different airline than you bought it on. A separate thing called a “reservation” was a soft commitment by the customer to show up on a particular day for a particular flight. You could have a ticket and no reservation, or a reservation and no ticket.
> 
> The situation was much more like a reservation at a restaurant is today than like a baseball game is today. IOW, no binding commitment by the customer at all.
> 
> No-showing for a flight carried exactly zero penalty to the customer. Changing plans at the last minute carried exactly zero penalty to the customer. Cancelling a ticket carried exactly zero penalty for the customer.
> 
> It didn’t take long as society became more consumerist and air travel got cheaper before some customers noticed an opportunity to game the system with one ticket and multiple reservations for their convenience. “Why not? It’s free so it must be OK” they rationalized. Soon the airlines were inundated with “full” flights that left 2/3rds full day after day.
> 
> The airlines counter-attacked with overbooking. The consumers, via the government, counter-counter-attacked with denied boarding compensation laws. The airlines counter-counter-attacked with yield management, change fees, non-refundable tickets, different fare levels, and all the rest.
> 
> And now we’re locked in this MAR doctrine (Mutually Assured Rip-off). How we climb down from here is about as easy to figure out as how countries can climb down from the nuclear MAD doctrine.

Wow, that’s awesome info. Not old enough to remember this, nor had I ever met anyone who flew back then. I have heard guys say that, _“Back then even in coach, you didn’t board an airline without a jacket & tie!”_

[Previous page](https://boards.straightdope.com/t/how-did-transportation-companies-avoid-double-booking-before-enterprise-wide-it-systems/739383.md?page=1)
