Title: Hints for Computer System Design
1Hints for Computer System Design
2Butler Lampson - Background
- Founding member of Xerox PARC (1970), DEC
(1980s), MSR (current) - ACM Turing Award (1992)
- Laser printer design
- PC
- Two-phase commit protocols
- Bravo, the first WYSIWYG text formatting program
- Ethernet, the first high-speed LAN
3System Design Introduction
- complex act
- less precisely defined, changing requirements
- Choices
- Affects future choices
- Affects system-wide performance
- But how?
4System Design Introduction
- Other reasons its so hard
- Moores law
- OSs dont improve by a factor of 100 every decade
- Backward compatibility
- OSs are fundamentally different than standard
apps. - Extremely large programs
- UNIX 30 Million lines of code
- Windows Vista 50 million lines of code
- OSs have to deal with potentially hostile users
at same time allow users to share information
5System Design Introduction
- Even more reasons its so hard
- OSs live for a very long time
- UNIX is over a quarter of a century old
- Must prepare for hardware/software changes
- OS designers do not have a good idea how their
systems will ultimately be used - Email web browsers came after UNIX
- OSs have to run on multiple hardware platforms
- OSs frequently have to be backward compatible
6System Design The Slogans
7Functionality The Interface
- Interface separates implementation of some
abstraction from clients using the abstraction - Eg File (open, read, write, close)
- Desirable properties
- Simple
- Complete
- Admit small and fast implementation
8Keep It Simple
- Do one thing at a time, and do it well
- Example PL/1compiler
- Early implementation is slow and inefficient
- For compiler optimization, it takes 15 years
9Keep It Simple
- too much large, slow and complicated
implementation - Should have predictable (reasonable) cost.
- Avoid features needed by only a few clients
10Example
- Tenex System
- reference to an unassigned page -gt trap to user
program - arguments to sys calls passed by reference
- CONNECT(string passwd) -gt if passwd wrong, fails
after a 3 second delay - CONNECT
- for i 0 to Length(directoryPassword) do
- if directoryPasswordi ! passwordArgumenti
then - Wait three seconds return BadPassword
- end if
- end loop
- connect to directory return Success
11Breaking CONNECT(string passwd)
Unassigned Page
Assigned Page
A
B
Bad Passwd
Invalid page
12Breaking CONNECT(string passwd)
Worst case 64n tries as opposed to 128n/2
tries n passwd length (bytes)
Unassigned Page
Assigned Page
B
A
Z
Bad Passwd
Invalid page
13Functionality The Interface
- Get it right
- eg FindIthField O(n), FindNamedfield O(n2)
- Make it fast rather than general or powerful
- RISC machine
- Dont hide power
- Virtualization virtual hardware exposed is
functionally identical to the underlying hardware - Exokernel the high-performance of the hardware
is just exported to the user
14Functionality The Interface
- Use procedure arguments to provide flexibility in
an interface - Leave it to the client
- Monitors locking signaling mechanisms do very
little, leaving all the real work to the client - Keep basic interfaces stable
- Keep a place to stand if you must change
interfaces (backward compatibility) - Emulation library microkernels emulate
interfaces by trap redirection - Virtualization VMM multiplexing at the
granularity of an operating system
15Functionality Implementation
- Plan to throw one away
- Keep secrets of the implementation
- Virtualization
- Hide the messy stuff like NUMA
- Monitors
- Allow access only at certain entry points
- Use a good idea again instead of generalizing it
- Divide and Conquer
- Dover laser printer
16Functionality Completeness
- Handle normal and worst case separately
- The normal case must be fast
- The worst case must make progress
- Caches and hints
- Sometimes radically different strategies are
appropriate in the normal and worst cases.
17Speed Interface
- Split resources in a fixed way if in doubt
- I/O channel. Floating-point coprocessors
- VMM Multiplexing resources
- Guest OSs arent even aware that theyre sharing
- Use static analysis
- Discover properties of the program that can
usually be used to improve its performance - Dynamic Translation
- Smalltalk uses the bytecodes and a cache to store
translated code.
18Speed Implementation
- Cache Answers to expensive computations
- Use hints
- The Ethernet exponential backoff
- Links in web pages
- When in doubt use brute force
- Compute in background
- Use batch processing
- Cleanup in log structured file systems segment
cleaning could be scheduled at nighttime.
19Speed Completeness
- Shed load to control demand
- SEDA
- Adaptive load shedding
- Apache
- Bounded thread pool
- Safety First
- When allocating resources remember safety first
- Avoid temptation to try to obtain optimum
performance (instead try to avoid disaster) - Progression of kernel structuring approaches for
extensibility - Microkernels, sandboxing, SPIN vs. Mach (some
versions) Chorus
20Fault-tolerance
- End-to-end
- Error recovery at the application level is
absolutely necessary - Log updates
- Logs can be reliably written/read
- Logs can be cheaply forced out to disk, which can
survive a crash - Log structured file systems
- Make actions atomic or restartable
- Transaction processing system
- Database systems have provided atomicity
21System Design Conclusion
- Just remember
- Designing an OS starts with determining what it
should do - The interface should be simple, complete,
efficient - There probably isnt a best solution for even
one part of any system - Just dont choose a terrible solution
- Have a clear division of responsibility among the
parts
22System Design Quotes
- Perfection is reached not when there is no
longer anything to add, but when there is no
longer anything to take away - --A. Saint-Exupery
- The unavoidable price of reliability is
simplicity. - --C. Hoare
23System Design References
- Jon Walpole
- Hints for Computer System Design Lampson.
- Modern Operating Systems, Second Edition.
Tannenbaum, pp. 855-894. - http//c2.com/cgi/wiki?SpiralModel
- http//www.dpw.wau.nl/pv/temp/clipart/
- http//firstmonday.org/issues/issue7_11/tuomi/