changeset 8:c59b95705898

...
author matac42 <matac@cr.ie.u-ryukyu.ac.jp>
date Sun, 23 Jan 2022 18:02:15 +0900
parents 124583e0b372
children 5772018b531b
files paper/figs/dgcgdg.png paper/figs/dgcgdg.svg paper/figs/nonDestroyTreeEdit.pdf paper/text/chapter2.tex paper/thesis.pdf
diffstat 5 files changed, 46 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
Binary file paper/figs/dgcgdg.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/paper/figs/dgcgdg.svg	Sun Jan 23 18:02:15 2022 +0900
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Do not edit this file with editors other than diagrams.net -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="569px" height="61px" viewBox="-0.5 -0.5 569 61" content="&lt;mxfile host=&quot;app.diagrams.net&quot; modified=&quot;2022-01-22T08:11:18.287Z&quot; agent=&quot;5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36&quot; etag=&quot;bUReGJG8Fe2_sW51C6dH&quot; version=&quot;16.4.2&quot; type=&quot;device&quot;&gt;&lt;diagram id=&quot;sKEnr8sRbsej93oGyqwn&quot; name=&quot;Page-1&quot;&gt;7VfJkpswEP0ajpMCCWPnGttxKrNUUj5kclRMDyglECWLAfz1EabZMy6yuIbDnFA/dUvqfq8FWHQd5TvFkvBe+iAsYvu5RTcWIY7trMyjRIoK8RYIBIr76NQCe36COhLRlPtw7DlqKYXmSR88yDiGg+5hTCmZ9d2epOjvmrAARsD+wMQY/cZ9HVboiixb/BPwIKx3drz31UzEamfM5BgyX2YdiG4tulZS6moU5WsQZfHqulRxH1+YbQ6mINZTAsgpWp7o1/ghvd0Fn9Po6ce9uFng2XRRJwy+yR9NqXQoAxkzsW3RD0qmsQ/lqraxWp87KRMDOgb8CVoXSCZLtTRQqCOBs5Bz/dgZfy+XerdAa5PjymejqI1Yq+Kxa3SiSrMNO1t1XJVfmdSLZUPoKFN1gAu1quXHVAD6gh9pyDVdATICcx4Tp0AwzZ/752Aoz6Dxaxk0AyTxDwjFdZ+ZSHGnDdNsB0yNmO7zmIVcwz5h5xJkppn7nOGyoDTklys5zhwDVtgIeBPQusWzTl8hFHZayrWvVCrvTfuTtU8map++pvbJSPtr8z6ahfaJPRC/PRa/Q36jfu9a6l++qX+y+ulE9buvqX4635ufejO7+h1nVJOZqv8/qvhf1YmhXyQ3Ozfceu6AWzogreoajBrw1hzj76l053vpu8Mvnite+sZsfyWq2rY/ZHT7Cw==&lt;/diagram&gt;&lt;/mxfile&gt;" style="background-color: rgb(255, 255, 255);"><defs/><g><path d="M 80 30 L 113.63 30" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 118.88 30 L 111.88 33.5 L 113.63 30 L 111.88 26.5 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/><rect x="0" y="10" width="80" height="40" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 78px; height: 1px; padding-top: 30px; margin-left: 1px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">DataGear</div></div></div></foreignObject><text x="40" y="34" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">DataGear</text></switch></g><path d="M 240 30 L 273.63 30" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 278.88 30 L 271.88 33.5 L 273.63 30 L 271.88 26.5 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/><rect x="120" y="0" width="120" height="60" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 118px; height: 1px; padding-top: 30px; margin-left: 121px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">CodeGear</div></div></div></foreignObject><text x="180" y="34" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">CodeGear</text></switch></g><path d="M 360 30 L 393.63 30" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 398.88 30 L 391.88 33.5 L 393.63 30 L 391.88 26.5 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/><rect x="280" y="10" width="80" height="40" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 78px; height: 1px; padding-top: 30px; margin-left: 281px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">DataGear</div></div></div></foreignObject><text x="320" y="34" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">DataGear</text></switch></g><path d="M 520 30 L 553.63 30" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 558.88 30 L 551.88 33.5 L 553.63 30 L 551.88 26.5 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/><rect x="400" y="0" width="120" height="60" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 118px; height: 1px; padding-top: 30px; margin-left: 401px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">CodeGear</div></div></div></foreignObject><text x="460" y="34" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">CodeGear</text></switch></g></g><switch><g requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"/><a transform="translate(0,-5)" xlink:href="https://www.diagrams.net/doc/faq/svg-export-text-problems" target="_blank"><text text-anchor="middle" font-size="10px" x="50%" y="100%">Text is not SVG - cannot display</text></a></switch></svg>
\ No newline at end of file
Binary file paper/figs/nonDestroyTreeEdit.pdf has changed
--- a/paper/text/chapter2.tex	Thu Jan 20 15:02:59 2022 +0900
+++ b/paper/text/chapter2.tex	Sun Jan 23 18:02:15 2022 +0900
@@ -7,19 +7,33 @@
 CbCでは関数の代わりにCodeGearという単位でプログラミングを行う.
 CodeGearは\emph{\_\_code}という記述で宣言することができる.
 データの単位にはDataGearと呼ばれる変数データを用いる.
