Skip to content
Tutorials Center
My learning

Topics

Lesson 55 of 55 ยท Practice and Review

Computer Fundamentals Cheat Sheet

A one-page computer fundamentals cheat sheet: data units, powers of two, number conversions, latency numbers, OS and network layers, ports, status codes.

This page is a reference you can keep open in a second tab. It gathers the numbers and tables that the rest of the course explains: data units, powers of two, number conversions, typical latencies, operating system and network layers, common port numbers and status codes. Each section links back to the lesson with the full explanation.

Two things to remember before you use the figures. First, the latency and speed numbers are typical orders of magnitude, rounded for teaching; real products differ by a wide margin. Second, the two editors near the end are stand-ins that run in your browser to print tables and conversions; they do not touch any real hardware.

Data units

See Bits and Bytes.

Unit Decimal (SI) Binary (IEC) Exact binary size
Kilo KB = 1,000 B KiB 1,024 B
Mega MB = 1,000,000 B MiB 1,048,576 B
Giga GB = 10^9 B GiB 1,073,741,824 B
Tera TB = 10^12 B TiB 1,099,511,627,776 B
  • 1 byte (B) = 8 bits (b). A nibble is 4 bits.
  • Network speeds are in bits per second: divide by 8 for bytes per second (100 Mbps is at most 12.5 MB/s).
  • A "1 TB" drive is 10^12 bytes, about 931 GiB.

Powers of two

Power Value Where you meet it
2^8 256 values in one byte
2^10 1,024 1 KiB
2^16 65,536 port numbers, 16-bit values
2^20 1,048,576 1 MiB
2^24 16,777,216 24-bit RGB colors
2^30 1,073,741,824 1 GiB
2^32 4,294,967,296 IPv4 addresses, 4 GiB address space
2^64 18,446,744,073,709,551,616 64-bit values

