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
プロセスへのメモリ割り当て(1) mmap
Search
Satoru Takeuchi
PRO
July 10, 2024
Technology
500
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
プロセスへのメモリ割り当て(1) mmap
以下動画のテキストです。
https://youtu.be/n7mq-LYx5SY
Satoru Takeuchi
PRO
July 10, 2024
More Decks by Satoru Takeuchi
See All by Satoru Takeuchi
119-多機能ファイルシステムBtrfs_のコピー.pdf
sat
PRO
1
78
Linuxカーネルの インタフェースは変わりうる?
sat
PRO
1
110
あなたの知らないバージョン命名規則
sat
PRO
3
920
Rook: Intro and Deep Dive with Ceph
sat
PRO
1
73
Machine Check Exception
sat
PRO
2
70
バイナリダンプの模様を読む
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
転んだ話が背中を預ける理由になる / A_story_about_falling_down_gives_you_a_reason_to_watch_each_other_s_backs.pdf
pauli
3
370
自作バイナリを動かす「入口」8選
puhitaku
2
1.3k
Webの常識が通じないHTMLメールのダークモード
teamlab
PRO
0
110
Rustuna: Rustによる高速なOptuna実装
pfn
PRO
0
140
M5Stackで作る BLEマウス GPSログの世界
tomokusaba
0
290
UniFi(ユニファイ)AIカメラの現場活用
ludicmind
1
430
無理せず続ける、子育てエンジニアの学び
codmoninc
PRO
0
730
継続的なAIコスト最適化
bgpat
1
300
Getting Started with Google Antigravity
glaforge
0
260
AI時代に必要な脅威モデリング― 変化の速度に負けない理解とリスク判断
masakane55
5
1.3k
10年後、Engineering 行為を剥奪されるとして、わたしたちは、どう、何を創ればいいだろうか。 / If Engineering Is Taken Away in 10 Years, How and What Should We Create?
bitkey
PRO
1
170
Benchmarking Disaggregated Serving on vLLM + Dynamo with a Real Coding-Agent Workload
nttcom
0
130
Featured
See All Featured
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.9k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.5k
Odyssey Design
rkendrick25
PRO
2
870
The Spectacular Lies of Maps
axbom
PRO
1
1.1k
brightonSEO & MeasureFest 2025 - Winning Strategies for Black Friday CRO & PPC - Christian Goodrich
cargoodrich
3
870
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
560
Reality Check: Gamification 10 Years Later
codingconduct
0
2.3k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
560
HDC tutorial
michielstock
2
960
sira's awesome portfolio website redesign presentation
elsirapls
0
450
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.4k
Transcript
プロセスへのメモリ割り当て(1) mmap Jul. 8th, 2024 Satoru Takeuchi X: satoru_takeuchi 1
はじめに • 前提 ◦ メモリはプロセスが起動するときに割り当てられる ◦ 足りなければ動的にメモリを獲得する • はなすこと ◦
プロセスはどうやって動的にメモリを獲得するのか • 備考 ◦ 📝 デマンドページング(今は意味がわからなくて OK)は無いものとして話します ▪ たぶん次回説明します 2
プロセスはどうやって動的にメモリを獲得するのか • mmapというシステムコールを使います ◦ 📝 brkというのもありますが割愛 • インタフェース: man 2
mmapより抜粋 ◦ void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset); ▪ length: マップする領域の長さ ▪ 戻り値: マップされた領域のアドレス • バイト単位ではなくページ単位で割り当てる 3
mmapのイメージ 4 物理メモリ 仮想アドレス空間 プロセスAのメモリ mmap発行前 mmap発行後 物理メモリ 仮想アドレス空間 プロセスAのメモリ
拡張された領域 未割当 未割当 mmapで割当
実機確認 • mmapによって新規メモリ領域がマップされたことを確認 • mmap.goプログラム ◦ プロセスのメモリマップ (/proc/<pid>/maps)を表示 ◦ mmapでメモリ領域を獲得
◦ プロセスのメモリマップを再度表示 5
まとめ • プロセスへのメモリ割り当てにはmmapというシステムコールを使う • 割り当てはページ単位で行う 6