-DataGearを入力として受け取り,別のDataGearに書き込み出力することができる.
+図\ref{fig:dgcg}はCodeGearとDataGearの関係を表している.
+CodeGearはDataGearを入力として受け取り,別のDataGearに書き込み出力することができる.
 特に入力のDataGearをInput DataGear,出力のDataGearをOutput DataGearと呼ぶ.
 gotoで次のCodeGearに遷移することができ,その際Output DataGearを次のCodeGearのInput DataGearとして渡すことができる.
+\begin{figure}[h]
+  \begin{center}
+      \includegraphics[width=120mm]{figs/dgcgdg.png}
+  \end{center}
+  \caption{非破壊的なTree編集}
+  \label{fig:dgcg}
+\end{figure}
 
-\section{継続}
+\section{軽量継続}
 CodeGearから次のCodeGearに遷移していく一連の動作を継続と呼ぶ.
+通常の関数の場合,関数から次の関数へ遷移する時にfunction callが行われる.
+function callは前の関数へ戻る場合があり,そのためにcall stackを保存する.
 CbCの継続はfunction callをせずにgotoによるjmpで行われる.
-function callによる継続と異なり,jmpによる継続はstackなどの環境を保存しないことから軽量である.
-そのことからCbCにおける継続を特に軽量継続と呼ぶ.
+jmpはfunction callと異なり,call stackのような環境を保存しない.
+よってCbCの継続は関数の繊維と比較して軽量であるといえる.
+そのことからCbCにおける継続をfunction callにおける継続と区別して,軽量継続と呼ぶ.
 
 \section{CbCの記述例}
-CbCのプログラム例をソースコード\ref{src:cbc}に示す.まずmain関数においてadd1 CodeGearへgotoを行う.
+CbCのプログラム例をソースコード\ref{src:cbc}に示す.
+まずmain関数においてadd1 CodeGearへgotoを行う.
 その際add1へInput DataGearとしてnを渡す.
+Cのgotoが\emph{goto label;}という記法で,ラベリングした箇所へjmpを行うのに対し,
+CbCのgotoは\emph{goto add1(n);}という記法で,add1 CodeGearへn DataGearを渡してjmpを行う.
 add1は処理の最後にadd2 CodeGearへgotoを行う.
 その際Output DataGear out\_nをadd2のInput DataGearとして渡す.
 このようにCbCではCodeGearのOutput DataGearを次のCodeGearのInput DataGearとして渡すことを繰り返すことで処理を進める.
@@ -47,12 +61,13 @@
   \begin{center}
       \includegraphics[width=100mm]{figs/meta-cg-dg.pdf}
   \end{center}
-      \caption{CodeGearとMetaCodeGearの関係}
+  \caption{CodeGearとMetaCodeGearの関係}
   \label{fig:meta-cgdg}
 \end{figure}
 
 \section{Context}
-Contextは全てのCodeGear,DataGearを参照することができるMetaDataGearで,従来OSのプロセスに相当する.
+Contextは全てのCodeGear,DataGearを参照することができるMetaDataGearで
+従来OSのプロセスに相当する.
 OS全体のContextを管理するKernel Contextやユーザープログラムごとに存在するUser Contextなどがある.
 ノーマルレベルのCodeGearがContextを直接参照してしまうと,メタレベルを切り分けた意味がなくなってしまう.
 そのためContextは必ずMetaDataGearとしてMetaCodeGearから参照される.
@@ -155,16 +170,29 @@
 
 \section{inodeを用いたdirectory entry}
 \section{非破壊的編集によるBackup}
+\begin{figure}[h]
+  \begin{center}
+      \includegraphics[width=150mm]{figs/nonDestroyTreeEdit.pdf}
+  \end{center}
+  \caption{非破壊的なTree編集}
+  \label{fig:TreeEdit}
+\end{figure}
 
 \chapter{File構造}
 ファイルシステムはディレクトリ構造の他にファイル構造を持つ.
 GearsOSにおけるファイル構造を説明する.
 
 \section{I/O Stream}
+ファイルのInput/Output Streamは競合的なアクセスに対応するため,3つのSynchronizedQueueを用いる.
+それぞれをinputQueue, outputQueue, mainQueueと呼ぶ.
+データをinputしたい場合inputQueueへputを行い,取得したい場合outputQueueからgetを行う.
+mainQueueはデータそのものであり,inputQueueからmainQueue,mainQueueからoutputQueueへデータが流れるように接続される.
+3つのQueueを通過するデータはelementと呼ばれる.
 
 
 \section{logによるバージョン管理}
 
+
 \chapter{WordCount}
 WordCount例題\cite{file}はGearsOSのファイルシステムを構築する際に用いてる例題である.
 指定したファイルの文字数や行数,ファイルの内の文字列を出力する.
@@ -172,6 +200,13 @@
 大きく分けて,指定したファイルをFile構造体としてopenするFileOpenスレッド,
 File構造体を受け取り文字数と行数をcountUpするWordCountスレッドの二つのCodeGearで記述することができる.
 ファイル内の文字列を行ごとにCountUpに送信し,EOFを受け取ったらループを抜けfinishに移行する.
+\begin{figure}[h]
+  \begin{center}
+      \includegraphics[width=100mm]{figs/wordCountStates.pdf}
+  \end{center}
+  \caption{WordCount with CbC}
+  \label{fig:WCStates}
+\end{figure}
 \section{API}
 \section{GearBox的な処理}
 
Binary file paper/thesis.pdf has changed