introduction to physics computing

42
Introduction to Physics Computing MT 2013 Lecture 3 J Tseng

Upload: akeem-hardy

Post on 02-Jan-2016

23 views

Category:

Documents


0 download

DESCRIPTION

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 - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Introduction to Physics Computing

Introduction toPhysics Computing

MT 2013

Lecture 3

J Tseng

Page 2: Introduction to Physics Computing

MT 2013 (3)Introduction to Physics Computing

(Tseng) 2

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

Page 3: Introduction to Physics Computing

MT 2013 (3)Introduction to Physics Computing

(Tseng) 3

Outline

Computing: a physicist’s perspective Logic behind computing

Abstraction and control of complexity Physics impinging on computing

Limits to abstraction/control

Page 4: Introduction to Physics Computing

MT 2013 (3)Introduction to Physics Computing

(Tseng) 4

Electronic computers

Page 5: Introduction to Physics Computing

MT 2013 (3)Introduction to Physics Computing

(Tseng) 5

Electronic computers (2)

Time-ordered electrical signals in response to electrical inputs

Page 6: Introduction to Physics Computing

MT 2013 (3)Introduction to Physics Computing

(Tseng) 6

Electronic computers (3) How to get from basic electric signals to

3D gaming?

Freecodesource.com

Minecraftmuseum.net

Page 7: Introduction to Physics Computing

MT 2013 (3)Introduction to Physics Computing

(Tseng) 7

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

Page 8: Introduction to Physics Computing

MT 2013 (3)Introduction to Physics Computing

(Tseng) 8

Sequencer

Outputs a pre-programmed series of signals Input: a clock or trigger Often used to control a series of actions

(triggered by outputs)

output01001011110010101110100100100100

Page 9: Introduction to Physics Computing

MT 2013 (3)Introduction to Physics Computing

(Tseng) 9

Finite state machine

input output

state

Page 10: Introduction to Physics Computing

MT 2013 (3)Introduction to Physics Computing

(Tseng) 10

State diagram

F

E

A

B

G

D

K

L

IHCJ

M

O

P

N

Page 11: Introduction to Physics Computing

Example: First Public Examinations

MT 2013 (3)Introduction to Physics Computing

(Tseng) 11

Partial pass

First fail

Inputs:•CP1 ≥ 40•CP2 ≥ 40

Simple two-examPreliminary Exams

Pass both

Pass one

Pass none

Pass

Fail Pass

Fail

switch state case before_exam … case partial_pass if pass state = passed else state = failed end case first_fail … otherwise disp(‘Illegal state’)end

Page 12: Introduction to Physics Computing

First Public Examination (2)

“Partial pass” actually encompassed two states Required passes

dictated by state B or C 6 states 4 possible input values

MT 2013 (3)Introduction to Physics Computing

(Tseng) 12

A

B

D

E

F

11

01

00

1X

0X

11

00|01|10

C

10X1

X0

Page 13: Introduction to Physics Computing

MT 2013 (3)Introduction to Physics Computing

(Tseng) 13

Finite state machine

326Lookup

table

input output

state

Page 14: Introduction to Physics Computing

MT 2013 (3)Introduction to Physics Computing

(Tseng) 14

FSM to computer

2568Lookup

table

inputoutput

state

instructions(sequence)

memory

Page 15: Introduction to Physics Computing

MT 2013 (3)Introduction to Physics Computing

(Tseng) 15

Computer elements

processorinput output

program

memory

Page 16: Introduction to Physics Computing

MT 2013 (3)Introduction to Physics Computing

(Tseng) 16

Stored-program computer

processorinput output

memory

“Von Neumann” architecture: program stored in memory A program in memory is simply part of “state”

Page 17: Introduction to Physics Computing

MT 2013 (3)Introduction to Physics Computing

(Tseng) 17

Tinkertoys (1989) Actually more a sequencer

Page 18: Introduction to Physics Computing

MT 2013 (3)Introduction to Physics Computing

(Tseng) 18

Modern computers

Central processing unit (CPU)

memory

Page 19: Introduction to Physics Computing

MT 2013 (3)Introduction to Physics Computing

(Tseng) 19

