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
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
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
67
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
研究開発部の紹介 / Sansan R&D Profile
sansan33
PRO
5
25k
Snowflakeで実現する全社横断の顧客の声(VOC)分析・活用基盤@Snowflake World Tour Tokyo 2026
yuto16
0
200
安心して変更できるWebフロントエンドの作り方
pirosikick
4
2k
リージョンの壁を越える、 ちょっと変わったAWSサービスの話
falken
PRO
1
310
2026_devsumi_ozono.pdf
o3
3
450
Gitは怖い?共有ワークスペースから始めるSnowflakeチーム開発
coco_se
0
190
2026-09-09 【sigma_ucj#1】Sigma を IaC 管理したい! / IaC for Sigma
civitaspo
0
130
Snowflakeのコスト最適化を支えるアーキテクチャ設計
ktatsuya
1
1.5k
データ界隈LT祭 第1回LT登壇
taromatsui_cccmkhd
1
990
株式会社シーエーシー エンジニア向け会社紹介資料
cac
0
57k
多層防御と最⼩権限で実現する、安全なAIエージェント設計パターン
lycorptech_jp
PRO
1
280
Claude in Chrome 入門 / Introduction to Claude in Chrome
cielo1985
0
660
Featured
See All Featured
sira's awesome portfolio website redesign presentation
elsirapls
0
410
From π to Pie charts
rasagy
0
360
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.9k
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
530
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.2k
Color Theory Basics | Prateek | Gurzu
gurzu
0
460
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.6k
Accessibility Awareness
sabderemane
1
210
Faster Mobile Websites
deanohume
310
32k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
560
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