跳到主要内容

13 Introduction to Computer Systems

What Is a Computer System?

A computer system is a collection of hardware and software components that work together to provide computation, storage, and communication.

Examples of Computer Systems

  • Operating Systems: macOS, Linux, Windows
  • Distributed Systems: Search engines, online stores
  • Network Systems: The Internet
  • Database Systems: MySQL, MongoDB, Neo4j
  • Programming Languages & Compilers: C, C++, Python, SQL, TensorFlow

System Building as a First-Class Activity

Building real systems is:

  • Intellectually challenging
  • Highly impactful
  • A core part of computer science research

Why Is It Hard to Build Systems?

Complexity

Systems become hard because:

  • Many components interact
  • Scale increases rapidly
  • Small changes may cause large effects

Example:

  • Gas molecules → pressure & temperature
  • Individual servers → cloud system properties (consistency, fault tolerance)

Scale of Computer Systems

LevelScale
CodeHundreds → Millions of LOC
CPU1 core → Hundreds
Network2 nodes → Millions
Web ServicesTens → Millions of users

Sources of Complexity

Emergent Properties

  • Properties not visible in individual components
  • Appear only after integration

Example:

  • Ethernet minimum packet size is an emergent property

Propagation of Effects

  • Small change → big system-wide effect

Examples:

  • DDT mosquito control → plague outbreak
  • Distributed file systems: failure recovery → overload

Incommensurate Scaling

  • Different parts of a system scale differently
  • What works at small scale may fail at large scale

Example:

  • Internet routing tables scale as
O(n2)\begin{equation*} O(n^2) \end{equation*}

Trade-offs (Waterbed Effect)

  • Improving one metric worsens another

Example:

  • Higher throughput → higher latency

Coping with Complexity (M.A.L.H.)

A classic framework:

Modularity

  • Divide system into modules
  • Reduce reasoning scope
  • Enable divide-and-conquer

Abstraction

  • Separate interface from implementation
  • Hide internal details

Examples:

  • Functions
  • Objects
  • Virtual machines
  • Instruction Set Architecture (ISA)

Layering

  • Build systems layer by layer
  • Each layer only interacts with adjacent layers

Examples:

  • OSI / TCP-IP network stack
  • Hardware → OS → Applications

Hierarchy

  • Organize modules into trees
  • Reduce coordination complexity

Example: Managers managing managers (organizational analogy)

Abstraction in Practice

Instruction Set Architecture (ISA)

  • Defines how software interacts with hardware
  • Separates:
    • What programmers see
    • How hardware is implemented

Performance Optimization Example

Matrix Multiplication

  • Naive implementation → poor cache usage
  • Blocked version → better locality

Optimization Techniques

  • Tiling
  • SIMD / Vectorization
  • Parallelization (OpenMP)
  • Loop fusion

Why Computer Systems Are Special

Similarities

  • Share complexity issues with other systems
  • Use universal design principles

Differences

  • Mostly digital
  • Software-controlled
  • Not strongly limited by physical laws
  • Extremely fast technology evolution

Key Design Philosophy

Design for Iteration

  • Expect change
  • Make systems easy to evolve
  • Prefer agile over rigid waterfall models