31
Hints for Computer System Design Paper by B. W. Lampson Presentation by Emerson Murphy-Hill

Hints for Computer System Design

  • Upload
    atalo

  • View
    52

  • Download
    0

Embed Size (px)

DESCRIPTION

Paper by B. W. Lampson Presentation by Emerson Murphy-Hill. Hints for Computer System Design. Some Background. B.W. Lampson – same guy who wrote “Experience with Processes and Monitors in Mesa” Currently at Microsoft - PowerPoint PPT Presentation

Citation preview

Page 1: Hints for Computer System Design

Hints for Computer System Design

Paper by B. W. Lampson

Presentation by Emerson Murphy-Hill

Page 2: Hints for Computer System Design

Some Background

• B.W. Lampson – same guy who wrote “Experience with Processes and Monitors in Mesa”

• Currently at Microsoft• Worked on hardware, operating

systems, programming environments, and applications

• Here he presents a laundry list of folk wisdom for system design

Page 3: Hints for Computer System Design

<Advice>

• <Short Explanation>• <Example>

• 26 Pieces of Advice

Page 4: Hints for Computer System Design

Separate Normal and Worst Case

• Normal case must be fast, but worst case must still work

• Specialization. Special code generated for best case, “replugging” for worst case

Page 5: Hints for Computer System Design

Do One Thing At a Time, Well• Capture the minimum possible

interface, deliver what the interface promised, don’t promise too much

• Exokernel. The minimum possible abstraction, only promises resource protection.

Page 6: Hints for Computer System Design

Don’t Generalize

• Don’t try to anticipate all possible uses of interface (no general implementation)

• Microkernels. Interface built generally, but few assumptions made about implementation

Page 7: Hints for Computer System Design

Get It Right

As Dick Cheney would say, this is “non-actionable intelligence” and fall into the class of “known unknowns”

Abstraction does not imply correctness

Page 8: Hints for Computer System Design

Don’t Hide Power

• When low level is high performance, don’t mask it in abstraction

• Scheduler Activations. Rather than kernel multiplexing threads across processors, have user space decide how to allocate a processor

Page 9: Hints for Computer System Design

Use Procedure Arguments

• Pass code as a parameter

• Asynchronous I/O. Function callback used as parameter, rather than doing some sort of generic lookup upon return.

Page 10: Hints for Computer System Design

Leave it to the Client

• Attain flexibility and performance by “doing one thing,” letting the client do the rest

• Monitors. Provide synchronization as a language-level construct, but leave protecting resources to client

Page 11: Hints for Computer System Design

Keep Basic Interfaces Stable

• Avoid changing the interface out from under client

• Trampoline. To maintain Linux binary compatibility, sys calls are trampoline’d into user space event handler

Page 12: Hints for Computer System Design

Keep a Place to Stand

• If you have to change the interface, keep backward compatibility

• Virtual Machines. Rather than building OS on top of raw hardware, building on top of virtual machine allows VM implementation to be changed

Page 13: Hints for Computer System Design

Plan to Throw One Away

• Throw away the first version of the system, and start over

• Interestingly, we didn’t see an example of this. Some of the most worthwhile research papers are systems have failed

Page 14: Hints for Computer System Design

Keep Secrets

• In other words, encapsulation.

• Layers. Each layer contains state that is private from other layers.

Page 15: Hints for Computer System Design

Use Good Design Again

• Rather than being general, use a good idea multiple times

• Variations on Cache. TLB, L1+L2, virtual memory, file system cache, disk controller, hierarchical RAID…

Page 16: Hints for Computer System Design

Divided and Conquer

• Take a complex problem and split it up into easier ones

• Threading. A number of threads can be used to do a number of subtasks.

Page 17: Hints for Computer System Design

Shed Load

• Don’t try to handle all requests, eliminate some

• Web servers. Rather than try to serve all requests, deny some. Apache does this by putting an upper limit on number of threads

Page 18: Hints for Computer System Design

Safety First

• Avoid disaster over attaining optimal results

• High level languages. Programmer doesn’t have to worry about type safety and array bounds checking, for example (at a performance cost)

Page 19: Hints for Computer System Design

Split Resources

• Divide up resources, rather than scheduling them.

• Scheduler Activations. Rather than multiplexing across processors, have one user level thread per processor.

Page 20: Hints for Computer System Design

Static Analysis

• Analyze code without running it, wherever possible

• Deadlock/Race detection (Sun’s lock_lint). As we have seen dynamic race detection is dependent on system entering all states.

Page 21: Hints for Computer System Design

Dynamic Translation

• Translate/compile code when needed

• Packet filtering / collocation (Exokernel). Code is interpreted in kernel when needed (runtime) to run in kernel-mode.

Page 22: Hints for Computer System Design

Cache Answers

• Don’t recompute or fetch, when possible

• Virtual memory. Acts as a cache to hold frequently used pieces of memory.

Page 23: Hints for Computer System Design

Use Hints

• System may provide a hint as to desired results, or where desired results may be found

• URPC. Calling process will provide a hint to the kernel as to where its processor should next be allocated (server)

Page 24: Hints for Computer System Design

Use Brute Force

• If an elegant solution is not possible, fall back on a long calculation

• Specialization/RPC variants. Both do something clever when possible, but do the standard thing when not possible

Page 25: Hints for Computer System Design

Compute In Background

• If work is not immediately necessary, do it during downtime

• Cleanup in log-based file systems. Segment cleaning could be scheduled for nighttime.

Page 26: Hints for Computer System Design

Batch Processing

• Amortize cost by doing a bunch of operations at once

• Page Protection. In VMM systems, we’ve seen that protecting/unprotecting multiple pages is faster

Page 27: Hints for Computer System Design

End-to-end

• Error detection and recovery is not strictly necessary at all levels, but only for performance.

• Layers. Error detection could be handled at any layer… really depends on the application

Page 28: Hints for Computer System Design

Log Updates

• Periodically record and backup the state of a system, and be able to recover

• Log-based file systems. RAID 5 in Elephant, too.

Page 29: Hints for Computer System Design

Make Actions Atomic

• Either have operations complete or fail without residue

• RCU. Changes are seen as atomic to all processes.

Page 30: Hints for Computer System Design

Summary

• Make it simple• Do one thing well• Easiest thing possible• Delegate work• Tackle one aspect only• Be consistent

Page 31: Hints for Computer System Design

References

• http://research.microsoft.com/~lampson/

• http://the-age-of-reason.blogspot.com/2004_06_20_the-age-of-reason_archive.html