# HG changeset patch # User tobaru # Date 1519104507 -32400 # Node ID d5507629a56b40ef3c629de6bbaece02cc64bf42 # Parent 612de2705907df97c8de51cf967259bf57b42153 mv name diff -r 612de2705907 -r d5507629a56b paper/main.log --- a/paper/main.log Tue Feb 20 12:45:39 2018 +0900 +++ b/paper/main.log Tue Feb 20 14:28:27 2018 +0900 @@ -1,4 +1,4 @@ -This is e-pTeX, Version 3.14159265-p3.7-160201-2.6 (utf8.euc) (TeX Live 2016) (preloaded format=platex 2017.5.28) 19 FEB 2018 20:16 +This is e-pTeX, Version 3.14159265-p3.7-160201-2.6 (utf8.euc) (TeX Live 2016) (preloaded format=platex 2017.5.28) 20 FEB 2018 12:53 entering extended mode restricted \write18 enabled. file:line:error style messages enabled. @@ -267,4 +267,4 @@ 929 hyphenation exceptions out of 8191 27i,8n,43p,326b,1133s stack positions out of 5000i,500n,10000p,200000b,80000s -Output written on main.dvi (18 pages, 30196 bytes). +Output written on main.dvi (18 pages, 30304 bytes). diff -r 612de2705907 -r d5507629a56b paper/main.pdf Binary file paper/main.pdf has changed diff -r 612de2705907 -r d5507629a56b paper/main.synctex.gz Binary file paper/main.synctex.gz has changed diff -r 612de2705907 -r d5507629a56b paper/main.tex --- a/paper/main.tex Tue Feb 20 12:45:39 2018 +0900 +++ b/paper/main.tex Tue Feb 20 14:28:27 2018 +0900 @@ -386,6 +386,7 @@ \item targetオプションでarm-linux-gnueabiを指定することで、armのコードを生成している。 \item mfpu=neon-fp16 はARMv7の浮動小数点を有効にしている。 \item marmでARMの命令セットをターゲットにしている。 + \item mfloat-abi=hard は浮動小数点演算にハードウェア命令を使用する \end{itemize} \break @@ -429,8 +430,7 @@ - Linux 用の gcc を CbC に書き直す際に、gcc7 に書き直せば linker がそのまま使えるので、 - xv6 で動くようになる。 + \begin{lstlisting}[frame=lrbt,label=Linux_GCC_CrossCompile,caption={LinuxでのGCC CrossCompile}] @@ -466,6 +466,9 @@ \item ASFLAGS \end{itemize} +なお、 Linux 用の gcc を CbC に書き直す際に、gcc7 に書き直せば linker がそのまま使えるので、 + xv6 で動くようになる。 + \break \section{xv6} diff -r 612de2705907 -r d5507629a56b proceeding/last-proceeding.aux --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/proceeding/last-proceeding.aux Tue Feb 20 14:28:27 2018 +0900 @@ -0,0 +1,24 @@ +\relax +\@writefile{toc}{\contentsline {section}{\numberline {1}Raspberry Pi上での Gears OS}{1}} +\@writefile{toc}{\contentsline {section}{\numberline {2}Raspberry Pi 上での実装}{1}} +\@writefile{toc}{\contentsline {section}{\numberline {3}CrossCompile}{1}} +\@writefile{lot}{\contentsline {table}{\numberline {1}{\ignorespaces make時間の比較}}{1}} +\newlabel{tab:make_time}{{1}{1}} +\@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces 図の例}}{1}} +\newlabel{fig:examples}{{1}{1}} +\citation{*} +\bibstyle{junsrt} +\bibdata{reference} +\bibcite{kaito:2015}{1} +\bibcite{gears}{2} +\bibcite{kokubo:2016}{3} +\bibcite{llvm}{4} +\@writefile{lof}{\contentsline {figure}{\numberline {2}{\ignorespaces Raspberry Pi}}{2}} +\newlabel{fig:RaspberryPi}{{2}{2}} +\@writefile{toc}{\contentsline {section}{\numberline {4}OSX CrossCompile}{2}} +\@writefile{lof}{\contentsline {figure}{\numberline {3}{\ignorespaces OSX}}{2}} +\newlabel{fig:OSX}{{3}{2}} +\@writefile{toc}{\contentsline {section}{\numberline {5}Linux CrossCompile}{2}} +\@writefile{lof}{\contentsline {figure}{\numberline {4}{\ignorespaces OSX Linux VM}}{2}} +\newlabel{fig:OSX_Linux_VM}{{4}{2}} +\@writefile{toc}{\contentsline {section}{\numberline {6}今後の課題}{2}} diff -r 612de2705907 -r d5507629a56b proceeding/last-proceeding.bbl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/proceeding/last-proceeding.bbl Tue Feb 20 14:28:27 2018 +0900 @@ -0,0 +1,19 @@ +\begin{thebibliography}{1} + +\bibitem{kaito:2015} +{徳森 海斗, 河野真治}. +\newblock Llvm clang 上の continuation based c コンパイラ の改良, 2015. + +\bibitem{gears} +{伊波立樹, 東恩納琢偉, 河野真治}. +\newblock Code gear、data gear に基づく os のプロトタイプ, 2016. + +\bibitem{kokubo:2016} +{小久保翔平, 河野真治}. +\newblock Code segment と data segment を持つ gears os の設計, 2016. + +\bibitem{llvm} +{The LLVM Compiler Infrastructure}. +\newblock \url{http://llvm.org}. + +\end{thebibliography} diff -r 612de2705907 -r d5507629a56b proceeding/last-proceeding.blg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/proceeding/last-proceeding.blg Tue Feb 20 14:28:27 2018 +0900 @@ -0,0 +1,47 @@ +This is pBibTeX, Version 0.99d-j0.33 (utf8.euc) (TeX Live 2016) +Capacity: max_strings=35307, hash_size=35307, hash_prime=30011 +The top-level auxiliary file: mid_thesis.aux +The style file: junsrt.bst +Database file #1: reference.bib +You've used 4 entries, + 2270 wiz_defined-function locations, + 554 strings with 4492 characters, +and the built_in function-call counts, 665 in all, are: += -- 32 +> -- 16 +< -- 0 ++ -- 8 +- -- 4 +* -- 5 +:= -- 81 +add.period$ -- 8 +call.type$ -- 4 +change.case$ -- 3 +chr.to.int$ -- 0 +cite$ -- 4 +duplicate$ -- 44 +empty$ -- 97 +format.name$ -- 8 +if$ -- 161 +int.to.chr$ -- 0 +int.to.str$ -- 4 +missing$ -- 0 +newline$ -- 19 +num.names$ -- 4 +pop$ -- 46 +preamble$ -- 1 +purify$ -- 0 +quote$ -- 0 +skip$ -- 42 +stack$ -- 0 +substring$ -- 0 +swap$ -- 4 +text.length$ -- 0 +text.prefix$ -- 0 +top$ -- 0 +type$ -- 0 +warning$ -- 0 +while$ -- 4 +width$ -- 5 +write$ -- 33 +is.kanji.str$ -- 28 diff -r 612de2705907 -r d5507629a56b proceeding/last-proceeding.log --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/proceeding/last-proceeding.log Tue Feb 20 14:28:27 2018 +0900 @@ -0,0 +1,236 @@ +This is e-pTeX, Version 3.14159265-p3.7-160201-2.6 (utf8.euc) (TeX Live 2016) (preloaded format=platex 2017.5.28) 20 FEB 2018 14:27 +entering extended mode + restricted \write18 enabled. + file:line:error style messages enabled. + %&-line parsing enabled. +**last-proceeding.tex +(./last-proceeding.tex +pLaTeX2e <2016/05/07> (based on LaTeX2e <2016/03/31>) +Babel <3.9r> and hyphenation patterns for 83 language(s) loaded. +(/usr/local/texlive/2016/texmf-dist/tex/platex/base/jarticle.cls +Document Class: jarticle 2006/06/27 v1.6 Standard pLaTeX class +\c@@paper=\count81 +(/usr/local/texlive/2016/texmf-dist/tex/platex/base/jsize10.clo +File: jsize10.clo 2006/06/27 v1.6 Standard pLaTeX file (size option) +) +\c@part=\count82 +\c@section=\count83 +\c@subsection=\count84 +\c@subsubsection=\count85 +\c@paragraph=\count86 +\c@subparagraph=\count87 +\c@figure=\count88 +\c@table=\count89 +\abovecaptionskip=\skip41 +\belowcaptionskip=\skip42 +\symmincho=\mathgroup4 +LaTeX Font Info: Overwriting symbol font `mincho' in version `bold' +(Font) JY1/mc/m/n --> JY1/gt/m/n on input line 593. +\toclineskip=\dimen118 +\@lnumwidth=\dimen119 +\bibindent=\dimen120 +\heisei=\count90 +) +(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/graphicx.sty +Package: graphicx 2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR) + +(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/keyval.sty +Package: keyval 2014/10/28 v1.15 key=value parser (DPC) +\KV@toks@=\toks15 +) +(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/graphics.sty +Package: graphics 2016/05/09 v1.0r Standard LaTeX Graphics (DPC,SPQR) + +(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/trig.sty +Package: trig 2016/01/03 v1.10 sin cos tan (DPC) +) +(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics-cfg/graphics.cfg +File: graphics.cfg 2016/01/02 v1.10 sample graphics configuration +) +Package graphics Info: Driver file: dvipdfmx.def on input line 96. + +(/usr/local/texlive/2016/texmf-dist/tex/latex/dvipdfmx-def/dvipdfmx.def +File: dvipdfmx.def 2016/04/06 v4.08 LaTeX color/graphics driver for dvipdfmx (T +eX Live/ChoF) + +(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/infwarerr.sty +Package: infwarerr 2016/05/16 v1.4 Providing info/warning/error messages (HO) +) +(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/ltxcmds.sty +Package: ltxcmds 2016/05/16 v1.23 LaTeX kernel commands for general use (HO) +))) +\Gin@req@height=\dimen121 +\Gin@req@width=\dimen122 +) +(./picins.sty Option `picins' Version 3.0 Sep. 1992, TH Darmstadt/HRZ +\@BILD=\box41 +\@TEXT=\box42 +\d@breite=\dimen123 +\d@hoehe=\dimen124 +\d@xoff=\dimen125 +\d@yoff=\dimen126 +\d@shad=\dimen127 +\d@dash=\dimen128 +\d@boxl=\dimen129 +\d@pichskip=\dimen130 +\d@tmp=\dimen131 +\d@tmpa=\dimen132 +\d@bskip=\dimen133 +\hsiz@=\dimen134 +\p@getot@l=\dimen135 +\c@breite=\count91 +\c@hoehe=\count92 +\c@xoff=\count93 +\c@yoff=\count94 +\c@pos=\count95 +\c@shad=\count96 +\c@dash=\count97 +\c@boxl=\count98 +\c@zeilen=\count99 +\@changemode=\count100 +\c@piccaption=\count101 +\c@piccaptionpos=\count102 +\c@picpos=\count103 +\c@whole=\count104 +\c@half=\count105 +\c@tmp=\count106 +\c@tmpa=\count107 +\c@tmpb=\count108 +\c@tmpc=\count109 +\c@tmpd=\count110 +\d@leftskip=\skip43 +\ptoti=\dimen136 +\ptotii=\dimen137 +\env@box=\box43 +\d@envdp=\dimen138 +\c@hsize=\count111 +\c@envdp=\count112 +\d@envb=\dimen139 +) +(/usr/local/texlive/2016/texmf-dist/tex/latex/fancyhdr/fancyhdr.sty +\fancy@headwidth=\skip44 +\f@ncyO@elh=\skip45 +\f@ncyO@erh=\skip46 +\f@ncyO@olh=\skip47 +\f@ncyO@orh=\skip48 +\f@ncyO@elf=\skip49 +\f@ncyO@erf=\skip50 +\f@ncyO@olf=\skip51 +\f@ncyO@orf=\skip52 +) +(/usr/local/texlive/2016/texmf-dist/tex/latex/abstract/abstract.sty +Package: abstract 2009/06/08 v1.2a configurable abstracts +\abstitleskip=\skip53 +\absleftindent=\skip54 +\absrightindent=\skip55 +\absparindent=\skip56 +\absparsep=\skip57 +) +(/usr/local/texlive/2016/texmf-dist/tex/latex/url/url.sty +\Urlmuskip=\muskip10 +Package: url 2013/09/16 ver 3.4 Verb mode for urls, etc. +) +(/usr/local/texlive/2016/texmf-dist/tex/latex/float/float.sty +Package: float 2001/11/08 v1.3d Float enhancements (AL) +\c@float@type=\count113 +\float@exts=\toks16 +\float@box=\box44 +\@float@everytoks=\toks17 +\@floatcapt=\box45 +) + +! LaTeX Error: File `dummy.tex' not found. + +Type X to quit or to proceed, +or enter new name. (Default extension: tex) + +Enter file name: + +LaTeX Warning: Unused global option(s): + [9.5pt]. + +(./last-proceeding.aux) +\openout1 = `last-proceeding.aux'. + +LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 25. +LaTeX Font Info: ... okay on input line 25. +LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 25. +LaTeX Font Info: ... okay on input line 25. +LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 25. +LaTeX Font Info: ... okay on input line 25. +LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 25. +LaTeX Font Info: ... okay on input line 25. +LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 25. +LaTeX Font Info: ... okay on input line 25. +LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 25. +LaTeX Font Info: ... okay on input line 25. +LaTeX Font Info: Checking defaults for JY1/mc/m/n on input line 25. +LaTeX Font Info: ... okay on input line 25. +LaTeX Font Info: Checking defaults for JT1/mc/m/n on input line 25. +LaTeX Font Info: ... okay on input line 25. +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <12> on input line 42. +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <8> on input line 42. +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <6> on input line 42. +LaTeX Font Info: Font shape `JT1/mc/bx/n' in size <9> not available +(Font) Font shape `JT1/gt/m/n' tried instead on input line 42. +LaTeX Font Info: Font shape `JY1/mc/bx/n' in size <9> not available +(Font) Font shape `JY1/gt/m/n' tried instead on input line 42. +LaTeX Font Info: Font shape `JT1/mc/bx/n' in size <14.4> not available +(Font) Font shape `JT1/gt/m/n' tried instead on input line 44. +LaTeX Font Info: Font shape `JY1/mc/bx/n' in size <14.4> not available +(Font) Font shape `JY1/gt/m/n' tried instead on input line 44. +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <7> on input line 121. +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <5> on input line 121. +File: images/examples_2.pdf Graphic file (type pdf) + +File: images/emblem-bitmap.pdf Graphic file (type pdf) + + +Package Fancyhdr Warning: \headheight is too small (0.0pt): + Make it at least 20.37784pt. + We now make it that large for the rest of the document. + This may cause the page layout to be inconsistent, however. + +[1 + + +] +LaTeX Font Info: Font shape `JT1/mc/bx/n' in size <10> not available +(Font) Font shape `JT1/gt/m/n' tried instead on input line 163. +LaTeX Font Info: Font shape `JY1/mc/bx/n' in size <10> not available +(Font) Font shape `JY1/gt/m/n' tried instead on input line 163. + + +LaTeX Warning: Reference `images:RaspberryPi' on page 2 undefined on input line + 163. + +File: images/RaspberryPi_2.pdf Graphic file (type pdf) + +File: images/OSX_2.pdf Graphic file (type pdf) + +File: images/OSX_Linux_VM_2.pdf Graphic file (type pdf) + +Overfull \hbox (12.99443pt too wide) in paragraph at lines 208--209 + [] + [] + +(./last-proceeding.bbl) [2] (./last-proceeding.aux) + +LaTeX Warning: There were undefined references. + + ) +Here is how much of TeX's memory you used: + 1282 strings out of 493693 + 15922 string characters out of 6149787 + 82577 words of memory out of 5000000 + 4847 multiletter control sequences out of 15000+600000 + 15097 words of font info for 59 fonts, out of 8000000 for 9000 + 929 hyphenation exceptions out of 8191 + 27i,15n,43p,451b,365s stack positions out of 5000i,500n,10000p,200000b,80000s + +Output written on last-proceeding.dvi (2 pages, 11592 bytes). diff -r 612de2705907 -r d5507629a56b proceeding/last-proceeding.pdf Binary file proceeding/last-proceeding.pdf has changed diff -r 612de2705907 -r d5507629a56b proceeding/last-proceeding.synctex.gz Binary file proceeding/last-proceeding.synctex.gz has changed diff -r 612de2705907 -r d5507629a56b proceeding/last-proceeding.tex --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/proceeding/last-proceeding.tex Tue Feb 20 14:28:27 2018 +0900 @@ -0,0 +1,228 @@ +\documentclass[twocolumn,twoside,9.5pt]{jarticle} +\usepackage[dvipdfmx]{graphicx} +\usepackage{picins} +\usepackage{fancyhdr} +\usepackage{abstract} +\usepackage{url} +\usepackage{float} +%\pagestyle{fancy} +\lhead{\parpic{\includegraphics[height=1zw,keepaspectratio,bb=0 0 251 246]{images/emblem-bitmap.pdf}}琉球大学主催 工学部情報工学科 卒業研究中間発表会} +\rhead{} +\cfoot{} + +\setlength{\topmargin}{-1in \addtolength{\topmargin}{15mm}} +\setlength{\headheight}{0mm} +\setlength{\headsep}{5mm} +\setlength{\oddsidemargin}{-1in \addtolength{\oddsidemargin}{11mm}} +\setlength{\evensidemargin}{-1in \addtolength{\evensidemargin}{21mm}} +\setlength{\textwidth}{181mm} +\setlength{\textheight}{261mm} +\setlength{\footskip}{0mm} +\pagestyle{empty} + +\input{dummy.tex} +\renewcommand{\abstractname}{概要} +\begin{document} +\title{Gears OS on Raspberry Pi} +%\title{Supporting NAT in Screen Sharing System TreeVNC} +\author{145759E 氏名 {桃原}{優} 指導教員 : 河野 真治} +\date{} +\twocolumn[ +\maketitle +\thispagestyle{fancy} + +\begin{abstract} +In our laboratory doing development CbC and Gears OS make use of CbC. + + CbC can be write meta level processing and parallel processing. + Meta level processing can management memory , thread, CPU and GPU. + In this research aiming to run Gears OS on Raspberry Pi + + \end{abstract} +] + +\section{Raspberry Pi上での Gears OS} +当研究室では CbC(Continuation base C) とCbC を用いて実装する +GearsOS の研究を行っている。 + +CbC は Code Segment と Data Segment という単位でプログラムを記述する。 +Code Segment は並列処理の単位として利用でき、 +Data Segment はデータそのもので型を持っていて、 +CbC はメタレベルの処理,並列処理を記述することができる。 + +メタレベルの処理では、メモリ管理、スレッド管理、CPU や GPU の資源管理 +を記述することができる。 + +本研究では、ARM で動くシングルボードコンピュータである +Raspberry Pi 上で Gears OS を動かせるようになる事で、 +ハードウェア上でもメタレベルの処理、並列実行ができるプログラミング +を記述できるようになる事を目指している。 + +しかし、メモリの関係上 RaspberryPi 上で CbC の make を行うと、 +かなりの時間がかかる。 + +解決案として、OSX 上で CrossCompile を行う方法と、Linux 環境で +CrossCompile を行う方法を提案する。 + +% \section{CbC} +% Gears OS の実装には LLVM/Clang 上に実装した CbC(Continuation based C)を用いる。\\ +% CbC は Code Segment を基本的な処理単位とする。C の関数とは異なり返り値を持たないが、Code Segment の宣言は C の関数の構文と同じように行い、型に \_\_code を用いる。\\ +% CbC は for 文や while 文といったループ制御構文を持たないので、ループ処理は自分自身への再帰的な継続を行う事で実現する。\\ +% 現在の Code Segment から次の Code Segment への移動は goto の後に Code Segment 名と引数を並べて記述する。この goto による処理の遷移を継続と呼ぶ。C と異なり、戻り値を持たない Code Segment ではスタックに値を積んで行く必要が無くスタックは変更されない。このようなスタックに値を積まない継続を軽量継続と呼ぶ。この軽量継続により、並列化、ループ制御、関数コールとスタックの操作を意識した最適化がソースコードレベルで行えるようになる。 +% +% +% % \begin{figure}[htpb] +% % \begin{center} +% % \scalebox{0.5}{\includegraphics{/codesegment.pdf}} +% % \end{center} +% % \caption{goto による Code Segment 間の継続} +% % \label{fig:cs} +% % \end{figure} +% +% \section{Code Gear と Data Gear} +% Gears OS では、プログラムの単位として Gear を用いる。Gear は並列実行の単位、データの分割、Gear 間の接続等になる。 +% Code Gear はプログラムの処理そのものであり、任意の数の Data Gear を参照し、処理が完了すると任意の数の Data Gear に書き込む。Code Gear は接続された Data Gear 以外にアクセスできない。Code Segment と同じように Code Gear から次の Code Gear への処理の移動は goto の後に Code Gear の名前と引数を指定する事で実現できる。 +% Data Gear はデータそのものを表す。int や 文字列などの Primitive Data Type を持っている。Gear の特徴として処理やデータの構造が Code Gear、Data Gear に閉じている事にある。これにより、実行時間、メモリ使用量などを予測可能なものにすることができる。 +% +% % \section{Context} +% % 接続可能な Code Gear、Data Gear のリスト、Temporal Data Gear 等のためのメモリ空間を持っており、Context を通してアクセスすることができる。Context にはメインとなる Context と Worker 用の Context がある。Temporal Data Gear のためのメモリ空間は Context 毎に異なり、互いに干渉する事はできない。 + + + + + + + + + + +\section{Raspberry Pi 上での実装} +% Raspberry Pi の OS である Raspbian ではメモリが 256MB なので +% Raspberry Pi 上で直接 CbC をコンパイルするには時間がかかる。qemu によるメモリの拡張もできないので、別の手法で Raspberry Pi 上に CbC を実装する方が好ましい。 +Raspberry Pi 1 のメモリは 256MB と小さいため、 CbC をmakeすることができない。 +Raspberry Pi 3 だとメモリは 1GB あり CbC をmakeできるが、時間がかかる。 + + + +make時間の比較として研究室のサーバでメモリ16GBのfireflyと学科のサーバの一つでLinux環境であるメモリ756GBのDALMOREを用いる。 +なお、fireflyとDALMOREではGoogleによって開発されたbuildシステムのninja-buildを用いてmakeを行なった。その結果を表\ref{tab:make_time}に示す。 + +% ninja + +\begin{table}[htb] +\centering +\scalebox{1.0}[1.0]{ + \begin{tabular}{| c | r | r |} \hline + 環境(メモリ) & 時間 & 比較 \\ \hline \hline + RaspberryPi(1GB) & 15時間11分06秒 & 1.00倍 \\ \hline + OSX(16GB) & 2時間16分06秒 & 6.69倍 \\ \hline + Linux(756GB) & 2分26秒 & 374.42倍 \\ \hline + \end{tabular} + } + \caption{make時間の比較} + \label{tab:make_time} +\end{table} + +\section{CrossCompile} + CrossCompile を行うことで make 時間の問題を解決する方法がある。 +% CrossCompile とは、別の OS で実行可能なコードを生成するコンパイルの手法である。 +% つまり、OSX であらかじめ Raspberry Pi で CbC が動くように CrossCompile を行い、そのコードを Raspberry Pi に移せばよい。\\ + CrossCompile とは、別の OS で実行可能なコードを生成するコンパイルの手法である。 +Raspbian 以外の OS 環境であらかじめ Raspberry Pi で CbC が動くように CrossCompile を行い、そのコードを Raspberry Pi に移す事で、実行できるようになる。 + +% この研究でOSX とLinuxそれぞれで LLVMとGCCのCrossCompileを行う説明 + +Raspberry Pi の OS である Rasbian は qemu によるメモリの拡張もできないので、 +別の手法で Raspberry Pi 上に CbC を実装する方が好ましい。 + + + + マサチューセッツ工科大の大学院生向け講義の教材として使うために、UNIX V6 という OS を + ANSI-C に書き換え、x86に移植したXv6 という OS がある。 +Xv6 は Raspberry Pi に移植する事ができる。ANSI-C で書かれている Xv6 を CbC に書き直す事で、 +Raspberry Pi で CbC を動かせるようになる。 + + +CbC を Raspberry Pi で動かすためのアプローチの手法を、I と T の形をした図の組み合わせによって説明を行う。I の上部分に cbclang や Xv6 などのソースコード名を、下部分にその機能の記述言語を記してある。T の下にある I は特別で、上に VM 下に VM を乗せている OS が記されている。 T の上部分は左に入力されるファイル、右に出力されるその機能によって出力されるファイルが記され、下部分にその機能の記述言語が記されている。 + +例として、cbclang のソースコード(I)と、 Raspberry Pi 上の clang (T) を図\ref{fig:examples} に示す。 + +\begin{figure}[htpb] + \begin{center} + \scalebox{0.35}{\includegraphics{images/examples_2.pdf}} + \end{center} + \caption{図の例} + \label{fig:examples} +\end{figure} + + +\break + + +Raspberry Pi は ARM のコードを生成する。CbCはCによって記述されているため、Cから ARM.o を生成し、ARM.o から a.out を出力する。 +Raspberry Pi 上でxv6を実装し、cbcからa.outを出力するまでの過程を図\ref{images:RaspberryPi}に示す。 + + +\begin{figure}[htpb] + \begin{center} + \scalebox{0.17}{\includegraphics{images/RaspberryPi_2.pdf}} + \end{center} + \caption{Raspberry Pi} + \label{fig:RaspberryPi} +\end{figure} + + + + +\section{OSX CrossCompile} +OSX上でxv6を実装する場合、Cから mach-o のバイナリファイルが生成される。 + この時、出力は mach-o になるので、mach-o の + loader 作ることで CbC が動かせるようになる。 + + OSX 上で行えるためコンパイルの速度向上が望める。 +xv6を実装しCbCからa.outを出力するまでの過程を、図\ref{fig:OSX}に示す。 + +\begin{figure}[htpb] + \begin{center} + \scalebox{0.35}{\includegraphics{images/OSX_2.pdf}} + \end{center} + \caption{OSX} + \label{fig:OSX} +\end{figure} + + + +\section{Linux CrossCompile} +OSX と別に Linux 環境で CbC を動かした後に、Raspberry Pi に載せる手法がある。 + + Linux の LLVM でコンパイルすることができれば elf のコードを書けるようになるので、elf のloader を作る事で、CbC を動かすことができる。 + + また、Linux 用の gcc を CbC に書き直す際に、gcc7 に書き直せば linker がそのまま使えるので、xv6 で動くようになる。 + + + CbCはCによって記述されているので、Cから ARM.oのバイナリを生成し、ARM.oからa.outを出力する。 +OSX上に立ち上げたLinux 上で xv6を実装するまでの過程を、図\ref{fig:OSX_Linux_VM}に示す。 + +\begin{figure}[htpb] + \begin{center} + \scalebox{0.5}{\includegraphics{images/OSX_Linux_VM_2.pdf}} + \end{center} + \caption{OSX Linux VM} + \label{fig:OSX_Linux_VM} +\end{figure} + +% Xv6詳しく + +\section{今後の課題} + xv6 で CbC が動くようになれば、Raspberry Pi 以外のハードウェアでの実装も容易になるので、Linux 上での実装を目指して研究を進めていく。xv6 で CbC が動けば、続けて Linux 上で Gears OS の実装も行なっていく。 + + +% \section{clang のバージョンアップ} +% CbC はバージョン 3.9 の clang を使用している。現在のバージョンの LLVM と clang を使用して、CbCをコンパイラできるように修正を加える必要がある。 + +% cross compiler, 実機, VM への実装を書く + +\nocite{*} +\bibliographystyle{junsrt} +\bibliography{reference} +\end{document} diff -r 612de2705907 -r d5507629a56b proceeding/mid_thesis.aux --- a/proceeding/mid_thesis.aux Tue Feb 20 12:45:39 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -\relax -\@writefile{toc}{\contentsline {section}{\numberline {1}Raspberry Pi上での Gears OS}{1}} -\@writefile{toc}{\contentsline {section}{\numberline {2}Raspberry Pi 上での実装}{1}} -\@writefile{toc}{\contentsline {section}{\numberline {3}CrossCompile}{1}} -\@writefile{lot}{\contentsline {table}{\numberline {1}{\ignorespaces make時間の比較}}{1}} -\newlabel{tab:make_time}{{1}{1}} -\@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces 図の例}}{1}} -\newlabel{fig:examples}{{1}{1}} -\citation{*} -\bibstyle{junsrt} -\bibdata{reference} -\bibcite{kaito:2015}{1} -\bibcite{gears}{2} -\bibcite{kokubo:2016}{3} -\bibcite{llvm}{4} -\@writefile{lof}{\contentsline {figure}{\numberline {2}{\ignorespaces Raspberry Pi}}{2}} -\newlabel{fig:RaspberryPi}{{2}{2}} -\@writefile{toc}{\contentsline {section}{\numberline {4}OSX CrossCompile}{2}} -\@writefile{lof}{\contentsline {figure}{\numberline {3}{\ignorespaces OSX}}{2}} -\newlabel{fig:OSX}{{3}{2}} -\@writefile{toc}{\contentsline {section}{\numberline {5}Linux CrossCompile}{2}} -\@writefile{lof}{\contentsline {figure}{\numberline {4}{\ignorespaces OSX Linux VM}}{2}} -\newlabel{fig:OSX_Linux_VM}{{4}{2}} -\@writefile{toc}{\contentsline {section}{\numberline {6}今後の課題}{2}} diff -r 612de2705907 -r d5507629a56b proceeding/mid_thesis.bbl --- a/proceeding/mid_thesis.bbl Tue Feb 20 12:45:39 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -\begin{thebibliography}{1} - -\bibitem{kaito:2015} -{徳森 海斗, 河野真治}. -\newblock Llvm clang 上の continuation based c コンパイラ の改良, 2015. - -\bibitem{gears} -{伊波立樹, 東恩納琢偉, 河野真治}. -\newblock Code gear、data gear に基づく os のプロトタイプ, 2016. - -\bibitem{kokubo:2016} -{小久保翔平, 河野真治}. -\newblock Code segment と data segment を持つ gears os の設計, 2016. - -\bibitem{llvm} -{The LLVM Compiler Infrastructure}. -\newblock \url{http://llvm.org}. - -\end{thebibliography} diff -r 612de2705907 -r d5507629a56b proceeding/mid_thesis.blg --- a/proceeding/mid_thesis.blg Tue Feb 20 12:45:39 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -This is pBibTeX, Version 0.99d-j0.33 (utf8.euc) (TeX Live 2016) -Capacity: max_strings=35307, hash_size=35307, hash_prime=30011 -The top-level auxiliary file: mid_thesis.aux -The style file: junsrt.bst -Database file #1: reference.bib -You've used 4 entries, - 2270 wiz_defined-function locations, - 554 strings with 4492 characters, -and the built_in function-call counts, 665 in all, are: -= -- 32 -> -- 16 -< -- 0 -+ -- 8 -- -- 4 -* -- 5 -:= -- 81 -add.period$ -- 8 -call.type$ -- 4 -change.case$ -- 3 -chr.to.int$ -- 0 -cite$ -- 4 -duplicate$ -- 44 -empty$ -- 97 -format.name$ -- 8 -if$ -- 161 -int.to.chr$ -- 0 -int.to.str$ -- 4 -missing$ -- 0 -newline$ -- 19 -num.names$ -- 4 -pop$ -- 46 -preamble$ -- 1 -purify$ -- 0 -quote$ -- 0 -skip$ -- 42 -stack$ -- 0 -substring$ -- 0 -swap$ -- 4 -text.length$ -- 0 -text.prefix$ -- 0 -top$ -- 0 -type$ -- 0 -warning$ -- 0 -while$ -- 4 -width$ -- 5 -write$ -- 33 -is.kanji.str$ -- 28 diff -r 612de2705907 -r d5507629a56b proceeding/mid_thesis.log --- a/proceeding/mid_thesis.log Tue Feb 20 12:45:39 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,253 +0,0 @@ -This is e-pTeX, Version 3.14159265-p3.7-160201-2.6 (utf8.euc) (TeX Live 2016) (preloaded format=platex 2017.5.28) 20 FEB 2018 11:27 -entering extended mode - restricted \write18 enabled. - file:line:error style messages enabled. - %&-line parsing enabled. -**mid_thesis.tex -(./mid_thesis.tex -pLaTeX2e <2016/05/07> (based on LaTeX2e <2016/03/31>) -Babel <3.9r> and hyphenation patterns for 83 language(s) loaded. -(/usr/local/texlive/2016/texmf-dist/tex/platex/base/jarticle.cls -Document Class: jarticle 2006/06/27 v1.6 Standard pLaTeX class -\c@@paper=\count81 -(/usr/local/texlive/2016/texmf-dist/tex/platex/base/jsize10.clo -File: jsize10.clo 2006/06/27 v1.6 Standard pLaTeX file (size option) -) -\c@part=\count82 -\c@section=\count83 -\c@subsection=\count84 -\c@subsubsection=\count85 -\c@paragraph=\count86 -\c@subparagraph=\count87 -\c@figure=\count88 -\c@table=\count89 -\abovecaptionskip=\skip41 -\belowcaptionskip=\skip42 -\symmincho=\mathgroup4 -LaTeX Font Info: Overwriting symbol font `mincho' in version `bold' -(Font) JY1/mc/m/n --> JY1/gt/m/n on input line 593. -\toclineskip=\dimen118 -\@lnumwidth=\dimen119 -\bibindent=\dimen120 -\heisei=\count90 -) -(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/graphicx.sty -Package: graphicx 2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR) - -(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/keyval.sty -Package: keyval 2014/10/28 v1.15 key=value parser (DPC) -\KV@toks@=\toks15 -) -(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/graphics.sty -Package: graphics 2016/05/09 v1.0r Standard LaTeX Graphics (DPC,SPQR) - -(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/trig.sty -Package: trig 2016/01/03 v1.10 sin cos tan (DPC) -) -(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics-cfg/graphics.cfg -File: graphics.cfg 2016/01/02 v1.10 sample graphics configuration -) -Package graphics Info: Driver file: dvipdfmx.def on input line 96. - -(/usr/local/texlive/2016/texmf-dist/tex/latex/dvipdfmx-def/dvipdfmx.def -File: dvipdfmx.def 2016/04/06 v4.08 LaTeX color/graphics driver for dvipdfmx (T -eX Live/ChoF) - -(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/infwarerr.sty -Package: infwarerr 2016/05/16 v1.4 Providing info/warning/error messages (HO) -) -(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/ltxcmds.sty -Package: ltxcmds 2016/05/16 v1.23 LaTeX kernel commands for general use (HO) -))) -\Gin@req@height=\dimen121 -\Gin@req@width=\dimen122 -) -(./picins.sty Option `picins' Version 3.0 Sep. 1992, TH Darmstadt/HRZ -\@BILD=\box41 -\@TEXT=\box42 -\d@breite=\dimen123 -\d@hoehe=\dimen124 -\d@xoff=\dimen125 -\d@yoff=\dimen126 -\d@shad=\dimen127 -\d@dash=\dimen128 -\d@boxl=\dimen129 -\d@pichskip=\dimen130 -\d@tmp=\dimen131 -\d@tmpa=\dimen132 -\d@bskip=\dimen133 -\hsiz@=\dimen134 -\p@getot@l=\dimen135 -\c@breite=\count91 -\c@hoehe=\count92 -\c@xoff=\count93 -\c@yoff=\count94 -\c@pos=\count95 -\c@shad=\count96 -\c@dash=\count97 -\c@boxl=\count98 -\c@zeilen=\count99 -\@changemode=\count100 -\c@piccaption=\count101 -\c@piccaptionpos=\count102 -\c@picpos=\count103 -\c@whole=\count104 -\c@half=\count105 -\c@tmp=\count106 -\c@tmpa=\count107 -\c@tmpb=\count108 -\c@tmpc=\count109 -\c@tmpd=\count110 -\d@leftskip=\skip43 -\ptoti=\dimen136 -\ptotii=\dimen137 -\env@box=\box43 -\d@envdp=\dimen138 -\c@hsize=\count111 -\c@envdp=\count112 -\d@envb=\dimen139 -) -(/usr/local/texlive/2016/texmf-dist/tex/latex/fancyhdr/fancyhdr.sty -\fancy@headwidth=\skip44 -\f@ncyO@elh=\skip45 -\f@ncyO@erh=\skip46 -\f@ncyO@olh=\skip47 -\f@ncyO@orh=\skip48 -\f@ncyO@elf=\skip49 -\f@ncyO@erf=\skip50 -\f@ncyO@olf=\skip51 -\f@ncyO@orf=\skip52 -) -(/usr/local/texlive/2016/texmf-dist/tex/latex/abstract/abstract.sty -Package: abstract 2009/06/08 v1.2a configurable abstracts -\abstitleskip=\skip53 -\absleftindent=\skip54 -\absrightindent=\skip55 -\absparindent=\skip56 -\absparsep=\skip57 -) -(/usr/local/texlive/2016/texmf-dist/tex/latex/url/url.sty -\Urlmuskip=\muskip10 -Package: url 2013/09/16 ver 3.4 Verb mode for urls, etc. -) -(/usr/local/texlive/2016/texmf-dist/tex/latex/float/float.sty -Package: float 2001/11/08 v1.3d Float enhancements (AL) -\c@float@type=\count113 -\float@exts=\toks16 -\float@box=\box44 -\@float@everytoks=\toks17 -\@floatcapt=\box45 -) - -! LaTeX Error: File `dummy.tex' not found. - -Type X to quit or to proceed, -or enter new name. (Default extension: tex) - -Enter file name: - -LaTeX Warning: Unused global option(s): - [9.5pt]. - -(./mid_thesis.aux) -\openout1 = `mid_thesis.aux'. - -LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 25. -LaTeX Font Info: ... okay on input line 25. -LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 25. -LaTeX Font Info: ... okay on input line 25. -LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 25. -LaTeX Font Info: ... okay on input line 25. -LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 25. -LaTeX Font Info: ... okay on input line 25. -LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 25. -LaTeX Font Info: ... okay on input line 25. -LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 25. -LaTeX Font Info: ... okay on input line 25. -LaTeX Font Info: Checking defaults for JY1/mc/m/n on input line 25. -LaTeX Font Info: ... okay on input line 25. -LaTeX Font Info: Checking defaults for JT1/mc/m/n on input line 25. -LaTeX Font Info: ... okay on input line 25. -LaTeX Font Info: External font `cmex10' loaded for size -(Font) <12> on input line 42. -LaTeX Font Info: External font `cmex10' loaded for size -(Font) <8> on input line 42. -LaTeX Font Info: External font `cmex10' loaded for size -(Font) <6> on input line 42. -LaTeX Font Info: Font shape `JT1/mc/bx/n' in size <9> not available -(Font) Font shape `JT1/gt/m/n' tried instead on input line 42. -LaTeX Font Info: Font shape `JY1/mc/bx/n' in size <9> not available -(Font) Font shape `JY1/gt/m/n' tried instead on input line 42. -LaTeX Font Info: Font shape `JT1/mc/bx/n' in size <14.4> not available -(Font) Font shape `JT1/gt/m/n' tried instead on input line 44. -LaTeX Font Info: Font shape `JY1/mc/bx/n' in size <14.4> not available -(Font) Font shape `JY1/gt/m/n' tried instead on input line 44. -LaTeX Font Info: Font shape `JT1/mc/bx/n' in size <10> not available -(Font) Font shape `JT1/gt/m/n' tried instead on input line 108. -LaTeX Font Info: Font shape `JY1/mc/bx/n' in size <10> not available -(Font) Font shape `JY1/gt/m/n' tried instead on input line 108. - - -LaTeX Warning: Reference `tab:make_time' on page 1 undefined on input line 108. - - -LaTeX Font Info: External font `cmex10' loaded for size -(Font) <7> on input line 121. -LaTeX Font Info: External font `cmex10' loaded for size -(Font) <5> on input line 121. - -LaTeX Warning: Reference `fig:examples' on page 1 undefined on input line 148. - -File: images/examples_2.pdf Graphic file (type pdf) - -File: images/emblem-bitmap.pdf Graphic file (type pdf) - - -Package Fancyhdr Warning: \headheight is too small (0.0pt): - Make it at least 20.37784pt. - We now make it that large for the rest of the document. - This may cause the page layout to be inconsistent, however. - -[1 - - -] - -LaTeX Warning: Reference `images:RaspberryPi' on page 2 undefined on input line - 163. - -File: images/RaspberryPi_2.pdf Graphic file (type pdf) - - -LaTeX Warning: Reference `fig:OSX' on page 2 undefined on input line 183. - -File: images/OSX_2.pdf Graphic file (type pdf) - - -LaTeX Warning: Reference `fig:OSX_Linux_VM' on page 2 undefined on input line 2 -04. - -File: images/OSX_Linux_VM_2.pdf Graphic file (type pdf) - -Overfull \hbox (12.99443pt too wide) in paragraph at lines 208--209 - [] - [] - -(./mid_thesis.bbl) [2] (./mid_thesis.aux) - -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: - 1282 strings out of 493693 - 15867 string characters out of 6149787 - 82577 words of memory out of 5000000 - 4847 multiletter control sequences out of 15000+600000 - 15097 words of font info for 59 fonts, out of 8000000 for 9000 - 929 hyphenation exceptions out of 8191 - 27i,15n,43p,446b,365s stack positions out of 5000i,500n,10000p,200000b,80000s - -Output written on mid_thesis.dvi (2 pages, 11608 bytes). diff -r 612de2705907 -r d5507629a56b proceeding/mid_thesis.pdf Binary file proceeding/mid_thesis.pdf has changed diff -r 612de2705907 -r d5507629a56b proceeding/mid_thesis.synctex.gz Binary file proceeding/mid_thesis.synctex.gz has changed diff -r 612de2705907 -r d5507629a56b proceeding/mid_thesis.tex --- a/proceeding/mid_thesis.tex Tue Feb 20 12:45:39 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,228 +0,0 @@ -\documentclass[twocolumn,twoside,9.5pt]{jarticle} -\usepackage[dvipdfmx]{graphicx} -\usepackage{picins} -\usepackage{fancyhdr} -\usepackage{abstract} -\usepackage{url} -\usepackage{float} -%\pagestyle{fancy} -\lhead{\parpic{\includegraphics[height=1zw,keepaspectratio,bb=0 0 251 246]{images/emblem-bitmap.pdf}}琉球大学主催 工学部情報工学科 卒業研究中間発表会} -\rhead{} -\cfoot{} - -\setlength{\topmargin}{-1in \addtolength{\topmargin}{15mm}} -\setlength{\headheight}{0mm} -\setlength{\headsep}{5mm} -\setlength{\oddsidemargin}{-1in \addtolength{\oddsidemargin}{11mm}} -\setlength{\evensidemargin}{-1in \addtolength{\evensidemargin}{21mm}} -\setlength{\textwidth}{181mm} -\setlength{\textheight}{261mm} -\setlength{\footskip}{0mm} -\pagestyle{empty} - -\input{dummy.tex} -\renewcommand{\abstractname}{概要} -\begin{document} -\title{Gears OS on Raspberry Pi} -%\title{Supporting NAT in Screen Sharing System TreeVNC} -\author{145759E 氏名 {桃原}{優} 指導教員 : 河野 真治} -\date{} -\twocolumn[ -\maketitle -\thispagestyle{fancy} - -\begin{abstract} -In our laboratory doing development CbC and Gears OS make use of CbC. - - CbC can be write meta level processing and parallel processing. - Meta level processing can management memory , thread, CPU and GPU. - In this research aiming to run Gears OS on Raspberry Pi - - \end{abstract} -] - -\section{Raspberry Pi上での Gears OS} -当研究室では CbC(Continuation base C) とCbC を用いて実装する -GearsOS の研究を行っている。 - -CbC は Code Segment と Data Segment という単位でプログラムを記述する。 -Code Segment は並列処理の単位として利用でき、 -Data Segment はデータそのもので型を持っていて、 -CbC はメタレベルの処理,並列処理を記述することができる。 - -メタレベルの処理では、メモリ管理、スレッド管理、CPU や GPU の資源管理 -を記述することができる。 - -本研究では、ARM で動くシングルボードコンピュータである -Raspberry Pi 上で Gears OS を動かせるようになる事で、 -ハードウェア上でもメタレベルの処理、並列実行ができるプログラミング -を記述できるようになる事を目指している。 - -しかし、メモリの関係上 RaspberryPi 上で CbC の make を行うと、 -かなりの時間がかかる。 - -解決案として、OSX 上で CrossCompile を行う方法と、Linux 環境で -CrossCompile を行う方法を提案する。 - -% \section{CbC} -% Gears OS の実装には LLVM/Clang 上に実装した CbC(Continuation based C)を用いる。\\ -% CbC は Code Segment を基本的な処理単位とする。C の関数とは異なり返り値を持たないが、Code Segment の宣言は C の関数の構文と同じように行い、型に \_\_code を用いる。\\ -% CbC は for 文や while 文といったループ制御構文を持たないので、ループ処理は自分自身への再帰的な継続を行う事で実現する。\\ -% 現在の Code Segment から次の Code Segment への移動は goto の後に Code Segment 名と引数を並べて記述する。この goto による処理の遷移を継続と呼ぶ。C と異なり、戻り値を持たない Code Segment ではスタックに値を積んで行く必要が無くスタックは変更されない。このようなスタックに値を積まない継続を軽量継続と呼ぶ。この軽量継続により、並列化、ループ制御、関数コールとスタックの操作を意識した最適化がソースコードレベルで行えるようになる。 -% -% -% % \begin{figure}[htpb] -% % \begin{center} -% % \scalebox{0.5}{\includegraphics{/codesegment.pdf}} -% % \end{center} -% % \caption{goto による Code Segment 間の継続} -% % \label{fig:cs} -% % \end{figure} -% -% \section{Code Gear と Data Gear} -% Gears OS では、プログラムの単位として Gear を用いる。Gear は並列実行の単位、データの分割、Gear 間の接続等になる。 -% Code Gear はプログラムの処理そのものであり、任意の数の Data Gear を参照し、処理が完了すると任意の数の Data Gear に書き込む。Code Gear は接続された Data Gear 以外にアクセスできない。Code Segment と同じように Code Gear から次の Code Gear への処理の移動は goto の後に Code Gear の名前と引数を指定する事で実現できる。 -% Data Gear はデータそのものを表す。int や 文字列などの Primitive Data Type を持っている。Gear の特徴として処理やデータの構造が Code Gear、Data Gear に閉じている事にある。これにより、実行時間、メモリ使用量などを予測可能なものにすることができる。 -% -% % \section{Context} -% % 接続可能な Code Gear、Data Gear のリスト、Temporal Data Gear 等のためのメモリ空間を持っており、Context を通してアクセスすることができる。Context にはメインとなる Context と Worker 用の Context がある。Temporal Data Gear のためのメモリ空間は Context 毎に異なり、互いに干渉する事はできない。 - - - - - - - - - - -\section{Raspberry Pi 上での実装} -% Raspberry Pi の OS である Raspbian ではメモリが 256MB なので -% Raspberry Pi 上で直接 CbC をコンパイルするには時間がかかる。qemu によるメモリの拡張もできないので、別の手法で Raspberry Pi 上に CbC を実装する方が好ましい。 -Raspberry Pi 1 のメモリは 256MB と小さいため、 CbC をmakeすることができない。 -Raspberry Pi 3 だとメモリは 1GB あり CbC をmakeできるが、時間がかかる。 - - - -make時間の比較として研究室のサーバでメモリ16GBのfireflyと学科のサーバの一つでLinux環境であるメモリ756GBのDALMOREを用いる。 -なお、fireflyとDALMOREではGoogleによって開発されたbuildシステムのninja-buildを用いてmakeを行なった。その結果を表\ref{tab:make_time}に示す。 - -% ninja - -\begin{table}[htb] -\centering -\scalebox{1.0}[1.0]{ - \begin{tabular}{| c | r | r |} \hline - 環境(メモリ) & 時間 & 比較 \\ \hline \hline - RaspberryPi(1GB) & 15時間11分06秒 & 1.00倍 \\ \hline - OSX(16GB) & 2時間16分06秒 & 6.69倍 \\ \hline - Linux(756GB) & 2分26秒 & 374.42倍 \\ \hline - \end{tabular} - } - \caption{make時間の比較} - \label{tab:make_time} -\end{table} - -\section{CrossCompile} - CrossCompile を行うことで make 時間の問題を解決する方法がある。 -% CrossCompile とは、別の OS で実行可能なコードを生成するコンパイルの手法である。 -% つまり、OSX であらかじめ Raspberry Pi で CbC が動くように CrossCompile を行い、そのコードを Raspberry Pi に移せばよい。\\ - CrossCompile とは、別の OS で実行可能なコードを生成するコンパイルの手法である。 -Raspbian 以外の OS 環境であらかじめ Raspberry Pi で CbC が動くように CrossCompile を行い、そのコードを Raspberry Pi に移す事で、実行できるようになる。 - -% この研究でOSX とLinuxそれぞれで LLVMとGCCのCrossCompileを行う説明 - -Raspberry Pi の OS である Rasbian は qemu によるメモリの拡張もできないので、 -別の手法で Raspberry Pi 上に CbC を実装する方が好ましい。 - - - - マサチューセッツ工科大の大学院生向け講義の教材として使うために、UNIX V6 という OS を - ANSI-C に書き換え、x86に移植したXv6 という OS がある。 -Xv6 は Raspberry Pi に移植する事ができる。ANSI-C で書かれている Xv6 を CbC に書き直す事で、 -Raspberry Pi で CbC を動かせるようになる。 - - -CbC を Raspberry Pi で動かすためのアプローチの手法を、I と T の形をした図の組み合わせによって説明を行う。I の上部分に cbclang や Xv6 などのソースコード名を、下部分にその機能の記述言語を記してある。T の下にある I は特別で、上に VM 下に VM を乗せている OS が記されている。 T の上部分は左に入力されるファイル、右に出力されるその機能によって出力されるファイルが記され、下部分にその機能の記述言語が記されている。 - -例として、cbclang のソースコード(I)と、 Raspberry Pi 上の clang (T) を図\ref{fig:examples} に示す。 - -\begin{figure}[htpb] - \begin{center} - \scalebox{0.35}{\includegraphics{images/examples_2.pdf}} - \end{center} - \caption{図の例} - \label{fig:examples} -\end{figure} - - -\break - - -Raspberry Pi は ARM のコードを生成する。CbCはCによって記述されているため、Cから ARM.o を生成し、ARM.o から a.out を出力する。 -Raspberry Pi 上でxv6を実装し、cbcからa.outを出力するまでの過程を図\ref{images:RaspberryPi}に示す。 - - -\begin{figure}[htpb] - \begin{center} - \scalebox{0.17}{\includegraphics{images/RaspberryPi_2.pdf}} - \end{center} - \caption{Raspberry Pi} - \label{fig:RaspberryPi} -\end{figure} - - - - -\section{OSX CrossCompile} -OSX上でxv6を実装する場合、Cから mach-o のバイナリファイルが生成される。 - この時、出力は mach-o になるので、mach-o の - loader 作ることで CbC が動かせるようになる。 - - OSX 上で行えるためコンパイルの速度向上が望める。 -xv6を実装しCbCからa.outを出力するまでの過程を、図\ref{fig:OSX}に示す。 - -\begin{figure}[htpb] - \begin{center} - \scalebox{0.35}{\includegraphics{images/OSX_2.pdf}} - \end{center} - \caption{OSX} - \label{fig:OSX} -\end{figure} - - - -\section{Linux CrossCompile} -OSX と別に Linux 環境で CbC を動かした後に、Raspberry Pi に載せる手法がある。 - - Linux の LLVM でコンパイルすることができれば elf のコードを書けるようになるので、elf のloader を作る事で、CbC を動かすことができる。 - - また、Linux 用の gcc を CbC に書き直す際に、gcc7 に書き直せば linker がそのまま使えるので、xv6 で動くようになる。 - - - CbCはCによって記述されているので、Cから ARM.oのバイナリを生成し、ARM.oからa.outを出力する。 -OSX上に立ち上げたLinux 上で xv6を実装するまでの過程を、図\ref{fig:OSX_Linux_VM}に示す。 - -\begin{figure}[htpb] - \begin{center} - \scalebox{0.5}{\includegraphics{images/OSX_Linux_VM_2.pdf}} - \end{center} - \caption{OSX Linux VM} - \label{fig:OSX_Linux_VM} -\end{figure} - -% Xv6詳しく - -\section{今後の課題} - xv6 で CbC が動くようになれば、Raspberry Pi 以外のハードウェアでの実装も容易になるので、Linux 上での実装を目指して研究を進めていく。xv6 で CbC が動けば、続けて Linux 上で Gears OS の実装も行なっていく。 - - -% \section{clang のバージョンアップ} -% CbC はバージョン 3.9 の clang を使用している。現在のバージョンの LLVM と clang を使用して、CbCをコンパイラできるように修正を加える必要がある。 - -% cross compiler, 実機, VM への実装を書く - -\nocite{*} -\bibliographystyle{junsrt} -\bibliography{reference} -\end{document}