Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
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
88
Other Decks in Technology
See All in Technology
メインテーマはKubernetes
nwiizo
2
300
SAP Community and Developer Update
sygyzmundovych
0
360
EthernetベースのGPUクラスタ導入による学びと展望
lycorptech_jp
PRO
0
400
Microsoft Ignite 2024 Update 2 - AIとIoT関連の最新情報をどこよりも早く!
iotcomjpadmin
0
170
TypeScript100%で作るMovable Typeプラグイン
usualoma
2
260
Microsoft 365と開発者ツールの素敵な関係
kkamegawa
1
1.1k
Mastering Quickfix
daisuzu
2
470
そろそろOn-Callの通知音について考えてみよう (PagerDuty編)
tk3fftk
1
220
MediaPipe と ML Kit ってどう ちがうの? / What is the difference between MediaPipe and ML Kit?
yanzm
0
160
RDRAとLLM
kanzaki
4
480
コンパウンド戦略に向けた技術選定とリアーキテクチャ
kworkdev
PRO
1
4k
LLMを「速く」「安く」 動かすには / CloudNative Days Winter 2024
pfn
PRO
4
1.2k
Featured
See All Featured
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
47
2.1k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
111
49k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
247
1.3M
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
330
21k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
Happy Clients
brianwarren
98
6.7k
Into the Great Unknown - MozCon
thekraken
33
1.5k
BBQ
matthewcrist
85
9.3k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Intergalactic Javascript Robots from Outer Space
tanoku
269
27k
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]