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
80
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
10分でわかるfreeeのQA
freee
1
3.4k
いまならこう作りたい AWSコンテナ[本格]入門ハンズオン 〜2024年版 ハンズオンの構想〜
horsewin
9
2.1k
日経電子版におけるリアルタイムレコメンドシステム開発の事例紹介/nikkei-realtime-recommender-system
yng87
1
500
AIを駆使したゲーム開発戦略: 新設AI組織の取り組み / sge-ai-strategy
cyberagentdevelopers
PRO
1
130
現地でMeet Upをやる場合の注意点〜反省点を添えて〜
shotashiratori
0
520
[JAWS-UG金沢支部×コンテナ支部合同企画]コンテナとは何か
furuton
3
250
バクラクにおける可観測性向上の取り組み
yuu26
3
410
Gradle: The Build System That Loves To Hate You
aurimas
2
140
LeSSに潜む「隠れWF病」とその処方箋
lycorptech_jp
PRO
2
120
オニオンアーキテクチャで実現した 本質課題を解決する インフラ移行の実例
hryushm
14
3k
生成AIの強みと弱みを理解して、生成AIがもたらすパワーをプロダクトの価値へ繋げるために実践したこと / advance-ai-generating
cyberagentdevelopers
PRO
1
180
Automated Promptingを目指すその前に / Before we can aim for Automated Prompting
rkaga
0
110
Featured
See All Featured
Testing 201, or: Great Expectations
jmmastey
38
7k
Optimising Largest Contentful Paint
csswizardry
33
2.9k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
231
17k
Navigating Team Friction
lara
183
14k
The Pragmatic Product Professional
lauravandoore
31
6.3k
Designing Experiences People Love
moore
138
23k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Into the Great Unknown - MozCon
thekraken
31
1.5k
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Documentation Writing (for coders)
carmenintech
65
4.4k
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]