annotate Slide/prosym.html @ 25:39f38ed9c7a2

fix
author mir3636
date Fri, 19 Jan 2018 18:33:56 +0900
parents 8edb996bce46
children da3022f9122e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
1 <!DOCTYPE html>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
2 <html>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
3 <head>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
4 <meta http-equiv="content-type" content="text/html;charset=utf-8">
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
5 <title>Code Gear と Data Gear を持つ Gears OS の設計</title>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
6
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
7 <meta name="generator" content="Slide Show (S9) v2.5.0 on Ruby 2.4.0 (2016-12-24) [x86_64-darwin16]">
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
8 <meta name="author" content="Mitsuki Miyagi, Shinji Kono" >
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
9
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
10 <!-- style sheet links -->
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
11 <link rel="stylesheet" href="s6/themes/projection.css" media="screen,projection">
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
12 <link rel="stylesheet" href="s6/themes/screen.css" media="screen">
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
13 <link rel="stylesheet" href="s6/themes/print.css" media="print">
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
14 <link rel="stylesheet" href="s6/themes/blank.css" media="screen,projection">
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
15
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
16 <!-- JS -->
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
17 <script src="s6/js/jquery-1.11.3.min.js"></script>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
18 <script src="s6/js/jquery.slideshow.js"></script>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
19 <script src="s6/js/jquery.slideshow.counter.js"></script>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
20 <script src="s6/js/jquery.slideshow.controls.js"></script>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
21 <script src="s6/js/jquery.slideshow.footer.js"></script>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
22 <script src="s6/js/jquery.slideshow.autoplay.js"></script>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
23
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
24 <!-- prettify -->
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
25 <link rel="stylesheet" href="scripts/prettify.css">
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
26 <script src="scripts/prettify.js"></script>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
27
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
28 <script>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
29 $(document).ready( function() {
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
30 Slideshow.init();
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
31
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
32 $('code').each(function(_, el) {
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
33 if (!el.classList.contains('noprettyprint')) {
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
34 el.classList.add('prettyprint');
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
35 }
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
36 });
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
37 prettyPrint();
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
38 } );
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
39
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
40
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
41 </script>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
42
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
43 <!-- Better Browser Banner for Microsoft Internet Explorer (IE) -->
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
44 <!--[if IE]>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
45 <script src="s6/js/jquery.microsoft.js"></script>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
46 <![endif]-->
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
47
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
48
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
49
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
50 </head>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
51 <body>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
52
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
53 <div class="layout">
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
54 <div id="header"></div>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
55 <div id="footer">
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
56 <div align="right">
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
57 <img src="s6/images/logo.svg" width="200px">
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
58 </div>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
59 </div>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
60 </div>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
61
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
62 <div class="presentation">
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
63
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
64 <div class='slide cover'>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
65 <table width="90%" height="90%" border="0" align="center">
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
66 <tr>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
67 <td>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
68 <div align="center">
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
69 <h1><font color="#808db5">Code Gear と Data Gear を持つ Gears OS の設計</font></h1>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
70 </div>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
71 </td>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
72 </tr>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
73 <tr>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
74 <td>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
75 <div align="left">
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
76 Mitsuki Miyagi, Shinji Kono
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
77 琉球大学
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
78 <hr style="color:#ffcc00;background-color:#ffcc00;text-align:left;border:none;width:100%;height:0.2em;">
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
79 </div>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
80 </td>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
81 </tr>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
82 </table>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
83 </div>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
84
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
85 <div class='slide '>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
86 <!-- === begin markdown block ===
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
87
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
88 generated by markdown/1.2.0 on Ruby 2.4.0 (2016-12-24) [x86_64-darwin16]
25
mir3636
parents: 24
diff changeset
89 on 2018-01-19 18:24:07 +0900 with Markdown engine kramdown (1.13.2)
16
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
90 using options {}
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
91 -->
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
92
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
93 <!-- _S9SLIDE_ -->
21
mir3636
parents: 17
diff changeset
94 <h1 id="section">研究目的</h1>
16
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
95
17
mir3636
parents: 16
diff changeset
96 <ul>
21
mir3636
parents: 17
diff changeset
97 <li>現代の OS では拡張性と信頼性を両立させることが要求されている。
mir3636
parents: 17
diff changeset
98 <!--信頼性 信頼性を保証するには従来のテストとデバッグでは不十分-->
mir3636
parents: 17
diff changeset
99 <!--信頼性を保証するには証明とモデル検査を用いる方法がある--></li>
mir3636
parents: 17
diff changeset
100 <li>信頼性をノーマルレベルの計算に対して保証し、拡張性をメタレベルの計算で実現することを目標に Gears OS を設計中である。</li>
mir3636
parents: 17
diff changeset
101 <li>ノーマルレベルの計算とメタレベルの計算を切り離して記述するために Code Gear と Data Gear という単位を用いている。</li>
mir3636
parents: 17
diff changeset
102 <li>Gears OS は Continuation based C(CbC) によってアプリケーションと OS そのものを記述する。</li>
mir3636
parents: 17
diff changeset
103 <li>本研究では、CbC を用いた Gears OS の実装と、メタ計算の実例を示す。</li>
17
mir3636
parents: 16
diff changeset
104 </ul>
mir3636
parents: 16
diff changeset
105
mir3636
parents: 16
diff changeset
106 <!--
mir3636
parents: 16
diff changeset
107 # OS の拡張性と信頼性の両立
mir3636
parents: 16
diff changeset
108
23
mir3636
parents: 21
diff changeset
109 - さまざまなコンピュータの信頼性の基本はメモリなどの資源管理を行う OS である。
mir3636
parents: 21
diff changeset
110 - 時代とともに進歩するハードウェア、サービスに対応して OS 自体が拡張される必要がある。
mir3636
parents: 21
diff changeset
111 - その信頼性を保証するには、従来の テストとデバッグでは不十分であり、テストしきれない部分が残ってしまう。
mir3636
parents: 21
diff changeset
112 - これに対処するため には、証明を用いる方法とプログラムの可能な実行をすべて数え上げるモデル検査を用いる方法がある。
mir3636
parents: 21
diff changeset
113 - 検証は一度ですむものではなく、アプリケーションやサービス、デバイスが新しくなることに検証をやり直す必要がある。
mir3636
parents: 21
diff changeset
114 - このため信頼性と拡張性を両立させることが重要である。
17
mir3636
parents: 16
diff changeset
115 -->
21
mir3636
parents: 17
diff changeset
116 <!--
mir3636
parents: 17
diff changeset
117 # 目次?
mir3636
parents: 17
diff changeset
118 -->
23
mir3636
parents: 21
diff changeset
119
mir3636
parents: 21
diff changeset
120
mir3636
parents: 21
diff changeset
121 </div>
mir3636
parents: 21
diff changeset
122 <div class='slide '>
mir3636
parents: 21
diff changeset
123 <!-- _S9SLIDE_ -->
mir3636
parents: 21
diff changeset
124 <h1 id="section-1">メタ計算の重要性</h1>
mir3636
parents: 21
diff changeset
125 <ul>
mir3636
parents: 21
diff changeset
126 <li>プログラムを記述する際、ノーマルレベルの処理の他に、メモリ管理やスレッド管理、CPU や GPU の資源管理等、記述しなければならない処理が存在する。これらの計算をメタ計算と呼ぶ。</li>
mir3636
parents: 21
diff changeset
127 <li>メタ計算はノーマルレベルの計算から切り離して記述したい。</li>
mir3636
parents: 21
diff changeset
128 <li>そのためには処理を細かく分割する必要があるが、関数やクラスなどの単位は容易に分割できない。</li>
mir3636
parents: 21
diff changeset
129 <li>そこで当研究室ではメタ計算を柔軟に記述するためのプログラミング言語の単位として Code Gear、Data Gear という単位を提案している。</li>
mir3636
parents: 21
diff changeset
130 </ul>
16
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
131
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
132
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
133 </div>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
134 <div class='slide '>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
135 <!-- _S9SLIDE_ -->
21
mir3636
parents: 17
diff changeset
136 <h1 id="continuation-based-c-cbc">Continuation based C (CbC)</h1>
mir3636
parents: 17
diff changeset
137 <ul>
mir3636
parents: 17
diff changeset
138 <li>Continuation based C (CbC) はこの Code Gear 単位を用いたプログラミング言語として開発している。</li>
mir3636
parents: 17
diff changeset
139 <li>Code Gear は 関数呼び出し時の環境を使わずに次の Code Gear へと goto 文によって遷移する。</li>
mir3636
parents: 17
diff changeset
140 <li>この goto 文による遷移を軽量継続と呼ぶ。</li>
mir3636
parents: 17
diff changeset
141 <li>CbC は軽量継続を持ち、C と互換性のある言語である。</li>
mir3636
parents: 17
diff changeset
142 </ul>
mir3636
parents: 17
diff changeset
143
mir3636
parents: 17
diff changeset
144
mir3636
parents: 17
diff changeset
145 </div>
mir3636
parents: 17
diff changeset
146 <div class='slide '>
mir3636
parents: 17
diff changeset
147 <!-- _S9SLIDE_ -->
mir3636
parents: 17
diff changeset
148 <h1 id="cbc-">CbC のコード例</h1>
16
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
149 <ul lang="Code_Gear">
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
150 <li>CbC では Code Gear は __code という型を持つ関数の構文で定義される。</li>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
151 <li>Code Gear は戻り値を持たないので、関数とは異なり return 文は存在しない。</li>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
152 <li>goto の後に Code Gear 名と引数を並べて、次の Code Gear の遷移を記述する。</li>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
153 <li>この goto の行き先を継続と呼び、このときの a+b が次の Code Gear への出力となる。</li>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
154 </ul>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
155 <pre><code>__code cs0(int a, int b){
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
156 goto cs1(a+b);
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
157 }
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
158
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
159 __code cs1(int c){
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
160 goto cs2(c);
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
161 }
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
162 </code></pre>
21
mir3636
parents: 17
diff changeset
163
mir3636
parents: 17
diff changeset
164
mir3636
parents: 17
diff changeset
165 </div>
mir3636
parents: 17
diff changeset
166 <div class='slide '>
mir3636
parents: 17
diff changeset
167 <!-- _S9SLIDE_ -->
mir3636
parents: 17
diff changeset
168 <h1 id="gears-os">Gears OS</h1>
mir3636
parents: 17
diff changeset
169 <ul>
mir3636
parents: 17
diff changeset
170 <li>Gears OS は Code Gear とデータの単位である Data Gear を用いて開発されており、CbC で記述されている。</li>
mir3636
parents: 17
diff changeset
171 <li>並列実行するための Task を、実行する Code Gear 、実行に必要な Input Data Gear 、Output Data Gear の組で表現する。</li>
mir3636
parents: 17
diff changeset
172 <li>Input/Output Data Gear の依存関係が解決された Code Gear を並列実行する。</li>
mir3636
parents: 17
diff changeset
173 </ul>
mir3636
parents: 17
diff changeset
174
mir3636
parents: 17
diff changeset
175
mir3636
parents: 17
diff changeset
176 </div>
mir3636
parents: 17
diff changeset
177 <div class='slide '>
mir3636
parents: 17
diff changeset
178 <!-- _S9SLIDE_ -->
mir3636
parents: 17
diff changeset
179 <h1 id="data-gear">Data Gear</h1>
mir3636
parents: 17
diff changeset
180 <ul>
mir3636
parents: 17
diff changeset
181 <li>Data Gear は データの単位であり、int や文字列などの Primitive Type を持っている。</li>
mir3636
parents: 17
diff changeset
182 <li>Code Gear は任意の数の Input Data Gear を参照して処理を行い、Output Data Gear を出力し処理を終える。</li>
mir3636
parents: 17
diff changeset
183 <li>接続された Data Gear 以外には参照を行わない。</li>
mir3636
parents: 17
diff changeset
184 </ul>
mir3636
parents: 17
diff changeset
185
mir3636
parents: 17
diff changeset
186
mir3636
parents: 17
diff changeset
187 </div>
mir3636
parents: 17
diff changeset
188 <div class='slide '>
mir3636
parents: 17
diff changeset
189 <!-- _S9SLIDE_ -->
mir3636
parents: 17
diff changeset
190 <h1 id="gears-">Gears でのメタ計算</h1>
mir3636
parents: 17
diff changeset
191 <ul>
mir3636
parents: 17
diff changeset
192 <li>Gears OS ではメタ計算を Meta Code Gear、Meta Data Gear で表現する。</li>
mir3636
parents: 17
diff changeset
193 <li>Meta Code Gear はノーマルレベルの Code Gear の直後に遷移され、メタ計算を実行する。</li>
mir3636
parents: 17
diff changeset
194 <li>Meta Code Gear で OS の機能であるメモリ管理やスレッド管理を行う。</li>
mir3636
parents: 17
diff changeset
195 </ul>
mir3636
parents: 17
diff changeset
196
mir3636
parents: 17
diff changeset
197 <div style="text-align: center;">
23
mir3636
parents: 21
diff changeset
198  <img src="./fig/MetaGear.pdf" alt="MetaGear" width="600" />
21
mir3636
parents: 17
diff changeset
199 </div>
16
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
200
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
201
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
202 </div>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
203 <div class='slide '>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
204 <!-- _S9SLIDE_ -->
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
205 <h1 id="gears-os-">Gears OS の構成</h1>
23
mir3636
parents: 21
diff changeset
206 <ul>
mir3636
parents: 21
diff changeset
207 <li>Gears OS は以下の要素で構成される。
mir3636
parents: 21
diff changeset
208 <ul>
mir3636
parents: 21
diff changeset
209 <li>Context</li>
mir3636
parents: 21
diff changeset
210 <li>TaskQueue</li>
mir3636
parents: 21
diff changeset
211 <li>TaskManager</li>
mir3636
parents: 21
diff changeset
212 <li>Worker</li>
mir3636
parents: 21
diff changeset
213 </ul>
mir3636
parents: 21
diff changeset
214 </li>
mir3636
parents: 21
diff changeset
215 </ul>
16
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
216
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
217
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
218 </div>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
219 <div class='slide '>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
220 <!-- _S9SLIDE_ -->
23
mir3636
parents: 21
diff changeset
221 <h1 id="gears-os--1">Gears OS の構成図</h1>
mir3636
parents: 21
diff changeset
222
mir3636
parents: 21
diff changeset
223 <div style="text-align: center;">
24
mir3636
parents: 23
diff changeset
224  <img src="./fig/gears_structure.pdf" alt="gears_structure" width="900" />
23
mir3636
parents: 21
diff changeset
225 </div>
mir3636
parents: 21
diff changeset
226
16
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
227
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
228 </div>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
229 <div class='slide '>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
230 <!-- _S9SLIDE_ -->
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
231 <h1 id="context">Context</h1>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
232 <ul>
23
mir3636
parents: 21
diff changeset
233 <li>Context とは使用される Code Gear と Data Gear を全て格納した Meta Data Gear である。</li>
16
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
234 <li>Gears OSは必要なCode Gear、Data Gearに参照したい場合、このContext を通す必要がある。</li>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
235 </ul>
24
mir3636
parents: 23
diff changeset
236 <div style="text-align: center;">
mir3636
parents: 23
diff changeset
237  <img src="./fig/Gearef.pdf" alt="gearef" width="900" />
mir3636
parents: 23
diff changeset
238 </div>
16
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
239
24
mir3636
parents: 23
diff changeset
240
mir3636
parents: 23
diff changeset
241 </div>
mir3636
parents: 23
diff changeset
242 <div class='slide '>
mir3636
parents: 23
diff changeset
243 <!-- _S9SLIDE_ -->
mir3636
parents: 23
diff changeset
244 <h1 id="context-">context の定義</h1>
mir3636
parents: 23
diff changeset
245
mir3636
parents: 23
diff changeset
246 <pre lang="contexr"><code>/* context define */
mir3636
parents: 23
diff changeset
247 struct Context {
mir3636
parents: 23
diff changeset
248 int codeNum; //実行可能な code の数
mir3636
parents: 23
diff changeset
249 __code (**code) (struct Context*); //実行可能な code Gear のリスト
mir3636
parents: 23
diff changeset
250 void* heapStart; //Data Gear の Allocate用のヒープ
mir3636
parents: 23
diff changeset
251 void* heap;
mir3636
parents: 23
diff changeset
252 long heapLimit;
mir3636
parents: 23
diff changeset
253 int dataNum; //Data Gear の数
mir3636
parents: 23
diff changeset
254 union Data **data; //Data Gear のリスト
mir3636
parents: 23
diff changeset
255 };
mir3636
parents: 23
diff changeset
256 </code></pre>
mir3636
parents: 23
diff changeset
257
mir3636
parents: 23
diff changeset
258 <!--
mir3636
parents: 23
diff changeset
259 # CbC による Gears OS 記述の問題点
mir3636
parents: 23
diff changeset
260 - Gears OS を CbC で実装する上でメタ計算の記述が煩雑であることがわかった。
mir3636
parents: 23
diff changeset
261 - 本研究ではこれらのメタ計算を自動生成することにより Gears OS を記述する上においてより良い構文をユーザーに提供することにした。
mir3636
parents: 23
diff changeset
262 - そのためのプロトタイプとして perl スクリプトを作成した。
mir3636
parents: 23
diff changeset
263 -->
16
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
264
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
265
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
266 </div>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
267 <div class='slide '>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
268 <!-- _S9SLIDE_ -->
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
269 <h1 id="interface">Interface</h1>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
270 <ul>
23
mir3636
parents: 21
diff changeset
271 <li>Code Gear と Data Gear は Interface と呼ばれるまとまりとして記述される。</li>
mir3636
parents: 21
diff changeset
272 <li>Interface は使用される Data Gear の定義と、それに対する Code Gear の集合である。</li>
mir3636
parents: 21
diff changeset
273 <li>Interface の操作に対応する Code Gear の引数は Interface に定義されている Data Gear を通して行われる。</li>
16
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
274 </ul>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
275
23
mir3636
parents: 21
diff changeset
276 <pre lang="interface"><code>typedef struct Stack&lt;Type, Impl&gt;{
mir3636
parents: 21
diff changeset
277 union Data* stack;
mir3636
parents: 21
diff changeset
278 union Data* data;
mir3636
parents: 21
diff changeset
279 union Data* data1;
mir3636
parents: 21
diff changeset
280 __code whenEmpty(...);
mir3636
parents: 21
diff changeset
281 __code clear(Impl* stack,__code next(...));
mir3636
parents: 21
diff changeset
282 __code push(Impl* stack,Type* data, __code next(...));
mir3636
parents: 21
diff changeset
283 __code pop(Impl* stack, __code next(Type* data, ...));
mir3636
parents: 21
diff changeset
284 __code pop2(Impl* stack, __code next(Type* data, Type* data1, ...));
mir3636
parents: 21
diff changeset
285 __code isEmpty(Impl* stack, __code next(...), __code whenEmpty(...));
mir3636
parents: 21
diff changeset
286 __code get(Impl* stack, __code next(Type* data, ...));
mir3636
parents: 21
diff changeset
287 __code get2(Impl* stack, __code next(Type* data, Type* data1, ...));
mir3636
parents: 21
diff changeset
288 __code next(...);
mir3636
parents: 21
diff changeset
289 } Stack;
mir3636
parents: 21
diff changeset
290 </code></pre>
mir3636
parents: 21
diff changeset
291
mir3636
parents: 21
diff changeset
292
mir3636
parents: 21
diff changeset
293 </div>
mir3636
parents: 21
diff changeset
294 <div class='slide '>
mir3636
parents: 21
diff changeset
295 <!-- _S9SLIDE_ -->
mir3636
parents: 21
diff changeset
296 <h1 id="interface-1">Interface</h1>
mir3636
parents: 21
diff changeset
297
25
mir3636
parents: 24
diff changeset
298 <ul lang="impl">
mir3636
parents: 24
diff changeset
299 <li>implement の例</li>
24
mir3636
parents: 23
diff changeset
300 </ul>
25
mir3636
parents: 24
diff changeset
301 <pre><code>Stack* createSingleLinkedStack(struct Context* context) {
16
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
302 struct Stack* stack = new Stack();
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
303 struct SingleLinkedStack* singleLinkedStack = new SingleLinkedStack();
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
304 stack-&gt;stack = (union Data*)singleLinkedStack;
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
305 singleLinkedStack-&gt;top = NULL;
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
306 stack-&gt;push = C_pushSingleLinkedStack;
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
307 stack-&gt;pop = C_popSingleLinkedStack;
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
308 stack-&gt;pop2 = C_pop2SingleLinkedStack;
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
309 stack-&gt;get = C_getSingleLinkedStack;
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
310 stack-&gt;get2 = C_get2SingleLinkedStack;
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
311 stack-&gt;isEmpty = C_isEmptySingleLinkedStack;
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
312 stack-&gt;clear = C_clearSingleLinkedStack;
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
313 return stack;
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
314 }
24
mir3636
parents: 23
diff changeset
315
25
mir3636
parents: 24
diff changeset
316 __code pushSingleLinkedStack(struct SingleLinkedStack* stack, union Data* data, __code next(...)) {
24
mir3636
parents: 23
diff changeset
317 Element* element = new Element();
mir3636
parents: 23
diff changeset
318 element-&gt;next = stack-&gt;top;
mir3636
parents: 23
diff changeset
319 element-&gt;data = data;
mir3636
parents: 23
diff changeset
320 stack-&gt;top = element;
mir3636
parents: 23
diff changeset
321 goto next(...);
mir3636
parents: 23
diff changeset
322 }
mir3636
parents: 23
diff changeset
323
16
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
324 </code></pre>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
325 <!--
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
326
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
327 <div style="text-align: center;">
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
328  <img src="./images/multiComponent.pdf" alt="message" width="600">
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
329 </div>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
330
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
331 -->
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
332
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
333
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
334 </div>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
335 <div class='slide '>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
336 <!-- _S9SLIDE_ -->
24
mir3636
parents: 23
diff changeset
337 <h1 id="stub-code-gear">stub Code Gear</h1>
16
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
338
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
339 <ul>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
340 <li>Code Gear が必要とする Data Gear を取り出す際に Context を通す必要がある。</li>
24
mir3636
parents: 23
diff changeset
341 <li>しかし、Meta Data Gear である Context をノーマルレベルの Code Gear から直接アクセスするのはよろしくない。</li>
16
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
342 <li>そこで Context から必要なデータを取り出して Code Gear に接続する、メタレベルの stub Code Gear を定義し、これを介して間接的に必要な Data Gear にアクセスする。</li>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
343 </ul>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
344
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
345 <pre lang="stub"><code>__code clearSingleLinkedStack(struct Context *context,struct SingleLinkedStack* stack,enum Code next) {
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
346 stack-&gt;top = NULL;
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
347 goto meta(context, next);
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
348 }
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
349
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
350 __code clearSingleLinkedStack_stub(struct Context* context) {
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
351 SingleLinkedStack* stack = (SingleLinkedStack*)GearImpl(context, Stack, stack);
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
352 enum Code next = Gearef(context, Stack)-&gt;next;
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
353 goto clearSingleLinkedStack(context, stack, next);
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
354 }
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
355 </code></pre>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
356
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
357
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
358 </div>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
359 <div class='slide '>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
360 <!-- _S9SLIDE_ -->
24
mir3636
parents: 23
diff changeset
361 <h1 id="contextstub-code-gear-">Context、stub Code Gear の自動生成</h1>
mir3636
parents: 23
diff changeset
362 <ul>
mir3636
parents: 23
diff changeset
363 <li>Gears OS ではノーマルレベルの計算の他に Context や stub などのメタ計算を記述する必要がある。</li>
mir3636
parents: 23
diff changeset
364 <li>現在の CbC で Gears OS を記述すると、このメタ計算の記述も行わなくてはならず、これには多くの労力を要する。</li>
mir3636
parents: 23
diff changeset
365 <li>この記述を助けるために Context を生成する generate_context と stub Code Gear を生成する generate_stub を perl スクリプトで作成した。</li>
mir3636
parents: 23
diff changeset
366 </ul>
25
mir3636
parents: 24
diff changeset
367 <div style="text-align: center;">
mir3636
parents: 24
diff changeset
368  <img src="./fig/generate_context.pdf" alt="generate_context" width="900" />
mir3636
parents: 24
diff changeset
369 </div>
24
mir3636
parents: 23
diff changeset
370
mir3636
parents: 23
diff changeset
371
mir3636
parents: 23
diff changeset
372 </div>
mir3636
parents: 23
diff changeset
373 <div class='slide '>
mir3636
parents: 23
diff changeset
374 <!-- _S9SLIDE_ -->
16
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
375 <h1 id="stub-code-gear-">stub Code Gear の生成</h1>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
376 <ul>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
377 <li>stub Code Gear は Code Gear 間の継続に挟まれ、Code Gear が必要な Data Gear を Context から取り出す処理を行うものである。</li>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
378 <li>stub Code Gear は Code Gear 毎に記述する必要があり、そのCode Gear の引数を見て取り出す Data Gear を選択する。</li>
25
mir3636
parents: 24
diff changeset
379 <li>generate_stub は指定された cbc ファイルの __code で記述された Code Gear を取得。</li>
mir3636
parents: 24
diff changeset
380 <li>Code Gear の引数と interface を照らし合わせ、Gearef または GearImpl を決定する。</li>
mir3636
parents: 24
diff changeset
381 <li>cbc ファイルの Code Gear から、生成した stub Code Gear を加えたファイルを生成する。</li>
16
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
382 </ul>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
383
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
384 <pre lang="stub"><code>__code clearSingleLinkedStack(struct Context *context,struct SingleLinkedStack* stack,enum Code next) {
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
385 stack-&gt;top = NULL;
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
386 goto meta(context, next);
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
387 }
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
388
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
389 __code clearSingleLinkedStack_stub(struct Context* context) {
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
390 SingleLinkedStack* stack = (SingleLinkedStack*)GearImpl(context, Stack, stack);
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
391 enum Code next = Gearef(context, Stack)-&gt;next;
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
392 goto clearSingleLinkedStack(context, stack, next);
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
393 }
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
394 </code></pre>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
395
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
396
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
397 </div>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
398 <div class='slide '>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
399 <!-- _S9SLIDE_ -->
24
mir3636
parents: 23
diff changeset
400 <h1 id="context--1">Context の生成</h1>
16
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
401
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
402 <ul>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
403 <li>Context は Meta Data Gear に相当し、Code Gear や Data Gear を管理している。</li>
25
mir3636
parents: 24
diff changeset
404 <li>generate_context は context.h から Data Gear、generate_stub から生成されたファイルから Code Gear を取得し、以下を生成する。
mir3636
parents: 24
diff changeset
405 <ul>
mir3636
parents: 24
diff changeset
406 <li>Context が持つ Code/Data Gear のリスト の Code/Data Gear 名とポインタを対応させるための enum の定義を記述した enumCode.h、enumData.h</li>
mir3636
parents: 24
diff changeset
407 <li>取得した Code/Data Gear から Context の生成を行う target-context</li>
mir3636
parents: 24
diff changeset
408 <li>Context を生成する際に Data Gear の Allocation を行う dataGearInit.c</li>
mir3636
parents: 24
diff changeset
409 </ul>
mir3636
parents: 24
diff changeset
410 </li>
16
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
411 </ul>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
412
25
mir3636
parents: 24
diff changeset
413 <div style="text-align: center;">
mir3636
parents: 24
diff changeset
414  <img src="./fig/generate_context3.pdf" alt="generate_context3" width="900" />
mir3636
parents: 24
diff changeset
415 </div>
mir3636
parents: 24
diff changeset
416
16
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
417
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
418 </div>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
419 <div class='slide '>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
420 <!-- _S9SLIDE_ -->
25
mir3636
parents: 24
diff changeset
421 <h1 id="section-2">今後の課題</h1>
16
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
422 <ul>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
423 <li>本研究では interface の記述、CbC ファイルから Gears OS の記述に必要な Context と stub の生成を行う perl スクリプトの生成を行なった。</li>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
424 <li>これにより Gears OS のコードの煩雑さは改善され、ユーザーは Context への接続を意識する必要がなくなった。</li>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
425 <li>今後の課題は Code Gear からメタ計算を行う meta Code Gear を生成できるようにし、ユーザーがメタレベルの処理を意識せずにコードを記述できるようにする。</li>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
426 <li>また、今回 perl スクリプトによって Context や stub の生成を行なったが、LLVM/clang 上で実装しコンパイラで直接 CbC を実行できるようにすることを目的とする。</li>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
427 </ul>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
428
21
mir3636
parents: 17
diff changeset
429 <p><a href="プロシン発表時間 セッション7 1/21 10:40 - 12:00"></a></p>
16
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
430 <!-- === end markdown block === -->
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
431 </div>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
432
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
433
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
434 </div><!-- presentation -->
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
435 </body>
b802c7ffb249 add Slide
mir3636
parents:
diff changeset
436 </html>