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
540
How RSpec Works
penelope_zone
0
6.5k
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
88
Other Decks in Technology
See All in Technology
祝!Iceberg祭開幕!re:Invent 2024データレイク関連アップデート10分総ざらい
kniino
3
310
1等無人航空機操縦士一発試験 合格までの道のり ドローンミートアップ@大阪 2024/12/18
excdinc
0
170
サービスでLLMを採用したばっかりに振り回され続けたこの一年のあれやこれや
segavvy
2
490
開発生産性向上! 育成を「改善」と捉えるエンジニア育成戦略
shoota
2
400
ハイテク休憩
sat
PRO
2
170
MLOps の現場から
asei
7
650
統計データで2024年の クラウド・インフラ動向を眺める
ysknsid25
2
850
C++26 エラー性動作
faithandbrave
2
780
[Ruby] Develop a Morse Code Learning Gem & Beep from Strings
oguressive
1
170
権威ドキュメントで振り返る2024 #年忘れセキュリティ2024
hirotomotaguchi
2
760
サイボウズフロントエンドエキスパートチームについて / FrontendExpert Team
cybozuinsideout
PRO
5
38k
スタートアップで取り組んでいるAzureとMicrosoft 365のセキュリティ対策/How to Improve Azure and Microsoft 365 Security at Startup
yuj1osm
0
230
Featured
See All Featured
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
17
2.3k
Typedesign – Prime Four
hannesfritz
40
2.4k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.4k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
66k
Statistics for Hackers
jakevdp
796
220k
Practical Orchestrator
shlominoach
186
10k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.2k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
170
Why Our Code Smells
bkeepers
PRO
335
57k
BBQ
matthewcrist
85
9.4k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.2k
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]