annotate paper/Paging.tex @ 11:f7ed2b4874f4

xv6 reference
author tobaru
date Tue, 04 Feb 2020 11:16:19 +0900
parents a882e390f9a2
children 9cf9e0b086c7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8
737421115770 chapter cbc_interface and impl_paging
tobaru
parents: 7
diff changeset
1 \chapter{CbCXv6 での Paging}
7
6e1a4452265e interface
tobaru
parents: 6
diff changeset
2 OS の信頼性の基本である メモリ管理 の書き換えについて説明する。
6e1a4452265e interface
tobaru
parents: 6
diff changeset
3
6
4dd10e3e45d2 chapter exchange
tobaru
parents: 5
diff changeset
4
4dd10e3e45d2 chapter exchange
tobaru
parents: 5
diff changeset
5 \section{Xv6 を元にした Gears OS の実装}
8
737421115770 chapter cbc_interface and impl_paging
tobaru
parents: 7
diff changeset
6 Gears OS ではハードウェア上でメタレベルの計算や並列実行を行いたいので、
737421115770 chapter cbc_interface and impl_paging
tobaru
parents: 7
diff changeset
7 Raspberry Pi でもバイナリを出力できる Xv6 を CbC で書き換える。
6
4dd10e3e45d2 chapter exchange
tobaru
parents: 5
diff changeset
8 ANSI-C で書かれている Xv6 を CbC に書き直し、それを元に Gears OS を実装していく。
4dd10e3e45d2 chapter exchange
tobaru
parents: 5
diff changeset
9
4
a4a1a68d8811 Paging, Context
tobaru
parents: 3
diff changeset
10 \section{Paging}
5
73697739a74d context xv6 paging
tobaru
parents: 4
diff changeset
11 メモリ管理の手法に、Paging がある。Paging ではメモリを Page と呼ばれる固定長の単位に分割し、メモリとスワップ領域で Page を入れ替えて管理を行う。
10
a882e390f9a2 dummy, reference, thanks
tobaru
parents: 9
diff changeset
12 \par
4
a4a1a68d8811 Paging, Context
tobaru
parents: 3
diff changeset
13
11
f7ed2b4874f4 xv6 reference
tobaru
parents: 10
diff changeset
14 図 \ref{fig:MEmoryConstitution} で Xv6の仮想メモリと実メモリについて説明する。
f7ed2b4874f4 xv6 reference
tobaru
parents: 10
diff changeset
15
9
dfb52a12c5a1 fig : MemoryConstitution
tobaru
parents: 8
diff changeset
16
dfb52a12c5a1 fig : MemoryConstitution
tobaru
parents: 8
diff changeset
17 \begin{figure}[ht]
dfb52a12c5a1 fig : MemoryConstitution
tobaru
parents: 8
diff changeset
18 \begin{center}
dfb52a12c5a1 fig : MemoryConstitution
tobaru
parents: 8
diff changeset
19 \includegraphics[width=160mm]{./fig/MemoryConstitution}
dfb52a12c5a1 fig : MemoryConstitution
tobaru
parents: 8
diff changeset
20 \end{center}
dfb52a12c5a1 fig : MemoryConstitution
tobaru
parents: 8
diff changeset
21 \caption{Layout of the virtual address space of a process and the layout of the physical address
dfb52a12c5a1 fig : MemoryConstitution
tobaru
parents: 8
diff changeset
22 space. Note that if a machine has more than 2 Gbyte of physical memory, xv6 can use only the memory
dfb52a12c5a1 fig : MemoryConstitution
tobaru
parents: 8
diff changeset
23 that fits between KERNBASE and 0xFE00000. Russ Cox(2018) xv6 a simple, Unix-like teaching operating system (Frans Kaashoek, Robert Morris)}
dfb52a12c5a1 fig : MemoryConstitution
tobaru
parents: 8
diff changeset
24 \label{fig:MemoryConstitution}
dfb52a12c5a1 fig : MemoryConstitution
tobaru
parents: 8
diff changeset
25 \end{figure}
dfb52a12c5a1 fig : MemoryConstitution
tobaru
parents: 8
diff changeset
26
dfb52a12c5a1 fig : MemoryConstitution
tobaru
parents: 8
diff changeset
27
6
4dd10e3e45d2 chapter exchange
tobaru
parents: 5
diff changeset
28 \section{User Space で Paging をする利点}
5
73697739a74d context xv6 paging
tobaru
parents: 4
diff changeset
29 Context に必要な Page Tbale を提供する Interface と User Space からアクセスする API が必要である。
73697739a74d context xv6 paging
tobaru
parents: 4
diff changeset
30 Page Table に相当するデータを Input Data Gear で受け取って変更した後、Context にあるメモリコントロールを担当する Meta Data Gear に goto で遷移してアクセスする。 Meta Computation レベルで処理することで Use Spaceでも Page Table を操作することができる。
73697739a74d context xv6 paging
tobaru
parents: 4
diff changeset
31 Meta Computation に戻る際に、Page Table Entry のバリデーションをチェックして反映することで、他のプロセスから Page Table を書き換えられることを防ぐ。また、サンドボックスにしておいて、他のプロセスが書き換えられた時にエクセプションを飛ばすようにすることで信頼性の保証を行う。
4
a4a1a68d8811 Paging, Context
tobaru
parents: 3
diff changeset
32
a4a1a68d8811 Paging, Context
tobaru
parents: 3
diff changeset
33
a4a1a68d8811 Paging, Context
tobaru
parents: 3
diff changeset
34 \section{Paging の書き換え}
7
6e1a4452265e interface
tobaru
parents: 6
diff changeset
35 Xv6 では実メモリ(Physical memory) から仮想メモリ(Virtual memory)の変換を vm.c で行なっている。
6e1a4452265e interface
tobaru
parents: 6
diff changeset
36 vm.c を CbC で書き換えていく。
6e1a4452265e interface
tobaru
parents: 6
diff changeset
37
6e1a4452265e interface
tobaru
parents: 6
diff changeset
38
6e1a4452265e interface
tobaru
parents: 6
diff changeset
39