An approachable, hands-on guide to understanding how computers work, from low-level circuits to high-level code.
How Computers Really Work is a hands-on guide to the computing ecosystem: everything from circuits to memory and clock signals, machine code, programming languages, operating systems, and the internet.
But you won't just read about these concepts, you'll test your knowledge with exercises, and practice what you learn with 41 optional hands-on projects. Build digital circuits, craft a guessing game, convert decimal numbers to binary, examine virtual memory usage, run your own web server, and more.
Explore concepts like how to:
• Think like a software engineer as you use data to describe a real world concept
• Use Ohm's and Kirchhoff's laws to analyze an electrical circuit
• Think like a computer as you practice binary addition and execute a program in your mind, step-by-step
The book's projects will have you translate your learning into action, as you:
• Learn how to use a multimeter to measure resistance, current, and voltage
• Build a half adder to see how logical operations in hardware can be combined to perform useful functions
• Write a program in assembly language, then examine the resulting machine code
• Learn to use a debugger, disassemble code, and hack a program to change its behavior without changing the source code
• Use a port scanner to see which internet ports your computer has open
• Run your own server and get a solid crash course on how the web works
And since a picture is worth a thousand bytes, chapters are filled with detailed diagrams and illustrations to help clarify technical complexities.
Requirements: The projects require a variety of hardware - electronics projects need a breadboard, power supply, and various circuit components; software projects are performed on a Raspberry Pi. Appendix B contains a complete list. Even if you skip the projects, the book's major concepts are clearly presented in the main text.
Author(s): Matthew Justice
Edition: 1
Publisher: No Starch Press
Year: 2020
Language: English
Commentary: Vector PDF
Pages: 380
City: San Francisco, CA
Tags: Python; Hardware; Assembly Language; Raspberry Pi; C; Do-It-Yourself; Digital Electronics; Elementary
Contents in Detail
Acknowledgments
Introduction
Who Is This Book For?
About This Book
About Exercises and Projects
My Computing Journey
Chapter 1: Computing Concepts
Defining a Computer
Analog and Digital
The Analog Approach
Going Digital
Number Systems
Decimal Numbers
Binary Numbers
Bits and Bytes
Prefixes
Hexadecimal
SI Prefixes for Binary Data
Summary
Chapter 2: Binary in Action
Representing Data Digitally
Digital Text
ASCII
Digital Colors and Images
Interpreting Binary Data
Approaches for Representing Colors and Images
Binary Logic
Summary
Chapter 3: Electrical Circuits
Electrical Terms Defined
Electric Charge
Electric Current
Voltage
Resistance
Water Analogy
Ohm’s Law
Circuit Diagrams
AC and DC
Kirchhoff’s Voltage Law
Circuits in the Real World
Light-Emitting Diodes
Summary
Project #1: Build and Measure a Circuit
Project #2: Build a Simple LED Circuit
Chapter 4: Digital Circuits
What Is a Digital Circuit?
Logic with Mechanical Switches
The Amazing Transistor
Logic Gates
Exercise 4-1: Design a Logical OR with Transistors
Designing with Logic Gates
Exercise 4-2: Design a Circuit with Logic Gates
Integrated Circuits
Summary
Project #3: Build Logical Operators (AND, OR) with Transistors
Project #4: Construct a Circuit with Logic Gates
Chapter 5: Math with Digital Circuits
Binary Addition
Exercise 5-1: Practice Binary Addition
Half Adders
Full Adders
A 4-bit Adder
Signed Numbers
Exercise 5-2: Find the Two’s Complement
Two’s Complement Terminology
Unsigned Numbers
Summary
Exercise 5-3: Add Two Binary Numbers and Interpret as Signed and Unsigned
Project #5: Build a Half Adder
Chapter 6: Memory and Clock Signals
Sequential Logic Circuits and Memory
The SR Latch
Using the SR Latch in a Circuit
Universal Logic Gates
Clock Signals
JK Flip-Flops
T Flip-Flops
Using a Clock in a 3-Bit Counter
Summary
Project #6: Construct an SR Latch Using NOR Gates
Project #7: Construct a Basic Vending Machine Circuit
Project #8: Add a Delayed Reset to the Vending Machine Circuit
Project #9: Using a Latch as a Manual Clock
Project #10: Test a JK Flip-Flop
Project #11: Construct a 3-bit Counter
Chapter 7: Computer Hardware
Computer Hardware Overview
Main Memory
Exercise 7-1: Calculate the Required Number of Bits
Central Processing Unit (CPU)
Instruction Set Architectures
CPU Internals
Clock, Cores, and Cache
Beyond Memory and Processor
Secondary Storage
Input/Output
Exercise 7-2: Get to Know the Hardware Devices in Your Life
Bus Communication
Summary
8
Machine Code and Assembly Language
Software Terms Defined
An Example Machine Instruction
Calculating a Factorial in Machine Code
Branching and the Status Register
Exercise 8-1: Use Your Brain as a CPU
Summary
Project #12: Factorial in Assembly
Project #13: Examining Machine Code
Chapter 9: High-Level Programming
High-Level Programming Overview
Introduction to C and Python
Comments
Variables
Variables in C
Variables in Python
Stack and Heap Memory
The Stack
The Heap
Math
Logic
Bitwise Operators
Exercise 9-1: Bitwise Operators
Boolean Operators
Program Flow
If Statements
Looping
Functions
Defining Functions
Calling Functions
Using Libraries
Object-Oriented Programming
Compiled or Interpreted
Calculating a Factorial in C
Exercise 9-2: Run a C Program in Your Mind
Summary
Project #14: Examine Variables
Project #15: Change the Type of Value Referenced by a Variable in Python
Project #16: Stack or Heap
Project #17: Write a Guessing Game
Project #18: Use a Bank Account Class in Python
Project #19: Factorial in C
Chapter 10: Operating Systems
Programming Without an Operating System
Operating Systems Overview
Operating System Families
Kernel Mode and User Mode
Exercise 10-1: Get to Know the Operating Systems in Your Life
Kernel Mode Components in Windows
Processes
Threads
Physical and Logical Cores
Virtual Memory
Application Programming Interface (API)
The User Mode Bubble and System Calls
APIs and System Calls
Operating System Software Libraries
Windows Subsystem for Linux
Application Binary Interface
Device Drivers
Filesystems
Services and Daemons
Security
Summary
Project #20: Examine Running Processes
Project #21: Create a Thread and Observe It
Project #22: Examine Virtual Memory
Project #23: Try the Operating System API
Project #24: Observe System Calls
Project #25: Use glibc
Project #26: View Loaded Kernel Modules
Project #27: Examine Storage Devices and FileSystems
Project #28: View Services
Chapter 11: The Internet
Networking Terms Defined
The Internet Protocol Suite
OSI—Another Network Model
Link Layer
Internet Layer
Exercise 11-1: Which IPs Are on the Same Subnet?
Transport Layer
Exercise 11-2: Research Common Ports
Application Layer
A Trip Through the Internet
Foundational Internet Capabilities
Dynamic Host Configuration Protocol
Private IP Addresses and Network Address Translation
The Domain Name System
Networking Is Computing
Summary
Project #29: Examine the Link Layer
Project #30: Examine the Internet Layer
Project #31: Examine Port Usage
Project #32: Trace the Route to a Host on the Internet
Project #33: See Your Leased IP Address
Project #34: Is Your Device’s IP Public or Private?
Project #35: Find Information in DNS
Chapter 12: The World Wide Web
Overview of the World Wide Web
The Distributed Web
The Addressable Web
Exercise 12-1: Identify the Parts of a URL
The Linked Web
The Protocols of the Web
The Searchable Web
The Languages of the Web
Structuring the Web with HTML
Styling the Web with CSS
Scripting the Web with JavaScript
Structuring the Web’s Data with JSON and XML
Web Browsers
Rendering a Page
The User Agent String
Web Servers
Summary
Project #36: Examine HTTP Traffic
Project #37: Run Your Own Web Server
Project #38: Return HTML from Your Web Server
Project #39: Add CSS to Your Website
Project #40: Add JavaScript to Your Website
Chapter 13: Modern Computing
Apps
Native Apps
Web Apps
Virtualization and Emulation
Virtualization
Emulation
Process Virtual Machines
Cloud Computing
The History of Remote Computing
The Categories of Cloud Computing
The Deep Web and Dark Web
Bitcoin
Bitcoin Basics
Bitcoin Wallets
Bitcoin Transactions
Bitcoin Mining
Bitcoin Beginnings
Virtual Reality and Augmented Reality
The Internet of Things
Summary
Project #41: Final Project
Appendix A: Answers to Exercises
Chapter 3: Electrical Circuits
3-1: Using Ohm’s Law
3-2: Find the Voltage Drops
Chapter 4: Digital Circuits
4-1: Design a Logical OR with Transistors
4-2: Design a Circuit with Logic Gates
Chapter 5: Math with Digital Circuits
5-1: Practice Binary Addition
5-2: Find the Two’s Complement
5-3: Add Two Binary Numbers and Interpret as Signed and Unsigned
Chapter 7: Computer Hardware
7-1: Calculate the Required Number of Bits
Chapter 8: Machine Code and Assembly Language
8-1: Use Your Brain as a CPU
Chapter 9: High-Level Programming
9-1: Bitwise Operators
9-2: Run a C Program in Your Mind
Chapter 11: The Internet
11-1: Which IPs Are on the Same Subnet?
11-2: Research Common Ports
Chapter 12: The World Wide Web
12-1: Identify the Parts of a URL
1-2: Binary to Decimal
1-3: Decimal to Binary
1-4: Binary to Hexadecimal
1-5: Hexadecimal to Binary
2-1: Create Your Own System for Representing Text
2-2: Encode and Decode ASCII
2-3: Create Your Own System for Representing Grayscale
2-4: Create Your Own Approach for Representing Simple Images
2-5: Write a Truth Table for a Logical Expression
Appendix B: Resources
Buying Electronic Components for the Projects
7400 Part Numbers
Shopping
Powering Digital Circuits
USB Charger
Breadboard Power Supply
Power from a Raspberry Pi
AA Batteries
Troubleshooting Circuits
Raspberry Pi
Why Raspberry Pi
Parts Needed
Setting Up a Raspberry Pi
Using Raspberry Pi OS
Working with Files and Folders
Index
Blank Page