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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Satoru Takeuchi
PRO
July 10, 2024
Technology
490
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
68
Linuxカーネルの インタフェースは変わりうる?
sat
PRO
1
93
あなたの知らないバージョン命名規則
sat
PRO
3
900
Rook: Intro and Deep Dive with Ceph
sat
PRO
1
64
Machine Check Exception
sat
PRO
2
66
バイナリダンプの模様を読む
sat
PRO
0
89
cpコマンドはディスク上でデータを コピーしないことがある
sat
PRO
3
87
114-ファイルのshallow_copy.pdf
sat
PRO
2
57
113-Btrfsのスナップショット.pdf
sat
PRO
0
40
Other Decks in Technology
See All in Technology
2026-09-11 【Snowflake World Tour Tokyo 2026】Snowflakeを起点に、AI Agentが自律稼働し続ける未来へ / Driving AI Agents with Snowflake
civitaspo
0
400
aws-iot-platform-architecture-use-cases.pdf
ma2shita
0
110
積み重なった技術負債への挑戦 〜初手としての全社ゴト化〜
techtekt
PRO
0
1.2k
おい、エージェントを使って終わらせろ
nwiizo
0
230
例外の正しい扱い方 そのエラー try-catchして大丈夫?
jinwatanabe
3
500
TinyGo 開発サイクルを高速化する:Go で作るエミュレータ入門
zozotech
PRO
1
740
LLMに渡さなかった仕事
nanaism
0
170
新機種発売前に見直そう!端末移行で再ログインが要るアプリ・要らないアプリは何が違うのか 〜シームレスに再開できる設計と実装〜
zozotech
PRO
0
190
Claude in Chrome 入門 / Introduction to Claude in Chrome
cielo1985
0
800
AI de Idea
kawaguti
PRO
2
110
Deploying a Full-Stack Bun-Native Framework on Cloudflare Workers
7nohe
0
170
AI時代、データエンジニアが一番おもろい
genshun9
0
580
Featured
See All Featured
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
Fashionably flexible responsive web design (full day workshop)
malarkey
409
67k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
6.2k
Practical Orchestrator
shlominoach
191
12k
Typedesign – Prime Four
hannesfritz
42
3.2k
Optimizing for Happiness
mojombo
378
71k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.3k
Documentation Writing (for coders)
carmenintech
77
5.5k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.9k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
520
Utilizing Notion as your number one productivity tool
mfonobong
4
590
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.2k
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