Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
すべてはバイナリ
Search
Satoru Takeuchi
PRO
June 06, 2020
Technology
220
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
すべてはバイナリ
以下動画のテキストです。
https://youtu.be/8qg2b8ZZm_c
Satoru Takeuchi
PRO
June 06, 2020
More Decks by Satoru Takeuchi
See All by Satoru Takeuchi
119-多機能ファイルシステムBtrfs_のコピー.pdf
sat
PRO
1
79
Linuxカーネルの インタフェースは変わりうる?
sat
PRO
1
110
あなたの知らないバージョン命名規則
sat
PRO
3
920
Rook: Intro and Deep Dive with Ceph
sat
PRO
1
74
Machine Check Exception
sat
PRO
2
71
バイナリダンプの模様を読む
sat
PRO
0
110
cpコマンドはディスク上でデータを コピーしないことがある
sat
PRO
3
110
114-ファイルのshallow_copy.pdf
sat
PRO
2
62
113-Btrfsのスナップショット.pdf
sat
PRO
0
46
Other Decks in Technology
See All in Technology
USB PDを使ってスマホを労わりたい
raspython3
0
180
『SAR衛星データ解析入門』のご紹介とその応用
syuchimu
0
120
PagerDuty Tech Hub-鳴らすけれど、人は動かない
ezaki
0
170
無理せず続ける、子育てエンジニアの学び
codmoninc
PRO
0
870
DWH の限界突破! AI エージェント向け爆速リアルタイムデータ基盤 ClickHouse
jozono
1
470
AIカンパニーへの転換を支えた、エンジニアの仕事の再定義
kworkdev
PRO
2
1.2k
パッチ更新でterraform initが落ちた日
grimoh
1
140
Persisting Massive Data with Rails ~Designing for 60 billion rows, and fighting the bottlenecks~ Railsで挑む大量データ永続化 〜600億件を永続化するための設計とボトルネックとの戦い〜
occhi
0
730
Webの常識が通じないHTMLメールのダークモード
teamlab
PRO
0
120
TinyGoでオブザーバビリティ?OpenTelemetryはTinyGoで使えるのか / Is OpenTelemetry available in TinyGo environment?
ymotongpoo
2
140
実践! SRE × AI - ABEMA における AIOps -
tetsuya28
8
3.1k
Running Kotlin + Quarkus with Lambda
nealle
1
3.7k
Featured
See All Featured
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
710
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
360
The Language of Interfaces
destraynor
162
27k
Deep Space Network (abreviated)
tonyrice
0
370
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
330
Prompt Engineering for Job Search
mfonobong
0
520
The Mindset for Success: Future Career Progression
greggifford
PRO
0
540
The Curious Case for Waylosing
cassininazir
1
570
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
540
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
1
280
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
630
Transcript
すべてはバイナリ Jun 6th, 2020 Satoru Takeuchi Twitter: satoru_takeuchi 1
目次 1. コンピュータにおける情報の表現方法 2. 整数の表現方法 3. 文字の表現方法 4. まとめ 2
目次 1. コンピュータにおける情報の表現方法 2. 整数の表現方法 3. 文字の表現方法 4. まとめ 3
コンピュータシステムのデータといえば… • 人間から見て半端な、不自然な数が多い ◦ データの単位であるバイトは 8bit → 10bitじゃだめなの? ◦ メモリ量16GB、32GBとか
→ なぜ30GBとか40GBじゃだめなの? ◦ 32 bit CPUとか64bit CPUとか → なぜ50bitとか100bitじゃだめなの? • これらの数値は全部2^n • 理由: データは2^n単位で扱うのが自然 4
データの実体 • データは何らかの物理的な素子のon/offのかたまりであらわされる ◦ メモリ(DRAM), SSD: 素子内の電荷 ◦ HDD: 磁性体の磁化の向き
◦ DVD: ディスク表面の溝の深さが閾値以上かどうか • たくさんのデータを表現したければ素子を大量に並べる • 1つが1ビット、ビットが8つ集まると1バイト 5 素子1つ: 表現できる状態は2つ 素子2つ: 表現できる状態は4つ off off off on off on on off on on
データの数値表記 • データは二進表記するのが便利 ◦ ビットが立っているかどうかが一目でわかる 6 素子の状態: 素子の数は3つ → 3bit
10進表記 2進表記 0 000 1 001 2 010 3 011 4 100 5 101 6 110 7 111 off off off off off on off on off off on on on off off on off on on on off on on on
16進表記 • 2進表記は桁数が大きくなるのでデータは16進数で表現することが多い • 便宜上一桁を0~9,a~fで表現する。fに1を足すと桁上がり 7 データの2進表記 16進表記 00000 0
00001 1 .... ... 01111 f 10000 10
すべてはバイナリ • すべてのデータはビットないしバイトの列 ◦ 2進表記されることが多いので一般にバイナリ /バイナリデータと呼ぶ • データの例 ◦ 整数
◦ 文字列 ◦ 画像 ◦ 音声 ◦ 動画 • それぞれ規格が決まっている ◦ ときには自分で決めなければいけないこともある ▪ 例: 独自アプリ内のデータ通信方法 8
目次 1. コンピュータにおける情報の表現方法 2. 整数の表現方法 3. 文字の表現方法 4. まとめ 9
表現方法 • 0以上の整数(符号なし整数)について扱う ◦ 負の数を考えると2の補数が云々とか難しい話が出てくるので省略 • データの2進数表記がそのまま数値に対応するのでスゲエ楽! 10 0以上の整数の値 データの2進表記
10進表記 16進表記 0 00000 0 0 1 00001 1 1 2 00010 2 2 ... ... .... ... 15 01111 15 f 16 10000 16 10
演習 • 使うもの ◦ xxdプログラム(xxdパッケージに入っている ): ファイルの中身を2進表記や16進表記で見る ◦ (自作)numプログラム: 1バイトで表現される符号なし整数値を標準出力に書き込む
• やること ◦ 以下の表に記載されている整数値の 2進、16進データ表現を見る 11 0以上の整数の値 データの2進表記 16進表記 0 00000 0 1 00001 1 2 00010 2 ... ... ... 15 01111 f 16 10000 10
目次 1. コンピュータにおける情報の表現方法 2. 整数の表現方法 3. 文字の表現方法 4. まとめ 12
表現方法 • ASCII Codeという規格について扱う ◦ https://www.ieee.li/computer/ascii.htm ◦ 1バイトで一文字を扱う ◦ 数値、アルファベット
(小文字、大文字)、一部記号を表現可能 • 日本語とか考え出すと終わらないので省略 ◦ キーワード: Unicode, UTF-8, 文字コード, 地獄 13
演習 • 使うもの ◦ xxd • やること ◦ 適当に文字やら文字列をファイルに書いて xxdで覗いてみる
14
目次 1. コンピュータにおける情報の表現方法 2. 整数の表現方法 3. 文字の表現方法 4. まとめ 15
まとめ • データは物理的素子の状態(on/off)によって表現する ◦ 2つの状態をあらわすものがビット、それが 8つ集まるとバイト ◦ 2進表記、16進表記が楽 • すべてのデータはビット列で表現されるバイナリ
• 多くのデータは表現方法が規格化されている 16