際際滷

際際滷Share a Scribd company logo
覿磯蟲 螻糾骸
蠍一惨郁概覿
貉危 ろ螻 C 語 螳
螳 覈 蟲
苦惨 ろ螻 襦蠏碁 危
 Universal Computing Device and Turing Machine
 貉危 ろ : H/W + S/W
 Sequence of Instructions ( 覈轟 谿 譟壱 )
 貉危磯ゼ  覓語 願屋  Transformations between layers of abstraction
 Algorithm  
C 語 螳 貉危殊 危
 襦蠏碁覦 語 覿襯
 C 語 螳
 Compiled Language vs. Interpreted Language
 C 語 貉危手骸 Python 語 誤壱襴 觜蟲蠍
 Von Neumann Architecture
貉危 ろ螻 襦蠏碁 危
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
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
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
7
Alan Turing ( 豢豌 Wikipedia)
 
 1912  豢 , 1931  貅觚襴讌    豬 ,
1936  覩瑚記 襴一ろ  覦  豬 .
 1937  襷 蠍郁 螳  朱 螻 螳ロ  蟆一 覓語  覦 , 1938
 蟲 覿 誤蟲 覿 , 1939  手軌 蠏碁  企蠍 螳覦
 煙 襦 豌危  1954    螻朱ゼ 襾濠 譯曙 .
 襷  , 誤 , 覓狩  襷 覿殊 れ 郁規  讌襷 麹 貉危 螻狩 覿殊 殊 レ
蠍 覓語 貉危 螻狩 覦 壱 覯讌手 覿襴磯 . 蠏瑚 蟲 襷 蠍郁 覓危 蠍  貉危一
覃覈襴 , 蠍壱碁ゼ 暑 蠍郁 貉危一 CPU  觜   .  襷 蠍郁  譬襯 覯 襷 蠍郁
襦蠏碁 伎ロ伎   貉危磯ゼ 襷   . 覩瑚記貉危壱 ACM  襷 螻給襯
蠍磯Μ蠍  1966 覿 襷る 貉危 螻狩 譴  蠍 ろ 譯朱 襷  . 
襷 貉危 螻狩 覿殊 碁襖企手 覿襴磯 .
 貉危一 襦螻 '   覯企┨ 螻 '  襷 一れ襷 ,
 貉危郁 襦螻襯 襷  襷 朱 螻 襷れ讌 ろ讌  .
  貉危一 襦螻 覈語 危伎 螻朱手 譯殊ロ .
8
貉危 ろ
貉危 ろ  蟲 磯ジ  れ 螻一
   レ襦 螳覦 .
H/W S/W
貉危 ろ 伎 語企 企伎
貉危 ろ
 貉危 H/W 襦    螻一
覈轟 (Instruction)  覿襴 
蠍一 一一 覿螻狩 .
 H/W 襷朱 螳 蟲 
れ 螻一    .
 覈   襯 譟     谿   襦
ろ覃 螳 蟲  れ
螻一 ろ   .
 貉危 ろ S/W  轟 螻一
  覈轟 譟壱螻 蟯 一危
覈企 .
9
Operation and Instruction
 Operation( 一 ) : Operator( 一一 )  Operand( 殊一一 ) 襦 蟲
 Instruction( 覈轟 ) : Opcode( 覈轟 )  Operand ( 殊一一 ) 襦 蟲
 貉危 覈轟伎 殊一一 一一 一企 螳 (Literal)  レ / 覃覈襴
(Memory)
 Example) レ A  ル 螳螻 7   蟆 レ R1  ロ 覈
 襷 レ / 覃覈襴 譴 轟 レ / 覃覈襴襯
ADD A 7 R1
Opcod
e
Operand
ADD P1 P2 P3 P3P1+P2
Opcod
e
Operand
MUL P1 P2 P3 P3P1P2
A + B A  B
Operan
d
Operato
r
Operan
d
Operan
d
Operato
r
Operan
d
レ
企 / 譯殊
レ /
覃覈襴
ル 螳
A
R1
+ 7
10
Sequence of Instructions
 覈轟 譟壱 牛 覲旧″ 螻  
 レ A, B  螳   螳 螻一 螻 蠏 蟆郁骸襯 レ C  ロ螻
 .
 蠏碁磯  貉危一  螻一 覦襦    一 蠍磯レ  .
  貉危磯  レ 螳 ADD, MUL  螳讌 覈轟企ゼ 讌 .
  貉危一 レ A, B, C 語 R1, R2 朱 豢螳 レ襯 襦   り 螳 .
 ADD, MUL 襦 蟲焔  螳 Sequence of Instructions ( 覈轟 谿 譟
 )  ろ 牛  ( 覲旧″ ) 螻一    .
 MUL A A R1
 MUL A B R2
 ADD R1 R2 C
レ
企 / 譯殊
レ /
覃覈襴
ル 螳
A
B
C
R1
R2


+
11
Sequence of Instructions  
 螳  螻一 れ螻 螳 
企ゼ
ろ 覈轟 谿 譟壱 燕 .
 伎  螳 豢螳 レ R1, R2 襯  
 .
 轟 螻   覈 螳 覈轟企ゼ
螳 ?
 狩 蠍磯レ    覈轟企ゼ 
ろ覃 覲企 觜襯願 覈 
 螻襴讀 (Algorithm)  
Opcode Operands














?
!
12
Lego Blocks  Instructions
H/W
Ideas  Sequence of Instructions/ Program
S/W
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
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
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
 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 煙
