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
520
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
85
Other Decks in Technology
See All in Technology
普通の Web エンジニアのための様相論理入門 #yapcjapan / YAPC Hakodate 2024
ytaka23
5
1.2k
FastAPIでのasync defとdefの使い分け
takashi1029
6
1.9k
スタサプ ForSCHOOLアプリのシンプルな設計
recruitengineers
PRO
2
190
[JAWS-UG GameTech] 第6回 各種事例紹介_18TRIPにおけるAWSサービスを活用した負荷テスト・障害テスト
naoto_yasuda
0
140
過去のインプットとアウトプットを振り返る
diggymo
0
110
XP matsuri 2024 - 銀河英雄伝説に学ぶ
kawaguti
PRO
3
540
Strict Concurrencyにしたらdeinitでクラッシュする話
0si43
0
120
いまからでも遅くない! コンテナでWebアプリケーションを 動かしてみよう(2-1)WebAPI座学
nomu
0
150
【shownet.conf_】ローカル5Gを活用したウォーキングツアーの体感向上
shownet
PRO
0
320
第45回 MLOps 勉強会 - ML Test Score を用いた機械学習システムの定量的なアセスメント
masatakashiwagi
3
290
業務ヒアリングと知識の呪い
tamai_63
0
220
Oracle Database 23ai 新機能#4 Rolling Maintenance
oracle4engineer
PRO
0
120
Featured
See All Featured
A Tale of Four Properties
chriscoyier
155
22k
Being A Developer After 40
akosma
84
590k
No one is an island. Learnings from fostering a developers community.
thoeni
19
2.9k
Optimising Largest Contentful Paint
csswizardry
31
2.8k
YesSQL, Process and Tooling at Scale
rocio
167
14k
Teambox: Starting and Learning
jrom
131
8.7k
What the flash - Photography Introduction
edds
67
11k
Producing Creativity
orderedlist
PRO
341
39k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
327
21k
The Cult of Friendly URLs
andyhume
77
6k
How to train your dragon (web standard)
notwaldorf
87
5.6k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
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]