Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
What is processor?
Search
Penelope Phippen
April 09, 2016
Technology
1
340
What is processor?
Penelope Phippen
April 09, 2016
Tweet
Share
More Decks by Penelope Phippen
See All by Penelope Phippen
Introducing Rubyfmt
penelope_zone
0
530
How RSpec Works
penelope_zone
0
6.4k
Quick and easy browser testing using RSpec and Rails 5.1
penelope_zone
1
75
Teaching RSpec to play nice with Rails
penelope_zone
2
120
Little machines that eat strings
penelope_zone
1
84
What is processor (brighton ruby edition)
penelope_zone
0
94
extremely defensive coding - rubyconf edition
penelope_zone
0
250
Agile, etc.
penelope_zone
2
210
Extremely Defensive Coding
penelope_zone
0
86
Other Decks in Technology
See All in Technology
Zennのパフォーマンスモニタリングでやっていること
ryosukeigarashi
0
170
The Rise of LLMOps
asei
9
1.7k
インフラとバックエンドとフロントエンドをくまなく調べて遅いアプリを早くした件
tubone24
1
430
Amplify Gen2 Deep Dive / バックエンドの型をいかにしてフロントエンドへ伝えるか #TSKaigi #TSKaigiKansai #AWSAmplifyJP
tacck
PRO
0
390
BLADE: An Attempt to Automate Penetration Testing Using Autonomous AI Agents
bbrbbq
0
320
開発生産性を上げながらビジネスも30倍成長させてきたチームの姿
kamina_zzz
2
1.7k
Application Development WG Intro at AppDeveloperCon
salaboy
0
200
Flutterによる 効率的なAndroid・iOS・Webアプリケーション開発の事例
recruitengineers
PRO
0
120
[CV勉強会@関東 ECCV2024 読み会] オンラインマッピング x トラッキング MapTracker: Tracking with Strided Memory Fusion for Consistent Vector HD Mapping (Chen+, ECCV24)
abemii
0
230
飲食店データの分析事例とそれを支えるデータ基盤
kimujun
0
190
OCI Network Firewall 概要
oracle4engineer
PRO
0
4.2k
rootlessコンテナのすゝめ - 研究室サーバーでもできる安全なコンテナ管理
kitsuya0828
3
390
Featured
See All Featured
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
109
49k
Rails Girls Zürich Keynote
gr2m
94
13k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
The Art of Programming - Codeland 2020
erikaheidi
52
13k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
4
370
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
93
16k
The Invisible Side of Design
smashingmag
298
50k
Site-Speed That Sticks
csswizardry
0
31
Transcript
What is Processor?
I am @samphippen on all the internets
I do not work for Test Double
But I love them and also @searls
“How would Sam write this code?”
“How would Sam write this code?”
None
This talk is full of convenient lies
None
None
None
None
3.days.ago
new DateTime( System.currentTime() - 3 * 24 * 3600 )
Thinking in terms of the domain
Instead of thinking in terms of the computer
This is one way we can measure abstraction
Amount of computers
None
Amount of computers
SQL Amount of computers
select * from sheep_parts
None
None
None
None
SQL Amount of computers
SQL C Amount of computers
Let’s look at one difference
None
None
None
None
None
None
None
None
Human readable source code at execution time
Interpreted
Compiled
None
(it’s a gnu)
(it’s a gnu)
None
Source code separate at execution time
So why is C “low level”
None
C code does not model modern processors
It models old processors
Modern compilers turn old model assembly into new model assembly
C is not fundamental in any sense
Memory Allocation
Memory access
Memory Release
C Amount of computers
C Assembly Amount of computers
Register Tiny piece of memory in the processor that can
beaccessed very quickly
mov 3, $c mov 4, $d add $c, $d, $a
Operation mov 3, $c mov 4, $d add $c, $d,
$a
Operand mov 3, $c mov 4, $d add $c, $d,
$a
Operand mov 3, $c mov 4, $d add $c, $d,
$a
mov 3, $c mov 4, $d add $c, $d, $a
Operand Register reference
a: nil b: nil c: nil d: nil mov 3,
$c mov 4, $d add $c, $d, $a
a: nil b: nil c: 3 d: nil mov 3,
$c mov 4, $d add $c, $d, $a
a: nil b: nil c: 3 d: nil mov 3,
$c mov 4, $d add $c, $d, $a
a: nil b: nil c: 3 d: 4 mov 3,
$c mov 4, $d add $c, $d, $a
a: nil b: nil c: 3 d: 4 mov 3,
$c mov 4, $d add $c, $d, $a
a: 7 b: nil c: 3 d: 4 mov 3,
$c mov 4, $d add $c, $d, $a
(it’s a gnu)
None
None
None
C Assembly Amount of computers
Assembly Binary Amount of computers
None
0x16 01 00 00 0x33 04 05 01 0x23 81
32 00
Operation 0x16 01 00 00 0x33 04 05 01 0x23
81 32 00
0x16 01 00 00 0x33 04 05 01 0x23 81
32 00 Operand
0x16 01 00 00 0x33 04 05 01 0x23 81
32 00 Operand
Operand 0x16 01 00 00 0x33 04 05 01 0x23
81 32 00
Let’s talk about how machine code gets executed
(one model)
Fetch
Decode
Execute
Retire
FDER
None
None
None
None
None
0: 0x36010000 1: 0x03040501 2: 0x23813200
0: 0x36010000 1: 0x03040501 2: 0x23813200
0: 0x36010000 1: 0x03040501 2: 0x23813200 PC: 0
0: 0x36010000 1: 0x03040501 2: 0x23813200 PC: 0
0: 0x36010000 1: 0x03040501 2: 0x23813200 PC: 0 IR: <nil>
0: 0x36010000 1: 0x03040501 2: 0x23813200 PC: 0 IR: <nil>
0: 0x36010000 1: 0x03040501 2: 0x23813200 PC: 0 IR: 0x36010000
Decode
add 1,2,$c 0x36010283
0x36010283
0x36010283 0x36: add
0x36010283 0x36: add 0x01: value 1
0x36010283 0x36: add 0x01: value 1 0x02: value 2
0x36010283 0x36: add 0x01: value 1 0x02: value 2 0x83:
register 3
None
None
IR: 0x36010283 PC: 0
IR: 0x36010283 PC: 0 A: <nil>
IR: 0x36010283 PC: 0 A: <nil> B: <nil>
IR: 0x36010283 PC: 0 A: <nil> B: <nil> C: <nil>
IR: 0x36010283 PC: 0 A: <nil> B: <nil> C: <nil>
IR: 0x36010283 PC: 0 A: <nil> B: <nil> C: <nil>
IR: 0x36010283 PC: 0 A: <nil> B: <nil> C: <nil>
IR: 0x36010283 PC: 0 A: <nil> B: <nil> C: <nil>
IR: 0x36010283 PC: 0 A: <nil> B: <nil> C: <nil>
Execute
IR: 0x36010283 PC: 0 A: <nil> B: <nil> C: <nil>
IR: 0x36010283 PC: 0 C: <nil>
IR: 0x36010283
IR: 0x36 01 02 83
IR: 0x36 01 02 83
IR: 0x36 01 02 83 +
IR: 0x36 01 02 83 +
IR: 0x36 01 02 83 +
IR: 0x36 01 02 83 10 2 +
IR: 0x36 01 02 83 10 2 +
IR: 0x36 01 02 83 10 2 +
IR: 0x36 01 02 83 10 2 3 +
Retire
IR: 0x36010283 PC: 0 A: <nil> B: <nil> C: <nil>
IR: 0x36010283 PC: 0 A: <nil> B: <nil> C: <nil>
3
IR: 0x36010283 PC: 0 A: <nil> B: <nil> C: <nil>
3
IR: 0x36010283 PC: 0 A: <nil> B: <nil> C: <nil>
3
IR: 0x36010283 PC: 0 A: <nil> B: <nil> C: <nil>
3
IR: 0x36010283 PC: 0 A: <nil> B: <nil> C: 3
3
IR: <nil> PC: 1 A: <nil> B: <nil> C: 3
3
None
None
0: 0x36010000 1: 0x03040501 2: 0x23813200
0: 0x36010000 1: 0x03040501 2: 0x23813200
0: 0x36010000 1: 0x03040501 2: 0x23813200 PC: 1
0: 0x36010000 1: 0x03040501 2: 0x23813200 PC: 1
This process repeats
That’s how programs execute (kinda) (I’m still lying to you)
Fetch: get instruction from memory into processor
Decode: prep processor for instruction
Execute: do computation
Retire: results and cleanup
Thanks @samphippen
[email protected]