襴 一
C 語 螳 貉危殊 危
18
襦蠏碁覦 語伎 覿襯
 襦蠏碁覦 語 - 襦蠏碁 燕蠍  語
  貉危一蟆 り 苦 伎 蠍  蠍磯
 瑚 豺 譴 磯 蠍郁 (Machine Code/Language), 伎觚襴 (Assembly
Language), 螻蠍 語 (High-Level Language) 襦 覿襯
 蠍郁
 伎 貊襦 CPU 襷 螻 蠍郁  ISA
 伎觚襴
 蠍郁 伎 貊襯  危危蠍  蠍壱誤 貊 (mnemonics) 襦 豺 蟆
 Symbolic Machine Code 襦 覿襴
 谿瑚 ) 襷 蟆曙 蠍郁 貊 伎觚襴 蠍壱 伎 1:1   蟯螻 讌襷 蠏碁讌  蟆曙磯  .
 螻蠍 語
 伎 觜訣 蟲覓語朱 覃 ,  所 郁鍵螳 覲企 暑
 蠍郁伎 襴曙企 襦蠏碁襾瑚 蠍郁 碁 (ISA)   螳 蟆 伎 .
 C/C++, Python, Java 煙 螻蠍 語伎 
 觜 蟯 伎觚襴企 蠍郁企ゼ 蠍 語 (Low-Level Language) 手
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
20
蠍郁伎 伎
Portability ( 伎 )
 襦蠏碁 るジ 蠍郁 / 弰 蠍   企 覲蟆曙 譴
 High Portability :  , 覲蟆曙 蟇一  襦蠏碁    蟆
玖鍵螻企 焔 襦蠏碁 伎煙 襷れ 
 CPU 襷 るジ 蠍郁 (ISA) 襯 蠍 覓
玖蠍 語伎 蟆曙 朱 伎煙 
  るジ CPU/ISA  蠍 伎
 貊襯 れ 貉危 
企 CPU/ISA   伎ろ殊
燕
21
C 語 螳
Dennis Ritchie  Ken Thompson  螳覦
 1969  ~ 1973   Bell Labs 蠏朱 轟
 UNIX 伎豌伎 螳覦 
 覩瑚記 覦 蟲 譴朱 
 ANSI (American National Standard Institute) C (1989  )
C 語伎 轟
 螻蠍 語伎 轟 (  ) 螻 蠍 語伎 螳 ( 觜襯願  )  蟆碁
Ken Thompson (left) with
Dennis Ritchie (right, the
inventor of the C programming
language)
Source - Wikipedia
轟 レ
蟲譟壱(Structured) 襦蠏碁覦 讌
覲旧″ 覓語襯    螳  襦  蟲 ,
願屋   . 觚襦 (Block),  (Sub-Routine) 煙 螳
牛 襦蠏碁  貊 蟲譟磯ゼ 危危蠍 所 燕螻 曙 

伎 (Portability)
れ 貉危 弰   
伎觚襴 語企 蠍郁伎 觜蟲   レ
 (Efficiency)
 覃覈襴襯 伎 觜襯願  螳ロ 襦蠏碁 燕 

れ 一一 襦蠏碁 螳蟆壱螻 所 燕   .  ) x = x+1;  x++;
 覃覈襴 (Dynamic Memory)
蟯襴
 覃覈襴 濠骸 伎襯 牛 覯 ろ螻 螳 覃覈襴
  蟆曙 蟲   襦蠏碁 燕
22
Compiled Language vs. Interpreted
Language
 ろ / 覈 殊  覿螳 譴 谿
 Compiled Language  豌  貊襯 伎 蠍郁 貊襦 覯螻 蠏瑚 覓苦 伎 ろ 殊 燕
 Interpreted Language  蟆曙  貊 朱 ( 朱朱  覓語レ ) 襯 伎 蠍郁 貊襦 覯螻 蠏
蟆郁骸襯 覦襦 ろ蟆  . 讀 覲 伎 ろ 殊 燕讌  .
 Compiled Language  蟆曙 ろ / 覈 殊 朱 れ Compiler 螳 企 ろ 螳ロ讌襷
Interpreted Language  蟆曙 ろ   貊 Interpreter 螳 
 谿瑚 ) Python るゼ interpretation 讌 螻 Compile  牛 ろ 殊
襷   .  蟆曙 Python  Compiled Language 襦 覿襯   .
觜蟲覈 Compiled Language Interpreted Language
 語 C/C++, Fortran, Cobol Python, Java, Basic
ろ / 覈     
ろ  觜襴 朱 襴
伎 (Portability)
朱  .
ISA 螳 るジ 貉危一 れ 貉危
伎 

誤壱襴磯 朱 ISA 螳 るジ
貉危一 ろ 螳
 貊
Interpreter
 豢
 貊
Compiler
 豢
ろ
23
C 語 貉危 れ (1)
 蠍 (Explorer) 襯 ろり 襦蠏碁覦   启襯 譴觜
 Ex) F:Workspace
 cmd( 覈 襦 ) ろ螻  启襦 企
 Explorer   启襯  蠏碁 1 螻 螳
Explorer  企 蟆暑螳 覃 蠏碁 2  螳
cmd 手 ロ覃 企 启 覈轟綾 
  cmd ろ  cd 煙 覈轟朱 企
 gcc ( 貉危朱 ) 襯 ろ 覲企
 蠏碁 3 螻 螳 ろ 蟆郁骸襦 る 覃讌螳 豢ル讌襷
ろ  誤 .
 where gcc 襦 貉危朱 れ 豺襯 誤 .
蠏碁 1
蠏碁 2
蠏碁 3
24
C 語 貉危 れ (2)
Cmd   notepad hello.c 襯 ロ hello.c 朱 C 貊
殊  启 燕
Hello.c 襯 れ螻 螳 燕螻 ロ .
 覃伎 Hello World !!! 朱 覓語伎 豢ロ 襦蠏碁
25
C 語 貉危 れ (3)
 dir  牛  启 伎
譟伎 殊 誤 .
 襦 襷  启朱 Hello.c 朱 
貊 朱 譟伎 蟆企 .
 gcc hello.c 襯 ロ 貉危殊
 .
 dir  牛 貉危   启
