annotate slide/slide.md @ 15:687e04e14a2c

add slide
author matac42 <matac@cr.ie.u-ryukyu.ac.jp>
date Tue, 24 May 2022 06:08:00 +0900
parents
children e5dbeddc9958
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 title: GearsOSにおけるinodeを用いたFile systemの実装
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 author: 又吉 雄斗
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 profile: 並列信頼研
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 ## inodeを用いたgearsDirectoryの実装
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 - アプリケーションの信頼性を保証するために,アプリケーションが動作するOSの信頼性を高める必要がある
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 - 信頼性確保の方法として定理証明やモデル検査がある
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 - 当研究室では,信頼性の保証を目的としたGearsOSを開発している
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 - GearsOSで未実装の機能であるファイルシステムの実装を目指す
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 - <span style="color: red; ">今回はUnix likeにディレクトリシステムを実装した</span>
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 - GearsOSへUnixのFile systemの仕組みを取り入れるアプローチをとる
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 - GearsOSのディレクトリシステムであるgearsDirectoryについて説明する
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 ## Continuation based C
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 - Cの下位言語である
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 - プログラムはCodeGearと呼ばれる処理の単位で記述する
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 - データはDataGearと呼ばれる単位を用いる
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 - ノーマルレベルとメタレベルの処理を切り分けることが容易に可能である
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 - function callの継続の代わりにgotoによる継続を用いる
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 - 呼び出し履歴を持たないことから軽量継続と呼ぶ
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 &emsp;
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 <div style="text-align: center;">
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 <img src="../paper/figs/dgcgdg.svg" width="1000">
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 </div>
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
30
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 ## GearsOS
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
32
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 - 当研究室にて,信頼性と拡張性の両立を目的として開発している
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 - CbCで記述されている
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 - Gearという概念があり,実行の単位をCodeGear,データの単位をDataGearと呼ぶ
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 - ノーマルレベルとメタレベルの処理を切り分けることが容易にできる
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
37
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 ## GearsOS
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
39
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 ### CodeGearとmetaCodeGearの関係
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
41
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 - ノーマルレベルとメタレベルの存在
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 - CodeGearがDataGearを受け取り,処理後にDataGearを次のCodeGearに渡すという動作をしているように見える
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 - 実際にはデータの整合性の確認や資源管理などのメタレベルの処理が存在し,それらの計算はMetaCodeGearで行われる
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
45
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 <div style="text-align: center;">
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 <img src="../paper/figs/meta_cg_dg.svg" width="1200">
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 </div>
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
49
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 ## GearsOS
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
51
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 ### Context
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
53
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 - GearsOS上全てのCodeGear,DataGearの参照を持つ
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 - OS上の処理の実行単位
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
56 - Gearの概念ではMetaDataGearに当たる
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
57 - ノーマルレベルから直接参照されず,必ずMetaDataGearとしてMetaCodeGearから参照される
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
58
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
59 <!--
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 ### Contextの種類
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
61
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
62 - OS全体のContextを管理するKernel Context
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
63 - ユーザープログラムごとに存在するUser Context
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
64 - CPUやGPUごとに存在するCPU Context
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
65
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
66 -->
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
67
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
68 ## GearsOS
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
69
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
70 ### CodeGear遷移の流れ
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
71
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
72 <div style="text-align: center;">
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
73 <img src="figs/context.svg" width="1200">
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
74 </div>
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
75
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
76 ## UnixのFile system
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
77
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
78 UnixのFile systemはBTreeを用いたinodeで構成されており,xv6もその仕組みを用いている
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
79
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
80 ### xv6
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
81
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
82 - MITで教育用の目的で開発されたOS
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
83 - Unixの基本的な構造を持つ
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
84 - 当研究室ではxv6のCbCでの書き換え,分析を行なっている
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
85 - File systemではinodeの仕組みが用いられている
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
86
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
87 ### inode
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
88
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
89 - ファイルの属性情報が書かれたデータである
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
90 - 識別番号としてinode numberを持つ
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
91 - inodeはファイルシステム始動時にinode領域をディスク上に確保する
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
92
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
93 ## GearsFileSystemにおけるdirectoryの構成
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
94
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
95 - 2つのRedBlackTreeを用いる
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
96 1. filenameとinode numberのペアを持つindex tree
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
97 1. inode numberとinodeのポインタのペアを持つinode tree
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
98 - カレントディレクトリはgearsDirectory-\>currentDirectoryに保存される
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
99
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
100 <div style="text-align: center;">
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
101 <img src="figs/inode.svg" width="1000">
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
102 </div>
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
103
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
104 ## Unix Like な interface
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
105
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
106 ### mkdir
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
107
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
108 ```c
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
109 __code mkdir(struct GearsDirectoryImpl* gearsDirectory, struct Integer* name, __code next(...)) {
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
110 struct FTree* newDirectory = createFileSystemTree(context, gearsDirectory->currentDirectory);
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
111 Node* inode = new Node();
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
112 inode->key = gearsDirectory->INodeNumber;
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
113 inode->value = newDirectory;
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
114 struct FTree* cDirectory = new FTree();
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
115 cDirectory = gearsDirectory->iNodeTree;
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
116 goto cDirectory->put(inode, mkdir2);
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
117 }
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
118
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
119 __code mkdir2(struct GearsDirectoryImpl* gearsDirectory, struct Integer* name, __code next(...)) {
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
120 Node* dir = new Node();
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
121 dir->key = name->value;
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
122 Integer* iNum = new Integer();
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
123 iNum->value = gearsDirectory->INodeNumber;
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
124 dir->value = iNum;
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
125 gearsDirectory->INodeNumber = gearsDirectory->INodeNumber + 1;
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
126 struct FTree* cDirectory = new FTree();
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
127 cDirectory = gearsDirectory->currentDirectory;
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
128 goto cDirectory->put(dir, next(...));
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
129 }
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
130 ```
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
131
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
132 ## Unix Like な interface
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
133
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
134 ### mkdir
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
135
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
136 <div style="text-align: center;">
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
137 <img src="figs/mkdir.svg" width="900">
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
138 </div>
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
139
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
140 <!--
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
141 ## Unix Like な interface
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
142
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
143 ### ls
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
144
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
145 ```c
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
146 __code ls(struct GearsDirectoryImpl* gearsDirectory, struct Integer* name, __code next(...)) {
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
147 Node* dir = new Node();
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
148 dir->key = name->value;
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
149 struct FTree* cDirectory = new FTree();
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
150 cDirectory = gearsDirectory->currentDirectory;
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
151 goto cDirectory->get(dir, ls2);
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
152 }
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
153
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
154 __code ls2(struct GearsDirectoryImpl* gearsDirectory, struct Node* node, __code next(...)) {
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
155 printf("%d\n", node->key);
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
156 goto next(...);
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
157 }
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
158 ```
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
159
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
160 ## Unix Like な interface
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
161
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
162 ### ls
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
163
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
164 <div style="text-align: center;">
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
165 <img src="figs/ls.svg" width="1000">
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
166 </div>
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
167
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
168 ## Unix Like な interface
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
169
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
170 ### cd
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
171
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
172 ```c
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
173 __code cd2Child(struct GearsDirectoryImpl* gearsDirectory, struct Integer* name, __code next(...)) {
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
174 struct FTree* cDirectory = new FTree();
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
175 cDirectory = gearsDirectory->currentDirectory;
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
176 struct Node* node = new Node();
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
177 node->key = name->value;
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
178 goto cDirectory->get(node, cd2Child2);
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
179 }
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
180
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
181 __code cd2Child2(struct GearsDirectoryImpl* gearsDirectory, struct Node* node, __code next(...)) {
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
182 struct FTree* iNodeTree = new FTree();
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
183 iNodeTree = gearsDirectory->iNodeTree;
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
184 goto iNodeTree->get(node->value, cd2Child3);
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
185 }
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
186
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
187 __code cd2Child3(struct GearsDirectoryImpl* gearsDirectory, struct Node* node, __code next(...)) {
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
188 gearsDirectory->currentDirectory = node->value;
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
189 goto next(...);
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
190 }
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
191 ```
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
192
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
193 ## Unix Like な interface
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
194
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
195 ### cd
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
196
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
197 <div style="text-align: center;">
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
198 <img src="figs/cd.svg" width="1200">
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
199 </div>
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
200
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
201 -->
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
202
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
203 ## GearsDirectoryにおける非破壊編集ツリー
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
204
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
205 - GearsOSにおける永続データは非破壊的な編集を行う木構造を用いて保存する
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
206 - ディレクトリシステム自体にバックアップの機能を搭載することが可能と考える
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
207
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
208 <div style="text-align: center;">
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
209 <img src="../paper/figs/nondestructive_tree_modification.png" width="1200">
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
210 </div>
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
211
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
212 ## gearsDirectoryまとめ
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
213
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
214 - gearsDirectoryの実装について説明した
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
215 - RedBlackTreeを用いてinodeの仕組みを構築し,ls,cd,mkdirを作成するなどして,Unix Likeに構築することが出来た
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
216 - RedBlackTreeのシンプルなinterfaceにより比較的容易に実装を行うことができた
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
217 - 形式手法とファイルシステムの機能の両面で信頼性の向上が図れると考える
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
218
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
219 ## GearsFileSystemの今後
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
220
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
221 ### gearsDirectory path
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
222
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
223 - gearsDirectoryにはpathの機能が実装されていない
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
224 - full path指定のlsなどが実装できない状態である
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
225 - FileSystemTreeを拡張し,ノードをたどりpathを生成する様な機能を実装する必要がある
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
226
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
227 ### gearsDirectory filename
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
228
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
229 - 現状はgearsDirectoryのfilenameはIntegerの構造で管理されている
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
230 - filenameは一般的に文字列型であるためIntegerから文字列型に変更する必要がある
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
231
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
232 <!--
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
233 ## GearsFileSystemの今後
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
234
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
235 ### gearsDirectory on disk
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
236
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
237 - 現状はgearsDirectoryはon memoryで実装されている
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
238 - inodeをdisk上に構築する必要がある
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
239
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
240 ### GearsShell
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
241
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
242 - 現状のGearsOSはユーザーの入力を受け付けることが出来ず,言語フレームワークの様に機能している
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
243 - gearsFileSystemなどGearsOSの各機能と接続し,今回作成したcdやlsの様なコマンドを受け付けるGearsShellを作成したい
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
244
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
245 ### ファイルのバックアップ
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
246
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
247 - レコードのDataをファイルの差分履歴として保持し,日時情報を付け加えることでVersion Control Systemのような機能を持たせることが可能であると考えられる
687e04e14a2c add slide
matac42 <matac@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
248 -->