How Hardware Affects Software
I have always been fascinated with how changes in hardware affect how we write software.
A couple of decades ago, memory was a very limited resource. It made sense back then for our software to take hold of some piece of memory and mutate it as necessary. However, allocating this memory and cleaning up after we no longer needed it was a very error-prone task. Some memory was never freed; sometimes memory was allocated over another structure, leading to faults. At the time, garbage collection was a known technique, but we needed faster CPUs in order to use it in our daily software and free ourselves from manual memory management. That has happened—most of our languages are now garbage-collected.
Today, a similar phenomenon is happening. Our CPUs are not getting any faster. Instead, our computers get more and more cores. This means new software needs to use as many cores as it can if it is to maximize its use of the machine. This conflicts directly with how we currently write software.
In fact, mutating our memory state actually slows down our software when many cores are involved. If you have four cores trying to access and manipulate the same piece of memory, they can trip over each other. This potentially corrupts memory unless some kind of synchronization is applied.
I quickly learned that applying this synchronization is manual, error-prone, and tiresome, and it hurts performance. I suddenly realized that’s not how I wanted to spend time writing software in the next years of my career, and I set out to study new languages and technologies.
It was on this quest that I fell in love with the Erlang virtual machine and ecosystem.