Integer ranges (two's complement for signed types):

Width Unsigned Signed
8 bits 0 to 255 -128 to 127
16 bits 0 to 65,535 -32,768 to 32,767
32 bits 0 to 4,294,967,295 -2,147,483,648 to 2,147,483,647

Number systems

See Binary, Octal and Hexadecimal.

Decimal Binary Hex Decimal Binary Hex
0 0000 0 8 1000 8
1 0001 1 9 1001 9
2 0010 2 10 1010 A
3 0011 3 11 1011 B
4 0100 4 12 1100 C
5 0101 5 13 1101 D
6 0110 6 14 1110 E
7 0111 7 15 1111 F
  • Binary to decimal: add the place values (128, 64, 32, 16, 8, 4, 2, 1) of the 1 bits.
  • Decimal to binary: divide by 2 repeatedly and read the remainders from bottom to top.
  • Binary to hex: group bits in fours from the right; one group is one hex digit.
  • Two's complement negation: invert all bits, then add 1.
  • Text: ASCII uses 7 bits; UTF-8 uses 1 to 4 bytes per code point and is ASCII-compatible.

Typical speeds and latencies

See The CPU, Memory: RAM, Cache and the Memory Hierarchy and Storage: HDD, SSD and Beyond.

Operation Typical time Compared with 1 ns
One CPU cycle at 3 GHz about 0.3 ns
L1 cache access about 1 ns 1x
L2 cache access a few ns several x
L3 cache access 10 to 40 ns tens of x
Main memory (RAM) access about 100 ns 100x
SSD random read tens to 100 microseconds 10,000x to 100,000x
Hard disk seek 5 to 10 milliseconds millions of x
Round trip inside one data center about 0.5 ms
Round trip across a continent roughly 50 to 100 ms
Round trip across an ocean roughly 100 to 200 ms

The pattern to remember: each step away from the CPU is about 10 to 100 times slower and much bigger. The hierarchy runs registers, cache, RAM, SSD, hard disk, network.

Operating system summary

See What an Operating System Does, Processes, Threads and Scheduling, Memory Management and File Systems.

Concept One line
Kernel Privileged core: schedules CPU, manages memory, devices, files
System call Program's request to the kernel (read, write, open, fork)
Process A running program with its own address space
Thread Execution path inside a process; shares the process's memory
Context switch Save one task's state, load another's
Scheduler Chooses which ready task runs next (for example round-robin)
Deadlock Tasks wait on each other in a cycle
Virtual memory Per-process address space mapped to RAM in pages
Page fault Access to a page that is not in RAM yet
Inode File metadata record (not the name) on Unix-style file systems
Boot order Firmware, boot loader, kernel, services, login

Unix permission digits add read 4, write 2 and execute 1: 754 is rwxr-xr--.

Network layers

See Networking Basics.

flowchart TB
  A["Application<br/>HTTP, DNS, SMTP"] --> T["Transport<br/>TCP, UDP (ports)"]
  T --> I["Internet<br/>IP (addresses, routing)"]
  I --> L["Link<br/>Ethernet, Wi-Fi (MAC)"]

The four-layer TCP/IP view: each layer wraps the data of the layer above.

Layer Job Examples Unit
Application Meaning of the conversation HTTP, DNS, SMTP, SSH message
Transport Delivery between programs TCP (reliable), UDP (fast) segment / datagram
Internet Delivery between networks IPv4, IPv6, routers packet
Link Delivery on one local network Ethernet, Wi-Fi, switches frame

Quick facts: IPv4 addresses have 32 bits and IPv6 has 128. A /n network leaves 32 - n host bits; usable hosts are 2^(32-n) - 2. Switches forward by MAC address, routers by IP address.

Common port numbers

See The Internet, IP Addresses and DNS.

Port Protocol Port Protocol
22 SSH 25 SMTP (server to server)
53 DNS (UDP and TCP) 80 HTTP
110 POP3 143 IMAP
443 HTTPS 587 SMTP submission
993 IMAP over TLS 3306 MySQL
3389 Remote Desktop 5432 PostgreSQL
6379 Redis 27017 MongoDB

HTTP status codes

See How the Web Works.

Range Meaning Common codes
1xx Informational 101 Switching Protocols
2xx Success 200 OK, 201 Created, 204 No Content
3xx Redirect 301 Moved Permanently, 302 Found, 304 Not Modified
4xx Client error 400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found, 429 Too Many Requests
5xx Server error 500 Internal Server Error, 502 Bad Gateway, 503 Service Unavailable

Security and backup reminders

See Passwords, Hashing and Encryption and Backups and Data Recovery.

  • Hash: one-way, fixed length. Encryption: reversible with a key.
  • Store passwords with a salt and a slow hash (scrypt, bcrypt, Argon2), never in plain text.
  • Use a password manager and two-factor authentication.
  • 3-2-1 backups: three copies, two media types, one off-site. Test restores.

Try it

The first editor prints conversions you can adapt, using the built-in number methods of JavaScript. It is a stand-in calculator running in your browser.

JS Number conversion helper

Press Run (or Ctrl + Enter) to see the console output here.

No output.

The second prints the powers of two and the matching byte-unit names.

JS Powers of two table

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. How many usable host addresses does an IPv4 /24 network have?

    A /24 leaves 8 host bits: 256 addresses, minus the network and broadcast addresses gives 254.
  2. 2. Which storage access is typically the slowest?

    A hard disk seek takes milliseconds because a read head must move, which is far slower than flash, RAM or cache.
  3. 3. Which port does HTTPS normally use?

    HTTPS uses TCP port 443; port 80 is plain HTTP, 22 is SSH and 25 is SMTP.
  4. 4. What is the 8-bit two's complement pattern of -1?

    Invert 00000001 to get 11111110, then add 1 to get 11111111.

Summary

  • Decimal units step by 1,000, binary units by 1,024; bits are lowercase b, bytes uppercase B.
  • Memorize the powers of two from 2^8 to 2^32; they explain most limits.
  • Hex digits map to four bits each; negation in two's complement means invert and add 1.
  • Each memory and storage level is roughly 10 to 100 times slower than the one above it.
  • Know the layers: application, transport, internet, link; and the common ports and status code ranges.
  • Safe habits: salted slow hashes, two-factor authentication and tested 3-2-1 backups.

You can return to the start of the course with What Is a Computer?, or test yourself with the hardware and data exercises.