Introduction to Physics Computing

Download Report

Transcript Introduction to Physics Computing

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
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
MT 2013 (3)
Introduction to Physics Computing (Tseng)
2
Outline


Computing: a physicist’s perspective
Logic behind computing


Abstraction and control of complexity
Physics impinging on computing

Limits to abstraction/control
MT 2013 (3)
Introduction to Physics Computing (Tseng)
3
Electronic computers
MT 2013 (3)
Introduction to Physics Computing (Tseng)
4
Electronic computers (2)

Time-ordered electrical signals in response to
electrical inputs
MT 2013 (3)
Introduction to Physics Computing (Tseng)
5
Electronic computers (3)

How to get from basic electric signals to
3D gaming?
Minecraftmuseum.net
Freecodesource.com
MT 2013 (3)
Introduction to Physics Computing (Tseng)
6
Digital electronics

Reduce range of voltages and currents to
simple “on” and “off”, for example



Less sensitive to physics



Off: < 0.3V
On: > 2.0V
Near instantaneous signal propagation over
relevant distances (this is an issue in high-speed
networks)
Resistance drops over wires
Digital “abstraction”: simplifies robust design
MT 2013 (3)
Introduction to Physics Computing (Tseng)
7
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
MT 2013 (3)
Introduction to Physics Computing (Tseng)
8
Finite state machine
input
output
state
MT 2013 (3)
Introduction to Physics Computing (Tseng)
9
State diagram
A
L
F
O
K
E
N
B
M
G
D
C
MT 2013 (3)
P
H
I
Introduction to Physics Computing (Tseng)
J
10
Example: First Public Examinations
Simple two-exam
Preliminary Exams
Inputs:
• CP1 ≥ 40
• CP2 ≥ 40
switch state
case before_exam
…
case partial_pass
if pass
state = passed
else
state = failed
end
case first_fail
…
otherwise
disp(‘Illegal state’)
end
MT 2013 (3)
Pass both
Pass one
Pass
Partial
pass
Fail
Pass
Pass none
First
fail
Fail
Introduction to Physics Computing (Tseng)
11
First Public Examination (2)
11
A
E
01
1X

“Partial pass” actually
encompassed two
states



0X
B
10
Required passes
dictated by state B or C
6 states
4 possible input values
X1
11
C
X0
F
00
D
00|01|10
MT 2013 (3)
Introduction to Physics Computing (Tseng)
12
Finite state machine
input
326
Lookup
table
output
state
MT 2013 (3)
Introduction to Physics Computing (Tseng)
13
FSM to computer
input
instructions
(sequence)
output
2568
Lookup
table
state
memory
MT 2013 (3)
Introduction to Physics Computing (Tseng)
14
Computer elements
program
input
processor
output
memory
MT 2013 (3)
Introduction to Physics Computing (Tseng)
15
Stored-program computer

“Von Neumann” architecture: program stored
in memory

A program in memory is simply part of “state”
input
processor
output
memory
MT 2013 (3)
Introduction to Physics Computing (Tseng)
16
Tinkertoys (1989)

Actually more a sequencer
MT 2013 (3)
Introduction to Physics Computing (Tseng)
17
Modern computers
Central
processing
unit (CPU)
memory
MT 2013 (3)
Introduction to Physics Computing (Tseng)
18
CPU
Contains logic and instruction
decoding
The first μCPU: Intel 4004
MT 2013 (3)
Introduction to Physics Computing (Tseng)
19
CPU


MT 2013 (3)
Intel Pentium
Submicron
geometry
Introduction to Physics Computing (Tseng)
20
Computers for all seasons

Von Neumann computer is now so simple
and cheap that we replicate it everywhere
input
processor
output
memory
MT 2013 (3)
Introduction to Physics Computing (Tseng)
21
Computers for all seasons (2)

input
Peripherals are themselves smaller von
Neumann machines
proc
input
output
processor
output
mem
Keyboard
Mouse
CD drive
Network interface
MT 2013 (3)
Video controller
Sound driver
Printer
Network interface
memory
Reflective memory
Virtual memory
Introduction to Physics Computing (Tseng)
22
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


Modern machines often use computers to optimise their performance



Not for generic computing – difficult to program, breaks von Neuman model
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
Single-chip
computer



Motorola
68332
CPU,
memory, I/O
functions
Often used in
peripherals,
control apps
MT 2013 (3)
Introduction to Physics Computing (Tseng)
24
Program execution

A program must ultimately turn into a predictable pattern of
electrical (for now) signals



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 often use low-level “operation codes”
Programmers typically write something they can read
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
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
MT 2013 (3)
Introduction to Physics Computing (Tseng)
26
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)
MT 2013 (3)
Introduction to Physics Computing (Tseng)
27
Interpretation and CPU’s

Modern Pentium: a legacy
architecture emulated by a
simpler CPU






MT 2013 (3)
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)
28
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
MT 2013 (3)
Introduction to Physics Computing (Tseng)
29
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
MT 2013 (3)
Introduction to Physics Computing (Tseng)
30
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
Web browser program
Operating System
hardware
MT 2013 (3)
In addition:
• Hide complexities of
peripherals
• Enable multiple users –
modern computers are mostly
idle
Introduction to Physics Computing (Tseng)
31
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
MT 2013 (3)
Introduction to Physics Computing (Tseng)
32
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
Guest OS
Emulated hardware
other
software
Emulator
Host Operating System
host hardware
MT 2013 (3)
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?
Introduction to Physics Computing (Tseng)
33
Simulating circuits

Matlab/SimuLink “powerlib” tool
MT 2013 (3)
Introduction to Physics Computing (Tseng)
34
MT 2013 (3)
Introduction to Physics Computing (Tseng)
35
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.


MT 2013 (3)
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)
36
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




1993 PC (Octek Jaguar V)
Remove functionality
Reduce geometry
Lower voltage thresholds
Not just CPU:

How much power wasted signalling
to off-chip memory?
Galaxy SII
MT 2013 (3)
Introduction to Physics Computing (Tseng)
37
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
MT 2013 (3)
Introduction to Physics Computing (Tseng)
38
Smallest server farm
MT 2013 (3)
Introduction to Physics Computing (Tseng)
39
Low-power computing (3)



Alternative “natural” fuel for web serving…
2.5V when fresh
76.8kHz
MT 2013 (3)
Introduction to Physics Computing (Tseng)
40
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
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
MT 2013 (3)
Introduction to Physics Computing (Tseng)
42