伎 譟伎 殊 誤 .
 a.exe 朱 ろ 殊  
誤   蟆企 .
 a.exe 襯 ろ企慨 .
26
Python Interpretation れ
 python  ろ螻 Hello World
!!! 豢 貊襯 燕企慨 .
 Python shell  ろ覃伎 貊襯 ロ
  Prompt 螳 蟾    
 Print 覈豪語   Hello
World !!! 襯 豢ロ企慨
 exit() 襦 Python Shell  譬襭貅 .
 Notepad hello.py 襯 ろり
 狩 貊襯 燕 覲企 .
 python hello.py 襯 牛 ろ
蟆郁骸襯 誤 . ろ 殊
焔螳 ?
27
貉危 襦蠏碁螻 ろ
 貉危 襦蠏碁 (Program) 企 ?
 Sequence of instructions and
related data !!!
 覈轟企 蠍郁螳 讌 企螻 ろ  
伎 螳朱  蠍郁 (Machine Code)
 ろ  (Executable File)  襦
覲伎^蠍一旧レ  / れ
 襦蠏碁 ろ 螻殊
 覲伎^蠍一旧レ ル 襦蠏碁 ろ 殊
Main Memory 襦  (Loading) 螻
 CPU  Main Memory 襦覿 襦蠏碁
覈轟企れ 谿朱  曙 れ
伎螻  覦朱 襦蠏碁 ろ
(Execution)
 谿瑚 ) 襦蠏碁  / ろ  S/W 
伎豌伎 (OS : Operating System)
Input
Device
Output
Device
CPU
Main Memory
Secondary
Storage
襦蠏碁
ろ
Loading
Execution
貉危 H/W 蟲 
 譴豌襴レ - CPU (Central Processing Unit)
覈轟企ゼ 伎 ろ 旧 蟲 
 譯手鍵旧レ - Main Memory
襦蠏碁螻 一危磯ゼ ロ 覦 蠍一旧レ
( 谿瑚 )  蟶殊碁  覲企ゼ 讌 蠍一 レ襯
觜覦 (Non-Volatile), 蠏碁讌 覈詩 レ襯 覦 (Volatile)
蠍一 レ手 
 覲伎^蠍一旧レ - Secondary Storage
襦蠏碁螻 一危磯ゼ 殊 襦 ロ 觜覦 (Non
Volatile) 蠍一旧レ襦 HDD, SSD 煙 
 豢 レ  Input / Output Device
瑚螻 貉危一   譯朱 る慨 , 襷一 ,
覈一 螳 レ
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
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
30
. . .
Memory Address
 Memory
 bits 襯 ロ   れ Memory Cell  一朱 伎伎  蟆
 覿覿  貉危磯 , 讀 Memory Cell  1 Byte 襯 
 Memory Address  
 一 Memory Cell 譴 企 Cell  所碓 語襯
  伎   Address
  襷 覦 譴 企 覦 ?
 Memory Address
 貉危一 譯朱 2 讌  Hexa 襦 
 Memory Address  一企 bits   ,  Memory Cell 蟲覲
 螳 豌 覃覈襴 螻糾 蠍一 蟯
  )  覃覈襴 螻糾 蠍磯 4GiBytes
10011010
00000000
10011010
00000000
10011010
00000000
10011010
00000000
. . .
Memory Cells
8
000000
000001
000010
000011
111100
111101
111110
111111
. . .
Address
1 2 3 4 5
31
ろ 蠍 覓殊 覃伎 蟆  蠍 讌   (disk, platter) 朱
讌 覲企ゼ 郁 曙   一危  レ . ろ 貉危 
蟶殊碁 覲願 讌 觜覦 (Non-Volatile) 蠍一 レ企 .
ろ 蠏 覃伎 覲企ゼ 郁碓 曙  一企 る  企 .
ろ 殊企 ろ襯 觜襯願  り る 豺襯 譟一覃伎
 豺 一危磯ゼ 所    蠍郁 レ企 .
ろ 蠍磯 5.25 語 (13.34cm), 3.5 語 (8.9cm), 2.5 語 (6.4cm), 1.8
語 (4.6cm) 煙 朱 覿   , 讀 RPM  5400, 7200 煙  . 
一ろ PC  3.5 語 , 誤碁 2.5 語 HDD 螳 譯朱 一碁 .
 覃覈襴 覦豌企ゼ  襷れ牡襦  一危  レ企 . 覦豌伎企
朱 覃覈襴 覦豌伎 襴  蟶殊碁 覲願 讌 觜覦 (Non-
Volatile) 蠍一 レ企 .
 朱 覩襦 蠍郁 HDD  覓語 蠍  螳 , 覦 螳 ,
蠍郁 讌 , ろ ,  蟆 譴 譴 .  螳覲螻  蟆  .
 一危 蠏 螳  一 所鍵 郁鍵  HDD 覲企 襴
蟆曙郁 襷讌襷 豕 蠍一  SSD  蟆曙 一 所鍵 郁鍵 HDD
覲企 觜襯企 . SSD  豕  觜 螳蟆伎朱 豕蠏殊 螳蟆 觜襯願
渚螻  .
 HD (Hard Disk) /
HDD (Hard Disk
Drive)
 SSD (Solid State
Drive)
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
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
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
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
John von Neumann ( 豢豌 Wikipedia)
 
 1903  螳襴 覿ろろ語 覿  螳 ル朱 豢
 1926  23 語 企 覿ろろ   覦  豬 ,
1930 蟾讌 覯襯朱Π 覲狩  螳 
 1930  襴一ろ 螻煙郁規襦 豐豌 覦 覩瑚記朱 蟇企螳 螻煙郁規 豕豐 4 覈 蟲讌 譴  覈
 . 危 譯曙 蟾讌 螻煙郁規  蟲襦 
 2 谿  蠍郁 給願鍵 螳覦  襷 襦 谿語 , 給願鍵 螳覦 讌 蠍一 , 豕豐 牛 ろ
