changeset 4:a4a1a68d8811

Paging, Context
author tobaru
date Tue, 28 Jan 2020 16:00:07 +0900
parents db8087751680
children 73697739a74d
files paper/GearsOS.tex paper/Paging.tex paper/Xv6.tex paper/master_paper.aux paper/master_paper.lof paper/master_paper.log paper/master_paper.lol paper/master_paper.lot paper/master_paper.pdf paper/master_paper.sty paper/master_paper.synctex.gz paper/master_paper.tex paper/master_paper.toc paper/src/context.h thsis_paging.mm thsis_paging.pdf
diffstat 16 files changed, 138 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- a/paper/GearsOS.tex	Mon Jan 27 23:08:31 2020 +0900
+++ b/paper/GearsOS.tex	Tue Jan 28 16:00:07 2020 +0900
@@ -30,7 +30,7 @@
  CbC ではノーマルレベルの記述と別にメタレベルで記述することができる.メタレベルの記述によって User Space 側からメモリ管理を行えるようになる.
 \par
 メタ計算は Meta Code Gear と Meta Data Gear を用いる.この2つはノーマルレベルからメタレベルの変換する時に使われる.メタレベルの変換は Perl スクリプトで実装している.Gears OS での Meta Code Gear は Code Gear の直前, 直後に挿入され,メタ計算を実行する.
-Code Gear 間の継続はノーマルレベルでは 図 \ref{fig:codegear} のように見えるが,メタレベルでの Code Gear は図 \ref{fig:meta_cg_dg } の下のように継続を行っている.
+Code Gear 間の継続はノーマルレベルでは 図 \ref{fig:codegear} のように見えるが,メタレベルでの Code Gear は図 \ref{fig:meta_cg_dg} の下のように継続を行っている.
 
  \begin{figure}[ht]
  \begin{center}
@@ -41,3 +41,12 @@
 \end{figure}
 
 
+\section{Context}
+ Gears OS の Context は Meta Data Gear であり,接続可能な Code Gear と Data Gear のリスト, Data Gear を確保するメモリ空間などを持っている.
+従来のスレッドやプロセスに対応する.Gears OS では Code Gear と Data Gear への接続を Context を通して行う.Context が持つ Data Gear のメモリ空間は事前に確保され,Data Gear のメモリ確保の際に heap の値をずらしてメモリを割り当てる.
+% パルスさん3.1
+
+
+\lstinputlisting[label=contexth, caption=Context]{./src/context.h}
+
+ソースコードの説明書く
--- a/paper/Paging.tex	Mon Jan 27 23:08:31 2020 +0900
+++ b/paper/Paging.tex	Tue Jan 28 16:00:07 2020 +0900
@@ -1,2 +1,12 @@
 \chapter{Gears OS での Paging} 
+
+\section{Paging}
   メモリ管理の手法に, Paging がある.Paging ではメモリを Page と呼ばれる固定長の単位に分割し,メモリとスワップ領域で Page を入れ替えて管理を行う.
+
+\section{Gears OS での 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 の書き換え}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/paper/Xv6.tex	Tue Jan 28 16:00:07 2020 +0900
@@ -0,0 +1,2 @@
+\chapter{Xv6 から Gears OS への書き換え}
+
--- a/paper/master_paper.aux	Mon Jan 27 23:08:31 2020 +0900
+++ b/paper/master_paper.aux	Tue Jan 28 16:00:07 2020 +0900
@@ -9,9 +9,18 @@
 \@writefile{lof}{\contentsline {figure}{\numberline {2.1}{\ignorespaces Code Gear 間の継続}}{3}\protected@file@percent }
 \newlabel{fig:codegear}{{2.1}{3}}
 \@writefile{toc}{\contentsline {section}{\numberline {2.2}Meta Code Gear と Meta Data Gear}{4}\protected@file@percent }
