Locks in real life are just as bad-but-also-super-useful as in software


The Bottleneck: A Lock’s True Nature

In concurrent computing, when concurrent functions race to use the same object, a lock is a synchronization primitive that forces the later callers to wait until the first one completes and releases the lock. This prevents the digital chaos of multiple threads trying to write to the same memory location simultaneously, which would lead to data corruption and damange reliability.

However, developers often see locks as a last resort. The reason is simple: locks don’t scale.

As you increase the number of processes that need access, you don’t get more work done faster. Instead, you get a longer and longer line of processes waiting for their turn. The very mechanism designed to create order becomes the primary bottleneck, a single chokepoint that brings a multi-lane superhighway down to a single toll booth. This is a practical demonstration of Amdahl’s Law: the sequential part of any system will ultimately limit its overall speed. Even a small section of code that requires a lock can prevent an entire system from taking advantage of more processing power.

The World as a Series of Locks

This concept of a lock isn’t confined to code. Our society is built upon a vast and intricate system of them. Anything that is scarce or requires controlled access is governed by a lock:

  • Ownership and Property: The deed to a house or the title to a car is a lock. It grants exclusive access and use to the owner, enforced by our legal system.
  • Intellectual Property: Patents and trademarks are locks on ideas and brands. A patent gives an inventor a temporary monopoly on their invention.
  • Access to Professions: A medical license, a law degree, or even a taxi medallion are all forms of locks. They control who is allowed to perform a particular job, limiting the supply of practitioners.
  • Bureaucracy and Regulation: Every form you have to fill out and every permit you need to obtain is a procedural lock that slows down action.

The Universal Cost of Being Locked

Just as in computing, these real-world locks invariably do two things: they increase the cost and decrease the speed of accessing the “locked” object.

  • Increased Cost: Patents on life-saving drugs can famously drive prices to astronomical levels. The lengthy and expensive process of becoming a licensed professional is a cost passed on to the consumer. This is the overhead of the lock.
  • Reduced Speed: The time it takes to get regulatory approval for a new business or a construction project can be measured in years. This is the latency introduced by the lock.

We are creating a world of ever-increasing societal “lock contention.” Watch a group of toddlers, and you will see the raw, unfiltered desire for direct access to resources. We are born hating locks. The concept of “mine!” is one of the first and most fiercely defended. This isn’t just childish selfishness; it’s a fundamental recognition of ownership as a form of control and a protest against the “lock” that sharing imposes.

The Price of Reliability

Locks, both digital and societal, are a double-edged sword. They provide a necessary structure and reliability. A world without them would be a free-for-all, marked by data corruption and the breakdown of social order. However, we must remain vigilant about the costs they impose.

The challenge is not to eliminate locks entirely, but to recognize them for what they are: a necessary evil in many cases, but a drag on efficiency nonetheless. The future of both technological and societal progress may well depend on our ability to find more creative, less restrictive, and more scalable ways to manage access to our shared resources. Just as computer scientists are constantly innovating with lock-free data structures and more efficient concurrency models, we as a society must constantly question whether our own “locks” are truly serving their intended purpose, or simply slowing us down.