Hints for Computer System Design

Key Insights

Caching

Store $[f, x, f(x)]$ tuples in a cache.

If $f$ isn't a pure function, invalidate with the following:

$$ f(x + \Delta) = g(x, \Delta, f(x)) $$

For example, $x$ is an int[], $\Delta$ is a write $(i, v)$, and $f$ is a function int sum(int[] x). Then $g(x, \Delta, f(x))$ is f(x) + v - x[i].

Caches should ideally have adaptive sizes.

A classic example is the caching in hardware that uses $[Fetch, \text{address}, \text{content of address}]$ tuples. Similarly, virtual memory uses $[Page, \text{address}, \text{content of address}]$ tuples.

However, more complicated applications of caching exist. In real-time systems, you're often trying to cache the state of a system given small changes corresponding to events. The key here is to try and invalidate as few entries as possible in response to events.

Lecture Review Notes

Why is system design hard?

Throw one away

Interface Design

Conflicting requirements: - Simple - Complete - Efficient

In a way it's a lot like PL design; exposing new abstractions, objects and operations, manipulating them, etc.

KISS; Do one thing at a time and do it well.

Implementation

Plan to throw one away - learn from prototyping

Keep secrets - impl details hidden from clients. Can be tradeoff for performance optimizations

Handle normal and worst cases separately

Efficiency

Reliability

Takeaways

Further Reading