Chapter 1
The Basics: Input and Output

Lots of ways exist to get data in and out of a program. Files, networks, and databases all serve this purpose in different ways, and you’ll learn about all of them later on in the book. In this chapter, we’ll look at the standard input and standard output streams all UNIX processes have. As you gain proficiency in lower-level input and output (I/O), you’ll learn to write programs that perform more like a C program than a Scala program. You’ll also become acquainted with pointers and strings, two of the key concepts of systems programming.

Later in this chapter, we’ll start to work through a real-world use case that showcases the dramatic performance benefits to be had from taking a bare-metal approach to a seemingly simple problem. Using the Google Books NGrams dataset, we’ll implement a variety of simple algorithms that can process this large data file efficiently. In doing so, we’ll gain comfort with the essential concepts of systems programming: primitive types, pointers, strings, structs, and arrays.