讌 蟯谿壱  螻狩 譴   , 危 覩 覿 襯螳 (ICBM)  谿語 , 覦螻
覲伎譯殊襦 蠏轟 給願鍵 麹語 , 蠏 企 蠍一 蠏瑚 譯殊ロ  讀 蟯 , 讀 MAD(Mutually
Assured Destruction)   蠍 覩 ,  給願鍵 旧伎 .
 1957  覦レ 語朱 豢 螻 蟇碁れ 襷
 讌 豕螳 豌襦 れ 譟  語企 覓 襾碁Μ螳 譬 煙 , 襷 襯 螳讌
手 覿襴 . 7 螳 瑚記企ゼ 覈蟲 螳 襦   朱 , 覦  覯渚り 伎 .
 螳 一企 蠍一給レ 螳讌 碁朱 螳   螻 ル .  覓朱Μ ,  伎 ,
讌 企 , 貉危 螻狩 , 蟆曙 煙 覿殊 れ 譴 螻牛  . 蟆 企 谿曙 . DNA/RNA
覦蟆 伎 蠏 譟伎襯 豸″ Cellular Automata / Universal Constructor 螳 谿曙 . 蠏語 豌炎骸 蟯
襷 狩れ  . ( 谿瑚 1, 谿瑚 2)
 EDVAC  焔  蟆 . 蟲郁 るジ讓曙 4 覯讌 襴螳 7  螳  2  讌 朱瑚 ? 貉危一 
語企  覓語襯 蠍 螻  語企 襾殊  豪Μ .
4-36

More Related Content

Similar to 01. Computer System Basics with C Language (20)

Assembly ろ磯 1
Assembly ろ磯 1Assembly ろ磯 1
Assembly ろ磯 1
J J
Chaper24 languages high_and_low
Chaper24 languages high_and_lowChaper24 languages high_and_low
Chaper24 languages high_and_low
Kyungryul KIM
6. code level reversing
6. code level reversing6. code level reversing
6. code level reversing
Youngjun Chang
The Deep Learning Compiler
The Deep Learning CompilerThe Deep Learning Compiler
The Deep Learning Compiler
Tae Young Lee
(蟆螳覦) printf("Hello World!"); 蠏 伎 貊 襦蠏碁覦
(蟆螳覦) printf("Hello World!"); 蠏 伎 貊 襦蠏碁覦(蟆螳覦) printf("Hello World!"); 蠏 伎 貊 襦蠏碁覦
(蟆螳覦) printf("Hello World!"); 蠏 伎 貊 襦蠏碁覦
NDOORS
螳覦 貉危郁概 螻給伎 蟾? (觜螻旧 貉危郁概 螻朱 覓伎 狩蟾?)
 螳覦 貉危郁概 螻給伎 蟾? (觜螻旧 貉危郁概 螻朱 覓伎 狩蟾?) 螳覦 貉危郁概 螻給伎 蟾? (觜螻旧 貉危郁概 螻朱 覓伎 狩蟾?)
螳覦 貉危郁概 螻給伎 蟾? (觜螻旧 貉危郁概 螻朱 覓伎 狩蟾?)
Covenant Ko
System+os study 1
System+os study 1System+os study 1
System+os study 1
J J
Visual C++10 覲 襦蠏碁覦
Visual C++10  覲 襦蠏碁覦Visual C++10  覲 襦蠏碁覦
Visual C++10 覲 襦蠏碁覦
ル旭 豕
=梶求a_ SW
=梶求a_ SW=梶求a_ SW
=梶求a_ SW
襦蠏碁覦 語伎 F1襾語 C++ 螻 Windows 10 UWP 螳覦 瑚襦~
襦蠏碁覦 語伎 F1襾語 C++ 螻 Windows 10 UWP  螳覦 瑚襦~襦蠏碁覦 語伎 F1襾語 C++ 螻 Windows 10 UWP  螳覦 瑚襦~
襦蠏碁覦 語伎 F1襾語 C++ 螻 Windows 10 UWP 螳覦 瑚襦~
YEONG-CHEON YOU
 襴 襴
