420 likes | 445 Views
Introduction to Physics Computing. MT 2013 Lecture 3 J Tseng. Some reminders. While we encourage you to work on CO01/2 at home, don’t procrastinate Learning by doing means putting in the time
E N D
Introduction toPhysics Computing MT 2013 Lecture 3 J Tseng
Some reminders • While we encourage you to work on CO01/2 at home, don’t procrastinate • Learning by doing means putting in the time • To keep on top of things, you should be done with CO01 after your 2nd or 3rd time in lab (week 4 for some, week 7 for others) • Otherwise you’ll be working without help over the Christmas vacation • Use the practical lab sessions wisely Introduction to Physics Computing (Tseng)
Outline • Computing: a physicist’s perspective • Logic behind computing • Abstraction and control of complexity • Physics impinging on computing • Limits to abstraction/control Introduction to Physics Computing (Tseng)
Electronic computers Introduction to Physics Computing (Tseng)
Electronic computers (2) • Time-ordered electrical signals in response to electrical inputs Introduction to Physics Computing (Tseng)
Electronic computers (3) • How to get from basic electric signals to3D gaming? Minecraftmuseum.net Freecodesource.com Introduction to Physics Computing (Tseng)
Digital electronics • Reduce range of voltages and currents to simple “on” and “off”, for example • Off: < 0.3V • On: > 2.0V • Less sensitive to physics • Near instantaneous signal propagation over relevant distances (this is an issue in high-speed networks) • Resistance drops over wires • Digital “abstraction”: simplifies robust design Introduction to Physics Computing (Tseng)
Sequencer • Outputs a pre-programmed series of signals • Input: a clock or trigger • Often used to control a series of actions (triggered by outputs) output 01001011 11001010 11101001 00100100 Introduction to Physics Computing (Tseng)
Finite state machine input output state Introduction to Physics Computing (Tseng)
State diagram L A O F K E N B M G D P I C H J Introduction to Physics Computing (Tseng)
Example: First Public Examinations Simple two-exam Preliminary Exams Pass both • Inputs: • CP1 ≥ 40 • CP2 ≥ 40 Pass one Pass Partial pass switch state case before_exam … case partial_pass if pass state = passed else state = failed end case first_fail … otherwise disp(‘Illegal state’) end Fail Pass Pass none First fail Fail Introduction to Physics Computing (Tseng)
First Public Examination (2) 11 A E • “Partial pass” actually encompassed two states • Required passes dictated by state B or C • 6 states • 4 possible input values 01 1X B 0X 10 X1 11 C X0 F D 00 00|01|10 Introduction to Physics Computing (Tseng)
Finite state machine 326 Lookup table output input state Introduction to Physics Computing (Tseng)
FSM to computer 2568 Lookup table input output instructions (sequence) state memory Introduction to Physics Computing (Tseng)
Computer elements program processor input output memory Introduction to Physics Computing (Tseng)
Stored-program computer • “Von Neumann” architecture: program stored in memory • A program in memory is simply part of “state” processor input output memory Introduction to Physics Computing (Tseng)
Tinkertoys (1989) • Actually more a sequencer Introduction to Physics Computing (Tseng)
Modern computers Central processing unit (CPU) memory Introduction to Physics Computing (Tseng)
CPU Contains logic and instruction decoding The first μCPU: Intel 4004 Introduction to Physics Computing (Tseng)
CPU • Intel Pentium • Submicron geometry Introduction to Physics Computing (Tseng)
Computers for all seasons • Von Neumann computer is now so simple and cheap that we replicate it everywhere processor input output memory Introduction to Physics Computing (Tseng)
Computers for all seasons (2) • Peripherals are themselves smaller von Neumann machines input processor output proc input output mem Video controller Sound driver Printer Network interface Keyboard Mouse CD drive Network interface memory Reflective memory Virtual memory Introduction to Physics Computing (Tseng)
Computers for all seasons (3) • Peripheral design is now much simpler: stored-program computer + software • Fewer specially designed components • More modular design • Graphical Processing Units (GPU’s) are now so common and capable that some scientists are using them instead of the CPU • Not for generic computing – difficult to program, breaks von Neuman model • Modern machines often use computers to optimise their performance • Use more environmental inputs from sensors • Easier (and perhaps faster) than traditional mechanical or chemical means • Auto shops used to use wrenches a lot; now they use computer terminals Introduction to Physics Computing (Tseng)
Single-chip computer • Motorola 68332 • CPU, memory, I/O functions • Often used in peripherals, control apps Introduction to Physics Computing (Tseng)
Program execution • A program must ultimately turn into a predictable pattern of electrical (for now) signals • Computers often use low-level “operation codes” • Programmers typically write something they can read • Abstraction comes at a cost • Greater memory consumption • Slower execution • However: write robust, correct code more quickly • The translation of high-level to low-level code is itself a mechanical process • computers help program themselves (“compilation”) • Computer scientists have noticed they use certain structures over and over again: these patterns are often seen in new high-level programming languages Introduction to Physics Computing (Tseng)
Programming languages Where we used to be • Different traditions and models, often depending on original application • “Every programmer knows there is one true programming language. A new one every week.” • B Hayes, “The Semicolon Wars”, American Scientist, July/Aug 2006 Matlab Printers/graphics Where we are web Matlab Introduction to Physics Computing (Tseng)
Interpreters • Alternative to compilation: program computer to interpret human-readable input • Usual Matlab operation • More common: compile to an intermediate form (“bytecodes”) which are then fed to a simple interpreter (p-System, Smalltalk and Java virtual machines) Introduction to Physics Computing (Tseng)
Interpretation and CPU’s • Modern Pentium: a legacy architecture emulated by a simpler CPU • Internal microcode • Much like microcontroller • Implementation more complex, optimised for performance • Preserves von Neumann model on the outside • Laid out by compiler even so (also a mechanical process) • Internal processing so fast that it mostly waits for memory Introduction to Physics Computing (Tseng)
Interpretation and CPU’s (2) • Transmeta CPU’s • Simple, elegant, low-power processor • Interprets Pentium operation codes • Compiles frequently-used code sections into native code for faster execution • Intel responded by cutting power consumption, optimising execution and I/O pipelines • Another example: HotSpot JVM progressively optimises code • Now a common strategy for modern languages: Java, Python, javascript… • Runtime compilation routinely matches and outperforms static compilation • “traffic analysis” also mechanical Introduction to Physics Computing (Tseng)
Operating systems • Recall that a program in memory is simply part of “state” until it is executed (i.e., treated like a program) • Loading and executing a program is itself a mechanical process suitable for a program – the operating system Introduction to Physics Computing (Tseng)
Operating systems (2) • In addition, manages the simultaneous execution of multiple programs: several users, peripherals, memory management, all sharing time on a single CPU • Maintain fiction of a simple stored-program computer • Now done with modern operating systems: Unix/Linux/Mac OSX, VMS, Windows ≥ NT your program • In addition: • Hide complexities of peripherals • Enable multiple users – modern computers are mostly idle Web browser Operating System hardware Introduction to Physics Computing (Tseng)
Operating systems (3) • Operating systems have enabled computers (and programmers) to take on increasingly sophisticated tasks: • Worry only about the simple computer abstraction • OS handles the simultaneous processes, devices • Computers handle time-ordered logic • Electronics translate logic into signals • These signals control keyboards, display screens, airplanes, space stations, toaster ovens Introduction to Physics Computing (Tseng)
Virtual computers • Finally, it is possible to emulate one computer within another computer • Many web servers implemented this way to increase utilisation, share resources, reduce power consumption User Software • Virtualization: VMWare, Xen • manages use of hardware by virtual computers • Emulation: QEMU, JPC • implements hardware entire in software • user software can’t tell the difference • open question: can emulating x86 on ARM save power? Guest OS other software Emulated hardware Emulator Host Operating System host hardware Introduction to Physics Computing (Tseng)
Simulating circuits • Matlab/SimuLink “powerlib” tool Introduction to Physics Computing (Tseng)
Power usage of computing • US EPA, 2006: data center power consumption in US is 1.5% total power • “power usage effectiveness”: power in data center not associated with computing – power distribution, cooling, etc. • Average ~100% • Google claims 6-13% with custom hardware • Slower data center power growth than initially feared • Physics behind“the Cloud” Introduction to Physics Computing (Tseng)
Mobile phones: increase battery life Computing with mobile phone processors Claim greater computing per watt Typically less computing per second Do you notice? x86 response: lower power consumption Remove functionality Reduce geometry Lower voltage thresholds Not just CPU: How much power wasted signalling to off-chip memory? Low-power computing 1993 PC (Octek Jaguar V) Galaxy SII Introduction to Physics Computing (Tseng)
Low-power computing (2) • Simplify to lower complexity, power consumption, size • Enables mobile computing, embedded devices (e.g., your refrigerator’s web page) webACE: 2 tiny web pages in on-chip memory Introduction to Physics Computing (Tseng)
Smallest server farm Introduction to Physics Computing (Tseng)
Low-power computing (3) • Alternative “natural” fuel for web serving… • 2.5V when fresh • 76.8kHz Introduction to Physics Computing (Tseng)
A few more radical ideas • Quantum computing • Small computers created, demonstrate parallel computations • Somewhat like analog computation: possible in principle, but physically difficult to make robust • Reversible computing • Entropy increases when bits are erased (Shannon 1948 – information theory) • Landauer’s limit (1961): heat dissipation from erasure • Current computers operate at 1000× this limit • Recently demonstrated in Berut, et al., Nature483, 187 (2012) • Theoretically well developed – technology less so • Physics impinging on computers again, especially at limits of performance Introduction to Physics Computing (Tseng)
Conclusion • Many of you should have run your first programs by now • If having trouble, ask for help at your next opportunity • Electronic computers have progressed immensely in ~60 years • On one hand, exponential increase in complexity • Complexity managed by abstraction ad nauseum • In many cases, computers simplify design • Proliferation raises other issues, e.g., power consumption • Future balance between physics and abstraction • Computers are working their way into every walk of life; your career will likely depend on them Introduction to Physics Computing (Tseng)