view paper/Paging.tex @ 11:f7ed2b4874f4

xv6 reference
author tobaru
date Tue, 04 Feb 2020 11:16:19 +0900
parents a882e390f9a2
children 9cf9e0b086c7
line wrap: on
line source

\chapter{CbCXv6 での Paging} 
 OS の信頼性の基本である メモリ管理 の書き換えについて説明する。


\section{Xv6 を元にした Gears OS の実装}
Gears OS ではハードウェア上でメタレベルの計算や並列実行を行いたいので、
Raspberry Pi でもバイナリを出力できる Xv6 を CbC で書き換える。
ANSI-C で書かれている Xv6 を CbC に書き直し、それを元に Gears OS を実装していく。

\section{Paging}
  メモリ管理の手法に、Paging がある。Paging ではメモリを Page と呼ばれる固定長の単位に分割し、メモリとスワップ領域で Page を入れ替えて管理を行う。
\par

図 \ref{fig:MEmoryConstitution} で Xv6の仮想メモリと実メモリについて説明する。


 \begin{figure}[ht]
 \begin{center}
  \includegraphics[width=160mm]{./fig/MemoryConstitution}
 \end{center}
 \caption{Layout of the virtual address space of a process and the layout of the physical address
space. Note that if a machine has more than 2 Gbyte of physical memory, xv6 can use only the memory
that fits between KERNBASE and 0xFE00000. Russ Cox(2018) xv6 a simple, Unix-like teaching operating system (Frans Kaashoek, Robert Morris)} 
 \label{fig:MemoryConstitution}
\end{figure}


\section{User Space で Paging をする利点}
 Context に必要な Page Tbale を提供する Interface と User Space からアクセスする API が必要である。
Page Table に相当するデータを Input Data Gear で受け取って変更した後、Context にあるメモリコントロールを担当する Meta Data Gear に goto で遷移してアクセスする。 Meta Computation レベルで処理することで Use Spaceでも Page Table を操作することができる。
Meta Computation に戻る際に、Page Table Entry のバリデーションをチェックして反映することで、他のプロセスから Page Table を書き換えられることを防ぐ。また、サンドボックスにしておいて、他のプロセスが書き換えられた時にエクセプションを飛ばすようにすることで信頼性の保証を行う。


\section{Paging の書き換え}
 Xv6 では実メモリ(Physical memory) から仮想メモリ(Virtual memory)の変換を vm.c で行なっている。
vm.c を CbC で書き換えていく。