Sungchul Park
蟆襦蠏碁覦覓 2譯殊姶
蟆襦蠏碁覦覓 2譯殊姶蟆襦蠏碁覦覓 2譯殊姶
蟆襦蠏碁覦覓 2譯殊姶
Yeonah Ki
[Td 2015]襦蠏碁覦 語伎 f1襾語 c++ 螻 windows 10 uwp 螳覦 瑚襦~(豌)
[Td 2015]襦蠏碁覦 語伎 f1襾語 c++ 螻 windows 10 uwp  螳覦 瑚襦~(豌)[Td 2015]襦蠏碁覦 語伎 f1襾語 c++ 螻 windows 10 uwp  螳覦 瑚襦~(豌)
[Td 2015]襦蠏碁覦 語伎 f1襾語 c++ 螻 windows 10 uwp 螳覦 瑚襦~(豌)
Sang Don Kim
遺#螳譬
遺#螳譬遺#螳譬
遺#螳譬
e12g
語 譴 襯 譴觜
語 譴 襯 譴觜語 譴 襯 譴觜
語 譴 襯 譴觜
Deogtae Kim
覲 襦蠏碁覦
覲 襦蠏碁覦覲 襦蠏碁覦
覲 襦蠏碁覦
螳譬 04 蟲譟 り
螳譬 04  蟲譟 り螳譬 04  蟲譟 り
螳譬 04 蟲譟 り
chcbaram
[蠖/110514] 覃一cpu伎手鍵 覦
[蠖/110514] 覃一cpu伎手鍵 覦[蠖/110514] 覃一cpu伎手鍵 覦
[蠖/110514] 覃一cpu伎手鍵 覦
sung ki choi
Python study 1螳 (ろれ雑ろ 企 螳)
Python study 1螳 (ろれ雑ろ 企 螳)Python study 1螳 (ろれ雑ろ 企 螳)
Python study 1螳 (ろれ雑ろ 企 螳)
覈 Jerry Jeong
TestBCD2015-1(Answer)
TestBCD2015-1(Answer)TestBCD2015-1(Answer)
TestBCD2015-1(Answer)
Yong Heui Cho
Assembly ろ磯 1
Assembly ろ磯 1Assembly ろ磯 1
Assembly ろ磯 1
J J
Chaper24 languages high_and_low
Chaper24 languages high_and_lowChaper24 languages high_and_low
Chaper24 languages high_and_low
Kyungryul KIM
6. code level reversing
6. code level reversing6. code level reversing
6. code level reversing
Youngjun Chang
The Deep Learning Compiler
The Deep Learning CompilerThe Deep Learning Compiler
The Deep Learning Compiler
Tae Young Lee
(蟆螳覦) printf("Hello World!"); 蠏 伎 貊 襦蠏碁覦
(蟆螳覦) printf("Hello World!"); 蠏 伎 貊 襦蠏碁覦(蟆螳覦) printf("Hello World!"); 蠏 伎 貊 襦蠏碁覦
(蟆螳覦) printf("Hello World!"); 蠏 伎 貊 襦蠏碁覦
NDOORS
螳覦 貉危郁概 螻給伎 蟾? (觜螻旧 貉危郁概 螻朱 覓伎 狩蟾?)
 螳覦 貉危郁概 螻給伎 蟾? (觜螻旧 貉危郁概 螻朱 覓伎 狩蟾?) 螳覦 貉危郁概 螻給伎 蟾? (觜螻旧 貉危郁概 螻朱 覓伎 狩蟾?)
螳覦 貉危郁概 螻給伎 蟾? (觜螻旧 貉危郁概 螻朱 覓伎 狩蟾?)
Covenant Ko
System+os study 1
System+os study 1System+os study 1
System+os study 1
J J
Visual C++10 覲 襦蠏碁覦
Visual C++10  覲 襦蠏碁覦Visual C++10  覲 襦蠏碁覦
Visual C++10 覲 襦蠏碁覦
ル旭 豕
=梶求a_ SW
=梶求a_ SW=梶求a_ SW
=梶求a_ SW
襦蠏碁覦 語伎 F1襾語 C++ 螻 Windows 10 UWP 螳覦 瑚襦~
襦蠏碁覦 語伎 F1襾語 C++ 螻 Windows 10 UWP  螳覦 瑚襦~襦蠏碁覦 語伎 F1襾語 C++ 螻 Windows 10 UWP  螳覦 瑚襦~
襦蠏碁覦 語伎 F1襾語 C++ 螻 Windows 10 UWP 螳覦 瑚襦~
YEONG-CHEON YOU
蟆襦蠏碁覦覓 2譯殊姶
蟆襦蠏碁覦覓 2譯殊姶蟆襦蠏碁覦覓 2譯殊姶
蟆襦蠏碁覦覓 2譯殊姶
Yeonah Ki
[Td 2015]襦蠏碁覦 語伎 f1襾語 c++ 螻 windows 10 uwp 螳覦 瑚襦~(豌)
[Td 2015]襦蠏碁覦 語伎 f1襾語 c++ 螻 windows 10 uwp  螳覦 瑚襦~(豌)[Td 2015]襦蠏碁覦 語伎 f1襾語 c++ 螻 windows 10 uwp  螳覦 瑚襦~(豌)
[Td 2015]襦蠏碁覦 語伎 f1襾語 c++ 螻 windows 10 uwp 螳覦 瑚襦~(豌)
Sang Don Kim
遺#螳譬
遺#螳譬遺#螳譬
遺#螳譬
e12g
語 譴 襯 譴觜
語 譴 襯 譴觜語 譴 襯 譴觜
語 譴 襯 譴觜
Deogtae Kim
覲 襦蠏碁覦
覲 襦蠏碁覦覲 襦蠏碁覦
覲 襦蠏碁覦
螳譬 04 蟲譟 り
螳譬 04  蟲譟 り螳譬 04  蟲譟 り
螳譬 04 蟲譟 り
chcbaram
[蠖/110514] 覃一cpu伎手鍵 覦
[蠖/110514] 覃一cpu伎手鍵 覦[蠖/110514] 覃一cpu伎手鍵 覦
[蠖/110514] 覃一cpu伎手鍵 覦
sung ki choi
Python study 1螳 (ろれ雑ろ 企 螳)
Python study 1螳 (ろれ雑ろ 企 螳)Python study 1螳 (ろれ雑ろ 企 螳)
Python study 1螳 (ろれ雑ろ 企 螳)
覈 Jerry Jeong
TestBCD2015-1(Answer)
TestBCD2015-1(Answer)TestBCD2015-1(Answer)
TestBCD2015-1(Answer)
Yong Heui Cho

