As a working definition, systems programming is the art of writing code while remaining aware of the properties and limitations of the machine that will run it. For all the complexity of modern software, computers are still surprisingly simple devices at the machine-code level.
We can identify five fundamental data structures for working on bare metal:
Primitive data types—integers, floating-point numbers, and raw bytes that can be directly represented in machine code.
Low-level byte strings—a way of representing textual data of variable length directly in a computer’s memory.
Structs—a compound data type that arranges named fields in memory in a fixed way.
Array layout—data of the same type that are arranged in a grid-like fashion, one after another.
Pointers—a numeric representation of the location in memory of some other piece of data.
These five data structures are profoundly interrelated. In this book, I’ll introduce them gradually through a series of real-world examples. As you attain more proficiency, the deep connections between these concepts will let you write simple, powerful programs that vastly outperform what you can achieve with regular JVM Scala.
Even if you rarely write low-level code, the knowledge and insight you attain from learning systems programming pays dividends; essential everyday tasks, like tuning and debugging systems, interpreting complex error messages, and predicting the performance characteristics of complex systems, become much easier and more accurate when you have a solid knowledge of the fundamental principles by which computers operate.
That said, this isn’t an eat-your-vegetables guide to systems programming. I’m excited to write a systems programming book now, because of the new possibilities created by recent developments in cloud computing and distributed systems technology.