Image

Are you curious about how computers work? Gaining a broad understanding of computing is often a long and winding path. The problem isn’t a lack of documentation. A quick search online shows that there are many, many books and websites devoted to explaining computing. Programming, computer science, electronics, operating systems … a wealth of information is out there. This is a good thing, but it can be daunting. Where should you begin? How does one topic connect to another? This book was written to give you an entry point for learning about key concepts of computing and how these concepts fit together.

When I worked as an engineering manager, I regularly interviewed people for software development jobs. I spoke to many candidates who knew how to write code, but a significant number of them didn’t seem to know how computers really work. They knew how to make a computer do their bidding, but they didn’t understand what was going on behind the scenes. Reflecting on those interviews, and on memories of my own struggles in trying to learn about computers, led me to write this book.

My goal is to present the fundamentals of computing in an accessible, hands-on way that makes abstract concepts more real. This book doesn’t go deep on every topic presented, but instead, it presents the foundational concepts of computing and connects the dots between those concepts. I want you to be able to construct a mental picture of how computing works, enabling you to then dig deeper on the topics that interest you.

Computing is everywhere, and as our society depends more and more on technology, we need individuals who broadly understand computing. My hope is that this book will help you gain that broad perspective.

Who Is This Book For?

This book is for anyone who wants to understand how computers work. You don’t need to have any prior knowledge of the topics covered—we begin with the basics. On the other hand, if you already have a background in programming or electronics, this book can help you expand your knowledge in other areas. The book is written for the self-motivated learner, someone who is comfortable with basic math and science, and who is already familiar with using computers and smartphones, but who still has questions about how they work . Teachers should find the content useful too; I believe the projects are a good fit for the classroom.

About This Book

This book looks at computing as a technology stack. A modern computing device, such as a smartphone, is composed of layers of technology. At the bottom of the stack we have hardware, and at the top of the stack we have apps, with multiple technology layers in between. The beauty of the layered model is that each layer benefits from all the capabilities of the lower levels, but any given layer only needs to build upon the layer directly below it. After covering some foundational concepts, we’ll progress through the technology stack from the bottom up, starting with electrical circuits and working our way up to the technologies that power the web and apps. Here’s what we’ll cover in each chapter:

Chapter 1 : Computing Concepts Covers foundational ideas, such as understanding analog versus digital, the binary number system, and SI prefixes

Chapter 2 : Binary in Action Looks at how binary can be used to represent both data and logical states, and includes an introduction to logical operators

Chapter 3 : Electrical Circuits Explains basic concepts of electricity and electrical circuits, including voltage, current, and resistance

Chapter 4 : Digital Circuits Introduces transistors and logic gates, and brings together concepts from Chapters 2 and 3

Chapter 5 : Math with Digital Circuits Shows how addition can be performed with digital circuits and covers more details about how numbers are represented in computers

Chapter 6 : Memory and Clock Signals Introduces memory devices and sequential circuits, and demonstrates synchronization through clock signals

Chapter 7 : Computer Hardware Covers the major parts of a computer: processor, memory, and input/output

Chapter 8 : Machine Code and Assembly Language Presents low-level machine code that processors execute, and covers assembly language, the human-readable form of machine code

Chapter 9 : High-Level Programming Introduces programming languages that are independent from specific processors, and includes example code in C and Python

Chapter 10 : Operating Systems Covers families of operating systems and the core capabilities of operating systems

Chapter 11 : The Internet Looks at how the internet works, including the common suite of network protocols it uses

Chapter 12 : The World Wide Web Explains how the web works, and looks at its core technologies: HTTP, HTML, CSS, and JavaScript

Chapter 13 : Modern Computing Provides overviews of a handful of modern computing topics, such as apps, virtualization, and cloud services

As you read through this book, you’ll come across circuit diagrams
and source code used to illustrate concepts. These are intended as teaching tools, favoring clarity over performance, security, and other factors that engineers consider when designing hardware or software. In other words, the circuits and code in this book can help you learn how computers work, but they aren’t necessarily examples of the best way to do things. Similarly, the book’s technical explanations favor simplicity over completeness. I sometimes gloss over certain details to avoid getting mired in complexity.

About Exercises and Projects

Throughout the chapters you’ll find exercises and hands-on projects. The exercises are problems for you to work out mentally or with pencil and paper. The projects go beyond mental exercises and often involve building a circuit or programming a computer.

You’ll need to acquire some hardware to perform the projects (you can find a list of needed components in Appendix B ). I’ve included these projects because I believe that the best way to learn is to try things yourself, and I encourage you to complete the projects if you want to get the most out of this book. That said, I’ve presented the chapter material in a way that allows you to still follow along, even if you don’t build a single circuit or enter one line of code.

You can find the answers to exercises in Appendix A , and the details for each project are found at the end of the corresponding chapter. Appendix B contains information to help you get started with projects, and the project text points you there when needed.

A copy of the source code used in the projects is available at https://www.howcomputersreallywork.com/code / . You can also visit this book’s page at https://nostarch.com/how-computers-really-work / where we will provide updates.

My Computing Journey

My fascination with computers probably began with the video games I played as a kid. When I visited my grandparents, I’d spend hours playing Frogger, Pac-Man, and Donkey Kong on my aunt’s Atari 2600. Later, when I was in fifth grade, my parents gave me a Nintendo Entertainment System for Christmas, and I was thrilled! While I loved playing Super Mario Bros. and Double Dragon, somewhere along the way, I began to wonder how video games and computers worked. Unfortunately, my Nintendo game console didn’t provide me with many clues as to what was going on inside it.

Around the same time, my family bought our first “real” computer, an Apple IIGS, opening new doors for me to explore exactly how these machines functioned. Fortunately, my middle school offered a class on BASIC programming of Apple II computers, and I soon learned that I couldn’t get enough of coding! I would write code at school, bring home a copy of my work on floppy disk, and continue working at home. Throughout middle school and high school, I learned more about programming, and I greatly enjoyed it. I also began to realize that although BASIC and other similar programming languages make it relatively easy to tell a computer what to do, they also hide many details of how computers work. I wanted to go deeper.

In college I studied electrical engineering, and I began to understand electronics and digital circuits. I took classes on C programming and assembly language, and I finally got glimpses of how computers execute instructions. The low-level details of how computers work were beginning to make sense. While in college, I also started learning about this new thing called the World Wide Web; I even crafted my very own web page (this seemed like a big deal at the time)! I began programming Windows applications, and I was introduced to Unix and Linux. These topics sometimes seemed far removed from the hardware-specific details of digital circuits and assembly language, and I was curious to understand how it all fit together.

After college I was fortunate to get a job at Microsoft. In my 17 years there, I worked in various software engineering roles, from debugging the Windows kernel to developing web applications. These experiences helped me gain a broader and deeper understanding of computers. I worked with many incredibly smart and knowledgeable people, and I learned that there’s always more to learn about computing. Understanding how computers work has been a lifelong journey for me, and I hope to pass on some of what I’ve learned to you through this book.