01. Computer System Basics with C Language

  • 2. 螳 覈 蟲 苦惨 ろ螻 襦蠏碁 危 Universal Computing Device and Turing Machine 貉危 ろ : H/W + S/W Sequence of Instructions ( 覈轟 谿 譟壱 ) 貉危磯ゼ 覓語 願屋 Transformations between layers of abstraction Algorithm C 語 螳 貉危殊 危 襦蠏碁覦 語 覿襯 C 語 螳 Compiled Language vs. Interpreted Language C 語 貉危手骸 Python 語 誤壱襴 觜蟲蠍 Von Neumann Architecture
  • 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
  • 7. 7 Alan Turing ( 豢豌 Wikipedia) 1912 豢 , 1931 貅觚襴讌 豬 , 1936 覩瑚記 襴一ろ 覦 豬 . 1937 襷 蠍郁 螳 朱 螻 螳ロ 蟆一 覓語 覦 , 1938 蟲 覿 誤蟲 覿 , 1939 手軌 蠏碁 企蠍 螳覦 煙 襦 豌危 1954 螻朱ゼ 襾濠 譯曙 . 襷 , 誤 , 覓狩 襷 覿殊 れ 郁規 讌襷 麹 貉危 螻狩 覿殊 殊 レ 蠍 覓語 貉危 螻狩 覦 壱 覯讌手 覿襴磯 . 蠏瑚 蟲 襷 蠍郁 覓危 蠍 貉危一 覃覈襴 , 蠍壱碁ゼ 暑 蠍郁 貉危一 CPU 觜 . 襷 蠍郁 譬襯 覯 襷 蠍郁 襦蠏碁 伎ロ伎 貉危磯ゼ 襷 . 覩瑚記貉危壱 ACM 襷 螻給襯 蠍磯Μ蠍 1966 覿 襷る 貉危 螻狩 譴 蠍 ろ 譯朱 襷 . 襷 貉危 螻狩 覿殊 碁襖企手 覿襴磯 . 貉危一 襦螻 ' 覯企┨ 螻 ' 襷 一れ襷 , 貉危郁 襦螻襯 襷 襷 朱 螻 襷れ讌 ろ讌 . 貉危一 襦螻 覈語 危伎 螻朱手 譯殊ロ .
  • 8. 8 貉危 ろ 貉危 ろ 蟲 磯ジ れ 螻一 レ襦 螳覦 . H/W S/W 貉危 ろ 伎 語企 企伎 貉危 ろ 貉危 H/W 襦 螻一 覈轟 (Instruction) 覿襴 蠍一 一一 覿螻狩 . H/W 襷朱 螳 蟲 れ 螻一 . 覈 襯 譟 谿 襦 ろ覃 螳 蟲 れ 螻一 ろ . 貉危 ろ S/W 轟 螻一 覈轟 譟壱螻 蟯 一危 覈企 .
  • 9. 9 Operation and Instruction Operation( 一 ) : Operator( 一一 ) Operand( 殊一一 ) 襦 蟲 Instruction( 覈轟 ) : Opcode( 覈轟 ) Operand ( 殊一一 ) 襦 蟲 貉危 覈轟伎 殊一一 一一 一企 螳 (Literal) レ / 覃覈襴 (Memory) Example) レ A ル 螳螻 7 蟆 レ R1 ロ 覈 襷 レ / 覃覈襴 譴 轟 レ / 覃覈襴襯 ADD A 7 R1 Opcod e Operand ADD P1 P2 P3 P3P1+P2 Opcod e Operand MUL P1 P2 P3 P3P1P2 A + B A B Operan d Operato r Operan d Operan d Operato r Operan d レ 企 / 譯殊 レ / 覃覈襴 ル 螳 A R1 + 7
  • 10. 10 Sequence of Instructions 覈轟 譟壱 牛 覲旧″ 螻 レ A, B 螳 螳 螻一 螻 蠏 蟆郁骸襯 レ C ロ螻 . 蠏碁磯 貉危一 螻一 覦襦 一 蠍磯レ . 貉危磯 レ 螳 ADD, MUL 螳讌 覈轟企ゼ 讌 . 貉危一 レ A, B, C 語 R1, R2 朱 豢螳 レ襯 襦 り 螳 . ADD, MUL 襦 蟲焔 螳 Sequence of Instructions ( 覈轟 谿 譟 ) ろ 牛 ( 覲旧″ ) 螻一 . MUL A A R1 MUL A B R2 ADD R1 R2 C レ 企 / 譯殊 レ / 覃覈襴 ル 螳 A B C R1 R2 +
  • 11. 11 Sequence of Instructions 螳 螻一 れ螻 螳 企ゼ ろ 覈轟 谿 譟壱 燕 . 伎 螳 豢螳 レ R1, R2 襯 . 轟 螻 覈 螳 覈轟企ゼ 螳 ? 狩 蠍磯レ 覈轟企ゼ ろ覃 覲企 觜襯願 覈 螻襴讀 (Algorithm) Opcode Operands ? !
  • 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 煙 襴 一
  • 17. C 語 螳 貉危殊 危
  • 18. 18 襦蠏碁覦 語伎 覿襯 襦蠏碁覦 語 - 襦蠏碁 燕蠍 語 貉危一蟆 り 苦 伎 蠍 蠍磯 瑚 豺 譴 磯 蠍郁 (Machine Code/Language), 伎觚襴 (Assembly Language), 螻蠍 語 (High-Level Language) 襦 覿襯 蠍郁 伎 貊襦 CPU 襷 螻 蠍郁 ISA 伎觚襴 蠍郁 伎 貊襯 危危蠍 蠍壱誤 貊 (mnemonics) 襦 豺 蟆 Symbolic Machine Code 襦 覿襴 谿瑚 ) 襷 蟆曙 蠍郁 貊 伎觚襴 蠍壱 伎 1:1 蟯螻 讌襷 蠏碁讌 蟆曙磯 . 螻蠍 語 伎 觜訣 蟲覓語朱 覃 , 所 郁鍵螳 覲企 暑 蠍郁伎 襴曙企 襦蠏碁襾瑚 蠍郁 碁 (ISA) 螳 蟆 伎 . C/C++, Python, Java 煙 螻蠍 語伎 觜 蟯 伎觚襴企 蠍郁企ゼ 蠍 語 (Low-Level Language) 手
  • 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
  • 20. 20 蠍郁伎 伎 Portability ( 伎 ) 襦蠏碁 るジ 蠍郁 / 弰 蠍 企 覲蟆曙 譴 High Portability : , 覲蟆曙 蟇一 襦蠏碁 蟆 玖鍵螻企 焔 襦蠏碁 伎煙 襷れ CPU 襷 るジ 蠍郁 (ISA) 襯 蠍 覓 玖蠍 語伎 蟆曙 朱 伎煙 るジ CPU/ISA 蠍 伎 貊襯 れ 貉危 企 CPU/ISA 伎ろ殊 燕
  • 21. 21 C 語 螳 Dennis Ritchie Ken Thompson 螳覦 1969 ~ 1973 Bell Labs 蠏朱 轟 UNIX 伎豌伎 螳覦 覩瑚記 覦 蟲 譴朱 ANSI (American National Standard Institute) C (1989 ) C 語伎 轟 螻蠍 語伎 轟 ( ) 螻 蠍 語伎 螳 ( 觜襯願 ) 蟆碁 Ken Thompson (left) with Dennis Ritchie (right, the inventor of the C programming language) Source - Wikipedia 轟 レ 蟲譟壱(Structured) 襦蠏碁覦 讌 覲旧″ 覓語襯 螳 襦 蟲 , 願屋 . 觚襦 (Block), (Sub-Routine) 煙 螳 牛 襦蠏碁 貊 蟲譟磯ゼ 危危蠍 所 燕螻 曙 伎 (Portability) れ 貉危 弰 伎觚襴 語企 蠍郁伎 觜蟲 レ (Efficiency) 覃覈襴襯 伎 觜襯願 螳ロ 襦蠏碁 燕 れ 一一 襦蠏碁 螳蟆壱螻 所 燕 . ) x = x+1; x++; 覃覈襴 (Dynamic Memory) 蟯襴 覃覈襴 濠骸 伎襯 牛 覯 ろ螻 螳 覃覈襴 蟆曙 蟲 襦蠏碁 燕
  • 22. 22 Compiled Language vs. Interpreted Language ろ / 覈 殊 覿螳 譴 谿 Compiled Language 豌 貊襯 伎 蠍郁 貊襦 覯螻 蠏瑚 覓苦 伎 ろ 殊 燕 Interpreted Language 蟆曙 貊 朱 ( 朱朱 覓語レ ) 襯 伎 蠍郁 貊襦 覯螻 蠏 蟆郁骸襯 覦襦 ろ蟆 . 讀 覲 伎 ろ 殊 燕讌 . Compiled Language 蟆曙 ろ / 覈 殊 朱 れ Compiler 螳 企 ろ 螳ロ讌襷 Interpreted Language 蟆曙 ろ 貊 Interpreter 螳 谿瑚 ) Python るゼ interpretation 讌 螻 Compile 牛 ろ 殊 襷 . 蟆曙 Python Compiled Language 襦 覿襯 . 觜蟲覈 Compiled Language Interpreted Language 語 C/C++, Fortran, Cobol Python, Java, Basic ろ / 覈 ろ 觜襴 朱 襴 伎 (Portability) 朱 . ISA 螳 るジ 貉危一 れ 貉危 伎 誤壱襴磯 朱 ISA 螳 るジ 貉危一 ろ 螳 貊 Interpreter 豢 貊 Compiler 豢 ろ
  • 23. 23 C 語 貉危 れ (1) 蠍 (Explorer) 襯 ろり 襦蠏碁覦 启襯 譴觜 Ex) F:Workspace cmd( 覈 襦 ) ろ螻 启襦 企 Explorer 启襯 蠏碁 1 螻 螳 Explorer 企 蟆暑螳 覃 蠏碁 2 螳 cmd 手 ロ覃 企 启 覈轟綾 cmd ろ cd 煙 覈轟朱 企 gcc ( 貉危朱 ) 襯 ろ 覲企 蠏碁 3 螻 螳 ろ 蟆郁骸襦 る 覃讌螳 豢ル讌襷 ろ 誤 . where gcc 襦 貉危朱 れ 豺襯 誤 . 蠏碁 1 蠏碁 2 蠏碁 3
  • 24. 24 C 語 貉危 れ (2) Cmd notepad hello.c 襯 ロ hello.c 朱 C 貊 殊 启 燕 Hello.c 襯 れ螻 螳 燕螻 ロ . 覃伎 Hello World !!! 朱 覓語伎 豢ロ 襦蠏碁
  • 25. 25 C 語 貉危 れ (3) dir 牛 启 伎 譟伎 殊 誤 . 襦 襷 启朱 Hello.c 朱 貊 朱 譟伎 蟆企 . gcc hello.c 襯 ロ 貉危殊 . dir 牛 貉危 启 伎 譟伎 殊 誤 . a.exe 朱 ろ 殊 誤 蟆企 . a.exe 襯 ろ企慨 .
  • 26. 26 Python Interpretation れ python ろ螻 Hello World !!! 豢 貊襯 燕企慨 . Python shell ろ覃伎 貊襯 ロ Prompt 螳 蟾 Print 覈豪語 Hello World !!! 襯 豢ロ企慨 exit() 襦 Python Shell 譬襭貅 . Notepad hello.py 襯 ろり 狩 貊襯 燕 覲企 . python hello.py 襯 牛 ろ 蟆郁骸襯 誤 . ろ 殊 焔螳 ?
  • 27. 27 貉危 襦蠏碁螻 ろ 貉危 襦蠏碁 (Program) 企 ? Sequence of instructions and related data !!! 覈轟企 蠍郁螳 讌 企螻 ろ 伎 螳朱 蠍郁 (Machine Code) ろ (Executable File) 襦 覲伎^蠍一旧レ / れ 襦蠏碁 ろ 螻殊 覲伎^蠍一旧レ ル 襦蠏碁 ろ 殊 Main Memory 襦 (Loading) 螻 CPU Main Memory 襦覿 襦蠏碁 覈轟企れ 谿朱 曙 れ 伎螻 覦朱 襦蠏碁 ろ (Execution) 谿瑚 ) 襦蠏碁 / ろ S/W 伎豌伎 (OS : Operating System) Input Device Output Device CPU Main Memory Secondary Storage 襦蠏碁 ろ Loading Execution 貉危 H/W 蟲 譴豌襴レ - CPU (Central Processing Unit) 覈轟企ゼ 伎 ろ 旧 蟲 譯手鍵旧レ - Main Memory 襦蠏碁螻 一危磯ゼ ロ 覦 蠍一旧レ ( 谿瑚 ) 蟶殊碁 覲企ゼ 讌 蠍一 レ襯 觜覦 (Non-Volatile), 蠏碁讌 覈詩 レ襯 覦 (Volatile) 蠍一 レ手 覲伎^蠍一旧レ - Secondary Storage 襦蠏碁螻 一危磯ゼ 殊 襦 ロ 觜覦 (Non Volatile) 蠍一旧レ襦 HDD, SSD 煙 豢 レ Input / Output Device 瑚螻 貉危一 譯朱 る慨 , 襷一 , 覈一 螳 レ
  • 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
  • 30. 30 . . . Memory Address Memory bits 襯 ロ れ Memory Cell 一朱 伎伎 蟆 覿覿 貉危磯 , 讀 Memory Cell 1 Byte 襯 Memory Address 一 Memory Cell 譴 企 Cell 所碓 語襯 伎 Address 襷 覦 譴 企 覦 ? Memory Address 貉危一 譯朱 2 讌 Hexa 襦 Memory Address 一企 bits , Memory Cell 蟲覲 螳 豌 覃覈襴 螻糾 蠍一 蟯 ) 覃覈襴 螻糾 蠍磯 4GiBytes 10011010 00000000 10011010 00000000 10011010 00000000 10011010 00000000 . . . Memory Cells 8 000000 000001 000010 000011 111100 111101 111110 111111 . . . Address 1 2 3 4 5
  • 31. 31 ろ 蠍 覓殊 覃伎 蟆 蠍 讌 (disk, platter) 朱 讌 覲企ゼ 郁 曙 一危 レ . ろ 貉危 蟶殊碁 覲願 讌 觜覦 (Non-Volatile) 蠍一 レ企 . ろ 蠏 覃伎 覲企ゼ 郁碓 曙 一企 る 企 . ろ 殊企 ろ襯 觜襯願 り る 豺襯 譟一覃伎 豺 一危磯ゼ 所 蠍郁 レ企 . ろ 蠍磯 5.25 語 (13.34cm), 3.5 語 (8.9cm), 2.5 語 (6.4cm), 1.8 語 (4.6cm) 煙 朱 覿 , 讀 RPM 5400, 7200 煙 . 一ろ PC 3.5 語 , 誤碁 2.5 語 HDD 螳 譯朱 一碁 . 覃覈襴 覦豌企ゼ 襷れ牡襦 一危 レ企 . 覦豌伎企 朱 覃覈襴 覦豌伎 襴 蟶殊碁 覲願 讌 觜覦 (Non- Volatile) 蠍一 レ企 . 朱 覩襦 蠍郁 HDD 覓語 蠍 螳 , 覦 螳 , 蠍郁 讌 , ろ , 蟆 譴 譴 . 螳覲螻 蟆 . 一危 蠏 螳 一 所鍵 郁鍵 HDD 覲企 襴 蟆曙郁 襷讌襷 豕 蠍一 SSD 蟆曙 一 所鍵 郁鍵 HDD 覲企 觜襯企 . SSD 豕 觜 螳蟆伎朱 豕蠏殊 螳蟆 觜襯願 渚螻 . HD (Hard Disk) / HDD (Hard Disk Drive) SSD (Solid State Drive)
  • 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
  • 36. John von Neumann ( 豢豌 Wikipedia) 1903 螳襴 覿ろろ語 覿 螳 ル朱 豢 1926 23 語 企 覿ろろ 覦 豬 , 1930 蟾讌 覯襯朱Π 覲狩 螳 1930 襴一ろ 螻煙郁規襦 豐豌 覦 覩瑚記朱 蟇企螳 螻煙郁規 豕豐 4 覈 蟲讌 譴 覈 . 危 譯曙 蟾讌 螻煙郁規 蟲襦 2 谿 蠍郁 給願鍵 螳覦 襷 襦 谿語 , 給願鍵 螳覦 讌 蠍一 , 豕豐 牛 ろ 讌 蟯谿壱 螻狩 譴 , 危 覩 覿 襯螳 (ICBM) 谿語 , 覦螻 覲伎譯殊襦 蠏轟 給願鍵 麹語 , 蠏 企 蠍一 蠏瑚 譯殊ロ 讀 蟯 , 讀 MAD(Mutually Assured Destruction) 蠍 覩 , 給願鍵 旧伎 . 1957 覦レ 語朱 豢 螻 蟇碁れ 襷 讌 豕螳 豌襦 れ 譟 語企 覓 襾碁Μ螳 譬 煙 , 襷 襯 螳讌 手 覿襴 . 7 螳 瑚記企ゼ 覈蟲 螳 襦 朱 , 覦 覯渚り 伎 . 螳 一企 蠍一給レ 螳讌 碁朱 螳 螻 ル . 覓朱Μ , 伎 , 讌 企 , 貉危 螻狩 , 蟆曙 煙 覿殊 れ 譴 螻牛 . 蟆 企 谿曙 . DNA/RNA 覦蟆 伎 蠏 譟伎襯 豸″ Cellular Automata / Universal Constructor 螳 谿曙 . 蠏語 豌炎骸 蟯 襷 狩れ . ( 谿瑚 1, 谿瑚 2) EDVAC 焔 蟆 . 蟲郁 るジ讓曙 4 覯讌 襴螳 7 螳 2 讌 朱瑚 ? 貉危一 語企 覓語襯 蠍 螻 語企 襾殊 豪Μ . 4-36

Editor's Notes

  • #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.