CPU

Contains logic and instruction decoding

The first μCPU: Intel 4004

Page 20: Introduction to Physics Computing

MT 2013 (3)Introduction to Physics Computing

(Tseng) 20

CPU

Intel Pentium Submicron

geometry

Page 21: Introduction to Physics Computing

MT 2013 (3)Introduction to Physics Computing

(Tseng) 21

Computers for all seasons

Von Neumann computer is now so simple and cheap that we replicate it everywhere

processorinput output

memory

Page 22: Introduction to Physics Computing

MT 2013 (3)Introduction to Physics Computing

(Tseng) 22

Computers for all seasons (2)

Peripherals are themselves smaller von Neumann machines

processorinput output

memory

procinput output

mem

KeyboardMouseCD driveNetwork interface

Video controllerSound driverPrinterNetwork interface

Reflective memoryVirtual memory

Page 23: Introduction to Physics Computing

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

MT 2013 (3)Introduction to Physics Computing

(Tseng) 23

Page 24: Introduction to Physics Computing

MT 2013 (3)Introduction to Physics Computing

(Tseng) 24

Single-chip computer Motorola

68332 CPU,

memory, I/O functions

Often used in peripherals, control apps

Page 25: Introduction to Physics Computing

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

MT 2013 (3)Introduction to Physics Computing

(Tseng) 25

Page 26: Introduction to Physics Computing

MT 2013 (3)Introduction to Physics Computing

(Tseng) 26

Programming languages

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

Where we are

Where we used to be

Printers/graphics

web

Matlab

Matlab

Page 27: Introduction to Physics Computing

MT 2013 (3)Introduction to Physics Computing

(Tseng) 27

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)

Page 28: Introduction to Physics Computing

MT 2013 (3)Introduction to Physics Computing

(Tseng) 28

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

Page 29: Introduction to Physics Computing

MT 2013 (3)Introduction to Physics Computing

(Tseng) 29

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

Page 30: Introduction to Physics Computing

MT 2013 (3)Introduction to Physics Computing

(Tseng) 30

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

Page 31: Introduction to Physics Computing

MT 2013 (3)Introduction to Physics Computing

(Tseng) 31

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

hardwareOperating System

Web browseryour

programIn addition:• Hide complexities of

peripherals• Enable multiple users –

modern computers are mostly idle

Page 32: Introduction to Physics Computing

MT 2013 (3)Introduction to Physics Computing

(Tseng) 32

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

Page 33: Introduction to Physics Computing

MT 2013 (3)Introduction to Physics Computing

(Tseng) 33

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

host hardwareHost Operating System

Emulatorother

softwareEmulated hardware

Guest OSUser 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?

Page 34: Introduction to Physics Computing

Simulating circuits

Matlab/SimuLink “powerlib” tool

MT 2013 (3)Introduction to Physics Computing

(Tseng) 34

Page 35: Introduction to Physics Computing

MT 2013 (3)Introduction to Physics Computing

(Tseng) 35

Page 36: Introduction to Physics Computing

MT 2013 (3)Introduction to Physics Computing

(Tseng) 36

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”

Page 37: Introduction to Physics Computing

MT 2013 (3)Introduction to Physics Computing

(Tseng) 37

Low-power computing

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?

1993 PC (Octek Jaguar V)

Galaxy SII

Page 38: Introduction to Physics Computing

MT 2013 (3)Introduction to Physics Computing

(Tseng) 38

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

Page 39: Introduction to Physics Computing

MT 2013 (3)Introduction to Physics Computing

(Tseng) 39

Smallest server farm

Page 40: Introduction to Physics Computing

MT 2013 (3)Introduction to Physics Computing

(Tseng) 40

Low-power computing (3)

Alternative “natural” fuel for web serving… 2.5V when fresh 76.8kHz

Page 41: Introduction to Physics Computing

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., Nature 483, 187 (2012)

Theoretically well developed – technology less so Physics impinging on computers again, especially at limits

of performance

MT 2013 (3)Introduction to Physics Computing

(Tseng) 41

Page 42: Introduction to Physics Computing

MT 2013 (3)Introduction to Physics Computing

(Tseng) 42

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