-\@writefile{lof}{\contentsline {figure}{\numberline {2.2}{\ignorespaces ノーマルレベルとメタレベルの継続の見え方}}{5}\protected@file@percent }
-\newlabel{fig:meta_cg_dg}{{2.2}{5}}
-\@writefile{toc}{\contentsline {chapter}{\numberline {第3章}Gears OS での Paging}{6}\protected@file@percent }
+\@writefile{toc}{\contentsline {section}{\numberline {2.3}Context}{4}\protected@file@percent }
+\newlabel{contexth}{{2.1}{4}}
+\@writefile{lol}{\contentsline {lstlisting}{\numberline {2.1}Context}{4}\protected@file@percent }
+\@writefile{lof}{\contentsline {figure}{\numberline {2.2}{\ignorespaces ノーマルレベルとメタレベルの継続の見え方}}{6}\protected@file@percent }
+\newlabel{fig:meta_cg_dg}{{2.2}{6}}
+\@writefile{toc}{\contentsline {chapter}{\numberline {第3章}Xv6 から Gears OS への書き換え}{7}\protected@file@percent }
 \@writefile{lof}{\addvspace {10\p@ }}
 \@writefile{lot}{\addvspace {10\p@ }}
-\@writefile{toc}{\contentsline {chapter}{付録}{6}\protected@file@percent }
+\@writefile{toc}{\contentsline {chapter}{\numberline {第4章}Gears OS での Paging}{8}\protected@file@percent }
+\@writefile{lof}{\addvspace {10\p@ }}
+\@writefile{lot}{\addvspace {10\p@ }}
+\@writefile{toc}{\contentsline {section}{\numberline {4.1}Paging}{8}\protected@file@percent }
+\@writefile{toc}{\contentsline {section}{\numberline {4.2}Gears OS での Paging}{8}\protected@file@percent }
+\@writefile{toc}{\contentsline {section}{\numberline {4.3}Paging の書き換え}{8}\protected@file@percent }
+\@writefile{toc}{\contentsline {chapter}{付録}{8}\protected@file@percent }
--- a/paper/master_paper.lof	Mon Jan 27 23:08:31 2020 +0900
+++ b/paper/master_paper.lof	Tue Jan 28 16:00:07 2020 +0900
@@ -1,5 +1,6 @@
 \addvspace {10\p@ }
 \addvspace {10\p@ }
 \contentsline {figure}{\numberline {2.1}{\ignorespaces Code Gear 間の継続}}{3}%
-\contentsline {figure}{\numberline {2.2}{\ignorespaces ノーマルレベルとメタレベルの継続の見え方}}{5}%
+\contentsline {figure}{\numberline {2.2}{\ignorespaces ノーマルレベルとメタレベルの継続の見え方}}{6}%
 \addvspace {10\p@ }
+\addvspace {10\p@ }
--- a/paper/master_paper.log	Mon Jan 27 23:08:31 2020 +0900
+++ b/paper/master_paper.log	Tue Jan 28 16:00:07 2020 +0900
@@ -1,4 +1,4 @@
-This is e-pTeX, Version 3.14159265-p3.8.2-190131-2.6 (utf8.euc) (TeX Live 2019) (preloaded format=platex 2020.1.16)  27 JAN 2020 20:36
+This is e-pTeX, Version 3.14159265-p3.8.2-190131-2.6 (utf8.euc) (TeX Live 2019) (preloaded format=platex 2020.1.16)  28 JAN 2020 15:57
 entering extended mode
  restricted \write18 enabled.
  file:line:error style messages enabled.
@@ -300,10 +300,6 @@
 (Font)              scaled to size 11.54663pt on input line 71.
 LaTeX Font Info:    Font shape `JY1/hmc/bx/n' will be
 (Font)              scaled to size 11.54663pt on input line 71.
-LaTeX Font Info:    Font shape `JT1/utfj/bx/f' will be
-(Font)              scaled to size 11.54663pt on input line 71.
-LaTeX Font Info:    Font shape `JY1/utfj/bx/f' will be
-(Font)              scaled to size 11.54663pt on input line 71.
 
 Overfull \hbox (2.61108pt too wide) in paragraph at lines 71--72
 []$[]$[] []$[]$[] 
@@ -367,47 +363,44 @@
 [3
 
 ]
-
-LaTeX Warning: Reference `fig:meta_cg_dg ' on page 4 undefined on input line 33
-.
-
 File: ./fig/meta_cg_dg.pdf Graphic file (type pdf)
 <./fig/meta_cg_dg.pdf>
 
+
 LaTeX Warning: Float too large for page by 43.27322pt on input line 41.
 
