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
プロセスへのメモリ割り当て(3) 実際に使うときにメモリを獲得するデマンドページング
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Satoru Takeuchi
PRO
July 13, 2024
Technology
210
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
プロセスへのメモリ割り当て(3) 実際に使うときにメモリを獲得するデマンドページング
以下動画のテキストです。
https://youtu.be/3mpurVs_8Sc
Satoru Takeuchi
PRO
July 13, 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
omasushiというライブラリを作った
polidog
PRO
0
220
Gitは怖い?共有ワークスペースから始めるSnowflakeチーム開発
coco_se
0
190
SREは、MCPとAutopilotをこう使え!
kazumax55
1
140
クロスボーダーM&AのValue Upを支えるプロダクト開発。日米チームのハブになったプロダクトエンジニアの実践 / Product Engineering Conference 2026
genda
0
120
2026-09-09 【sigma_ucj#1】Sigma を IaC 管理したい! / IaC for Sigma
civitaspo
0
130
薬剤師(ドメインエキスパート)と一緒に育てる薬局向けAIアシスタント
kakehashi
PRO
2
160
From Vanilla Kubernetes to a Batteries-Included Platform: Developer Experience at 1,300+ Clusters
yosshi_
0
700
2026-09-10 【Snowflake World Tour Tokyo 2026】dbt Core と Snowflake で実現する多層的なデータガバナンス / Multi-Layered Data Governance Powered by dbt Core and Snowflake
civitaspo
0
360
Microsoft 365 Copilot chat -tekoälypalvelun tietosuojaongelmat
hponka
0
840
Omarchy Quattro の日本語設定周り
simosako
2
170
越境するなら専門用語を使うな高校校歌 / If you wanna cross border, you shouldn't use jargon
vtryo
0
130
例外の正しい扱い方 そのエラー try-catchして大丈夫?
jinwatanabe
3
480
Featured
See All Featured
So, you think you're a good person
axbom
PRO
2
2.2k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.5k
The browser strikes back
jonoalderson
0
1.7k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
590
Un-Boring Meetings
codingconduct
0
410
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
63
46k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
600
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
120
120k
The Pragmatic Product Professional
lauravandoore
37
7.4k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
990
Code Reviewing Like a Champion
maltzj
528
40k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
410
Transcript
プロセスへのメモリ割り当て(3) 実際に使うときにメモリを獲得する デマンドページング Jul. 10th, 2024 Satoru Takeuchi X: satoru_takeuchi
1
はじめに • 過去動画でmmapによってプロセスに物理メモリを割り当てると説明 ◦ 📝 過去動画「プロセスへのメモリ割り当て (1) mmap」 • デマンドページングという機能を使うと少し違った挙動をする
◦ mmapは、新たにmapした領域にプロセスからアクセス可能にするだけ ◦ 実際に物理メモリを割り当てるのは最初に使うとき ◦ メモリ使用量をおさえられる ◦ Linuxはデマンドページングを使っている • むずかしいので例によって図解 2
今回出てくる概念 • (おさらい) present bit ◦ ページに物理メモリが割り当てられているかを示すフラグ ◦ ページテーブルエントリごとに存在 •
vm_area_struct ◦ mmapした領域ごとに存在するカーネルが管理するデータ構造 ◦ ページテーブルとは別の領域 3
それぞれの関係 4 物理メモリ 仮想アドレス空間 0 100 200 プロセスのメモリ 500 600
700 未マップ領域 仮想アドレス present bit 物理アドレス 0-100 〇 500-600 100-200 〇 600-700 200-300 × vm_area_struct 範囲 0-200 ページテーブル
mmapを発行すると… 5 物理メモリ 仮想アドレス空間 0 100 200 プロセスのメモリ 500 600
700 未マップ領域 仮想アドレス present bit 物理アドレス 0-100 〇 500-600 100-200 〇 600-700 200-300 × vm_area_struct 範囲 0-200 ページテーブル ここを新たにマップしたとする 300
デマンドページングが無い場合 mmap時にメモリマップ更新&物理メモリ割り当て 6 物理メモリ 仮想アドレス空間 0 100 200 プロセスのメモリ 500
600 700 未マップ領域 仮想アドレス present bit 物理アドレス 0-100 〇 500-600 100-200 〇 600-700 200-300 〇 800-900 vm_area_struct 範囲 0-300 ページテーブル プロセスのメモリ 800 900 300
デマンドページングがある場合 mmap時にメモリマップ更新&物理メモリは割り当てない 7 物理メモリ 仮想アドレス空間 0 100 200 プロセスのメモリ 500
600 700 未マップ領域 仮想アドレス present bit 物理アドレス 0-100 〇 500-600 100-200 〇 600-700 200-300 × - vm_area_struct 範囲 0-300 ページテーブル 300
mmapした領域への初回アクセス時 8 物理メモリ 仮想アドレス空間 0 100 200 プロセスのメモリ 500 600
700 未マップ領域 仮想アドレス present bit 物理アドレス 0-100 〇 500-600 100-200 〇 600-700 200-300 × - vm_area_struct 範囲 0-300 ページテーブル 300 ここへのアクセス
ここで物理メモリ割り当て 9 物理メモリ 仮想アドレス空間 0 100 200 プロセスのメモリ 500 600
700 未マップ領域 仮想アドレス present bit 物理アドレス 0-100 〇 500-600 100-200 〇 600-700 200-300 〇 800-900 vm_area_struct 範囲 0-300 ページテーブル プロセスのメモリ 800 900 300 ここへの初回アクセス
まとめ • デマンドページングによってメモリ使用量を抑えられる ◦ マップしたものの、まだ使ってない領域には物理メモリは割り当てられない • Linuxはデマンドページングを使っている • 実例は別動画で紹介 •
具体的にどのように実現しているのかも別動画で紹介 ◦ カーネルとCPUの連携によって実現 10