4. 4
Introduction to the World of Computing
Computer: electronic genius?
NO! Electronic idiot!
Does exactly what we tell it to, nothing more.
Hardware vs. Software
Its not either/or both are components of a computer system.
Even if you specialize in one,
you should understand capabilities and limitations of both.
Computer is a Universal Computing Device
It is not limited to perform only a specific computation,
It can perform any computation
The idea of a universal computational device is due to Alan Turing.
5. 5
Turing Machine
Mathematical model of a device that can perform any
computation
proposed by Alan Turing in 1937
While he gave a mathematical description of this kind of machine, but did not
actually build one
Every computation can be performed by some Turing
machine.
Examples / Black Box Model
TADD
, +
TMUL
テ
Turing machine that adds Turing machine that multiplies
,
6. 6
Universal Turing Machine
A machine that can simulate all Turing machines
This is also a Turing machine
Inputs : data + a description of computation (other TMs)
Universal Turing Machine is Programmable !!! So is
Computer !!!
A computer can emulate a Universal Turing Machine
U
,, (+)
Universal Turing Machine
Tadd, Tmul
12. 12
Lego Blocks Instructions
H/W
Ideas Sequence of Instructions/ Program
S/W
13. 13
How do we get the electrons to do the work ?
How do we solve a problem using a computer ?
A systematic sequence of transformations between layers of
abstraction.
Problems
Algorithm
Program
ISA
(Instruction Set Architecture)
Devices
Micro-architecture
Logic Circuits
stated using "natural
language".
may be ambiguous, imprecise.
express the algorithm using a
computer language
high-level language, low-level
language
a step-by-step procedure,
guaranteed to finish
specifies the set of
machine instructions
the computer can perform
Software Design:
choose algorithms
& data structures
Programming:
use language to express design
Compiling/
Interpreting:
convert language to
machine instructions
Processor Design:
choose structures to implement ISA
Logic/Circuit Design:
gates and low-level circuits to
implement components
Process Engineering
& Fabrication:
develop and manufacture
lowest-level components
14. 14
Properties of an Algorithm
An algorithm is a step-by-step procedure that is guaranteed to terminate,
such that each step is precisely stated and can be carried out by the
computer.
Definiteness :
Each step must be precisely defined; the actions to be carried out must be rigorously and
unambiguously specified for each case.
Ex) In a recipe for pancakes : "stir until lumpy". Does it meet "definiteness" ?
Effective Computability :
All operations to be performed must be sufficiently basic that they can be done exactly
and in finite length
Ex) "Take the largest prime number". Does it meet "effective computability" ?
Finiteness :
The algorithm must always terminate after a finite number of steps.
Ex) "Divide x by 2, repeat it until x has a value of 1". Does it meet "finiteness" ?
Input
An algorithm has zero or more inputs, taken from a specified set of objects.
output
An algorithm has one or more outputs, which have a specified relation to the inputs
15. 15
Many Choices at Each Level
Solve a system of equations/ 磯暑逢
Gaussian
elimination
Jacobi
iteration
Red-black SOR Multigrid
FORTRAN C C++ Java
Intel x86
PowerPC Atmel AVR
Centrino Pentium 4 Xeon
Ripple-carry adder Carry-lookahead adder
CMOS Bipolar GaAs
Tradeoffs:
觜 ,
焔 ,
覈
Problem
Algorithm
Program
ISA
Micro Architecture
Circuit
Device
16. 16
ISA (Instruction Set Architecture)
伎 殊企 螳 ADD, MUL 煙 伎觚襴 語(Assembly Language) 襦
覈
CPU 螳 讌 企螻 ろ 覈轟 0 螻 1 伎 螳朱 蠍郁 覈轟
れ )
CPU 螳 讌 企螻 ろ 蠍郁 覈轟企れ 讌 蠏碁Μ螻 蠏 蠍磯 蟲譟 覦 豌願
ISA
ISA 覿襯
ISA 蟲譟一 轟煙 磯 CISC (Complex Instruction Set Computer), RISC (
Reduced Instruction Set Computer) 煙朱 覿襯
CISC 蟲譟一 CPU/ISA 襦 Intel x86 Architecture (Instructions) PC/Notebook 煙
襴 一
19. 19
蠍郁 , 伎觚襴 , 螻蠍 語
覲危 襦蠏碁襾碁 螻蠍 語企 襦蠏碁 貊 (Source Code) 襯 燕螻
貉危朱 (Compiling) 企朱 螻殊 牛 蠍郁螳 企 豌襴
蠍郁 伎ろ (Binary Executable) 襦 覲 .
伎ろ 襦蠏碁 伎豌伎襯 伎 螻 ろ .
覿襯 Example 覩
High-Level
Language
X = Y + Z Store the value of Y + Z to X
Assembly
Language
LOAD Y
ADD Z
STORE X
Load the value of [0010] to AC
Add the value of [0101] to AC
Store the value of AC to [0110]
Machine
Language
1010 0010
1100 0101
1011 0110
Load the value of [0010] to AC
Add the value of [0101] to AC
Store the value of AC to [0110]
豺
蠍郁
豺
Compiling
28. 28
襦蠏碁螻 襦語れ 谿 : Program vs. Process
A program is an executable file residing on the disk (secondary storage). It is read
into the primary memory and executed by the kernel.
An executing instance of a program is called a process
れ .
貉危一 覃覈 襦蠏碁 ろ殊 谿場 . レ 企 覓伎瑚 ?
襦蠏碁 ろ 3 螳 覃覈 襦語るゼ 燕 .
?
CPU
Main Memory
Secondary
Storage
29. 29
Bit, Byte, Hexa
貉危一 覲企 2 讌襦
) 0100, 11010001
Bit Binary Digit
貉危一 覲企ゼ 蠍磯蓋
1 bit 0 1 朱
bits 螳 蟆曙一 襯
1 Byte = 8 bits
貉危一 覯 覓語 8
bits 螳 蟆朱覿
1 Byte 256 螳讌 蟆曙一
螳
Hexa
16 讌 (Hexa Decimal) 豌願
0, 1, , 9, A(10), B(11),
C(12), D(13), E(14), F(15)
蠍 2 讌襯 讌ш 螳 ,
螳 4 bits
Hexa 蠍 0x 襯
щ企 蟆曙郁 襷
) 001010101100 0x2AC
Value Prefix Symbol Value Binary Prefix
=1000 Kilo K =1024 Kibit
Mega M Mibit
Giga G Gibit
Tera T Tibit
Peta P Pibit
Exa E Eibit
Zetta Z Zibit
Yota Y Yibit
32. 32
Von Neumann Architecture - History
Wired 覦 豐蠍 貉危 蟲譟
Input
Device
Output
Device
Wire
(Wired Program)
CPU
Von Neumann Architecture
Input
Device
Output
Device
CPU
Main Memory
Stored Program
1943: ENIAC
豕豐 覯 貉危
Hard Wired Program - れ伎手骸 れ豺 譟一
1944: Beginnings of EDVAC
襦蠏碁 覃覈襴 ロ 蠍磯
螳 企伎
1945: John von Neumann
The First Draft of a Report on EDVAC
企朱 覓語襯 牛 Stored Program 螳
覦
Draft る 蠍磯蓋 蟲譟 Von
Neumann Machine (or Model) 襦 覿襴
33. 33
Main Memory
Von Neumann Architecture
0x0000 Instruction1
0x0004 Instruction2
0x0008 Instruction3
0x000A Instruction4
.
0x0100 Data1
0x0104 Data2
0x0108 Data3
Address Memory Cell
CPU
(Central Processing Unit)
ALU
(Arithmetic & Logic Unit)
Register
2
Register
1
Register
3
CU
(Control Unit)
IR
PC
Input Device
Output
Device
Stored Program:
Main Memory ル
Sequence of Instruction
CPU 襦 螳語 谿朱
, 磯 覈
語 一危磯 螳語
IR : Instruction Register
PC : Program Counter
Memory :
Contains Instructions & Data
Control Unit :
interpreting Instructions Arithmetic & Logic Unit :
performing arithmetic and logic
operations
34. 34
Von Neumann Architecture
CPU : ALU + CU + Registers
ALU (Arithmetic and Logic Unit)
一一 Unit
Register
ALU 一 煙 一企
CPU 伎 螻 Memory
CU (Control Unit)
Instruction Main Memory
曙伎 ALU Register 襯
覈轟 螻殊 危 Unit
曙 れ Instruction
ル 覃覈襴 譯殊 螳 螳讌 PC
(Program Counter) 手 覿襴 Register
螳 譟伎
PC 螳 伎 Instruction
IR(Instruction Register) 朱 Register
曙
Instruction 覃 朱朱 PC = PC
+ 1 螳 螳讌 , 讀 れ Instruction
Main Memory
0x0000 Instruction1
0x0004 Instruction2
0x0008 Instruction3
0x000A Instruction4
.
0x0100 Data1
0x0104 Data2
0x0108 Data3
Address Memory Cell
CPU
(Central Processing Unit)
ALU
(Arithmetic Logic Unit)
Register
2
Register
1
Register
3
CU
(Control Unit)
IR
PC
35. 35
Instruction Cycle
The cycle which the CPU follows from boot-up until the
computer has shut down in order to process instructions
Fetch
Decode
Execute
Store
The next instruction is fetched from the memory
address that is currently stored in the PC(program
counter) and stored into the IR(instruction register).
At the end of the fetch operation, the PC points to the
next instruction that will be read at the next cycle.
The encoded instruction present in the IR is
interpreted by the CU.
The CU passes the decoded information as a
sequence of control signals to the ALU to perform
mathematical or logic operations
CU ALU
Registers
Main Memory
Fetch
Decod
e Execute
Store
#15: Sun and Java are trademarks of Sun Microsystems, Inc. Intel, Pentium, Centrino, and Xeon are trademarks of Intel Corporation. AMD and Athlon and trademarks of Advanced Micro Devices, Inc. Atmel and AVR are registered trademarks of Atmel Corporation. PowerPC is a trademark of International Business Machines Corporation.