-) (./Paging.tex
+(./src/context.h
+LaTeX Font Info:    Font shape `JT1/hmc/m/n' will be
+(Font)              scaled to size 7.69775pt on input line 1.
 LaTeX Font Info:    Font shape `JT1/hmc/m/n' will be
-(Font)              scaled to size 10.53629pt on input line 1.
+(Font)              scaled to size 10.53629pt on input line 24.
 LaTeX Font Info:    Font shape `JY1/hmc/m/n' will be
-(Font)              scaled to size 10.53629pt on input line 1.
+(Font)              scaled to size 10.53629pt on input line 24.
 LaTeX Font Info:    Font shape `JT1/hmc/bx/n' will be
-(Font)              scaled to size 10.53629pt on input line 1.
+(Font)              scaled to size 10.53629pt on input line 24.
 LaTeX Font Info:    Font shape `JY1/hmc/bx/n' will be
-(Font)              scaled to size 10.53629pt on input line 1.
- [4] [5]
-第 3 章(6ページ)
-) [6
+(Font)              scaled to size 10.53629pt on input line 24.
+ [4])) (./Xv6.tex [5] [6]
+第 3 章(7ページ)
+) (./Paging.tex [7
+
+]
+第 4 章(8ページ)
+) [8
 
 ] (./master_paper.aux)
 
 LaTeX Font Warning: Size substitutions with differences
 (Font)              up to 1.28pt have occurred.
 
-
-LaTeX Warning: There were undefined references.
-
-
-LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.
-
  ) 
 Here is how much of TeX's memory you used:
- 6034 strings out of 493985
- 87286 string characters out of 6166648
- 130106 words of memory out of 5000000
- 10363 multiletter control sequences out of 15000+600000
- 16141 words of font info for 82 fonts, out of 8000000 for 9000
+ 6300 strings out of 493985
+ 89276 string characters out of 6166648
+ 281110 words of memory out of 5000000
+ 10622 multiletter control sequences out of 15000+600000
+ 16375 words of font info for 82 fonts, out of 8000000 for 9000
  107 hyphenation exceptions out of 8191
- 30i,10n,36p,481b,992s stack positions out of 5000i,500n,10000p,200000b,80000s
+ 38i,11n,36p,481b,1841s stack positions out of 5000i,500n,10000p,200000b,80000s
 
-Output written on master_paper.dvi (13 pages, 11528 bytes).
+Output written on master_paper.dvi (15 pages, 22852 bytes).
--- a/paper/master_paper.lol	Mon Jan 27 23:08:31 2020 +0900
+++ b/paper/master_paper.lol	Tue Jan 28 16:00:07 2020 +0900
@@ -0,0 +1,1 @@
+\contentsline {lstlisting}{\numberline {2.1}Context}{4}%
--- a/paper/master_paper.lot	Mon Jan 27 23:08:31 2020 +0900
+++ b/paper/master_paper.lot	Tue Jan 28 16:00:07 2020 +0900
@@ -1,3 +1,4 @@
 \addvspace {10\p@ }
 \addvspace {10\p@ }
 \addvspace {10\p@ }
+\addvspace {10\p@ }
Binary file paper/master_paper.pdf has changed
--- a/paper/master_paper.sty	Mon Jan 27 23:08:31 2020 +0900
+++ b/paper/master_paper.sty	Tue Jan 28 16:00:07 2020 +0900
@@ -207,16 +207,16 @@
       \bf\commission
       \vskip 3 em
       \underline{                  印}\\
-      (主 査)    和田 知久    
+      (主 査)    玉城 史朗   
       \vskip 2 em
       \underline{                  印}\\
-      (副 査)    岡\UTF{FA11} 威生    
+      (副 査)    遠藤 聡志   
       \vskip 2 em
       \underline{                  印}\\
-      (副 査)    赤嶺 有平    
+      (副 査)    名嘉村 盛和  
       \vskip 2 em
       \underline{                  印}\\
-      (副 査)    河野 真治    
+      (副 査)    河野 真治   
     \end{center}
   \end{minipage}
 }
Binary file paper/master_paper.synctex.gz has changed
--- a/paper/master_paper.tex	Mon Jan 27 23:08:31 2020 +0900
+++ b/paper/master_paper.tex	Tue Jan 28 16:00:07 2020 +0900
@@ -27,7 +27,7 @@
 
 \markleftfoot{% 左下に挿入
   \begin{minipage}{.8\textwidth}
-    Gears OS の並列処理
+    Gears OS の Paging
 \end{minipage}}
 
 \newcommand\figref[1]{図 \ref{fig:#1}}
@@ -96,6 +96,7 @@
 % \input{introduction.tex}
  \input{memory_manage.tex}
 \input{GearsOS.tex}
+\input{Xv6.tex}
 \input{Paging.tex}
 
 
--- a/paper/master_paper.toc	Mon Jan 27 23:08:31 2020 +0900
+++ b/paper/master_paper.toc	Tue Jan 28 16:00:07 2020 +0900
@@ -2,5 +2,10 @@
 \contentsline {chapter}{\numberline {第2章}Geas OS}{3}%
 \contentsline {section}{\numberline {2.1}Code Gear と Data Gear}{3}%
 \contentsline {section}{\numberline {2.2}Meta Code Gear と Meta Data Gear}{4}%
-\contentsline {chapter}{\numberline {第3章}Gears OS での Paging}{6}%
-\contentsline {chapter}{付録}{6}%
+\contentsline {section}{\numberline {2.3}Context}{4}%
+\contentsline {chapter}{\numberline {第3章}Xv6 から Gears OS への書き換え}{7}%
+\contentsline {chapter}{\numberline {第4章}Gears OS での Paging}{8}%
+\contentsline {section}{\numberline {4.1}Paging}{8}%
+\contentsline {section}{\numberline {4.2}Gears OS での Paging}{8}%
+\contentsline {section}{\numberline {4.3}Paging の書き換え}{8}%
+\contentsline {chapter}{付録}{8}%
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/paper/src/context.h	Tue Jan 28 16:00:07 2020 +0900
@@ -0,0 +1,62 @@
+/* Context definition */
+struct Context {
+    enum Code next;
+    int codeNum;
+    __code (**code) (struct Context*);
+    union Data **data;
+    void* heapStart;
+    void* heap;
+    long heapLimit;
+    int dataNum;
+
+    // task parameter
+    int idgCount; //number of waiting dataGear
+    int idg;
+    int maxIdg;
+    int odg;
+    int maxOdg;
+    int gpu; // GPU task
+    struct Worker* worker;
+    struct TaskManager* taskManager;
+    struct Context* task;
+    struct Element* taskList;
+#ifdef USE_CUDAWorker
+    int num_exec;
+    CUmodule module;
+    CUfunction function;
+#endif
+    /* multi dimension parameter */
+    int iterate;
+    struct Iterator* iterator;
+};
+
+union Data {
+    struct Meta {
+        enum DataType type;
+        long size;
+        long len;
+        struct Queue* wait; // tasks waiting this dataGear
+    } Meta;
+    struct Context Context;
+    // Stack Interface
+    struct Stack {
+        union Data* stack;
+        union Data* data;
+        union Data* data1;
+        enum Code whenEmpty;
+        enum Code clear;
+        enum Code push;
+        enum Code pop;
+        enum Code pop2;
+        enum Code isEmpty;
+        enum Code get;
+        enum Code get2;
+        enum Code next;
+    } Stack;
+    // Stack implementations
+    struct SingleLinkedStack {
+        struct Element* top;
+    } SingleLinkedStack;
+    ....
+}; // union Data end       this is necessary for context generator
+
--- a/thsis_paging.mm	Mon Jan 27 23:08:31 2020 +0900
+++ b/thsis_paging.mm	Tue Jan 28 16:00:07 2020 +0900
@@ -11,6 +11,7 @@
 <node CREATED="1580107798502" ID="ID_1870725834" MODIFIED="1580107827464" TEXT="Meta &#x306e;&#x8aac;&#x660e;&#x3068;&#x9077;&#x79fb;&#x56f3;"/>
 <node CREATED="1580107483687" ID="ID_1285374455" MODIFIED="1580107511777" TEXT="Context"/>
 <node CREATED="1580107513101" ID="ID_1602648466" MODIFIED="1580107516575" TEXT="Interface"/>
+<node CREATED="1580188243030" ID="ID_1781662530" MODIFIED="1580188249498" TEXT="Meta Computation"/>
 </node>
 <node CREATED="1580107585579" ID="ID_1626415670" MODIFIED="1580107610152" POSITION="right" TEXT="Xv6 &#x304b;&#x3089; GearsOS &#x3078;&#x306e;&#x66f8;&#x304d;&#x63db;&#x3048;">
 <node CREATED="1580107648436" ID="ID_422947198" MODIFIED="1580108849848" TEXT="Raspberry Pi &#x306f;&#x5fc5;&#x8981;&#x306a;&#x3044;??"/>
Binary file thsis_paging.pdf has changed