title: Gears OS による並列処理 author: Tatsuki IHA profile: lang: Japanese code-engine: coderay ## 研究目的 - 当研究室では 処理の単位を Code Gear、 データの単位を Data Gear を用いて 信頼性が高い並列処理を行う Gears OS を開発している - Gears OS では Task を Code Gear と実行するときに必要な Input Data Gear と出力するための Output Data Gear の組で表現される。 Input Data Gear/Output Data Gear によって依存関係が決定し、それにそって並列実行を行う. - 信頼性の確保はモデルチェック、検証等を使用して行う。この信頼性のための計算は通常の計算とは別の階層のメタ計算として記述する。 - また、 メタ計算は信頼性の他に CPU, GPU などの実行環境の切り替え, データ拡張等の柔軟性を提供する。 - 本研究では、 Gears OS の並列処理機構の実装を行う。また、並列処理の検証をメタ計算として記述することで、 並列処理の信頼性を保証する。 ## 今週 - Gears のリファクタ ## 基本的には - interface を使用している所を書き換え ``` c taskManager->taskManager = (union Data*)task->taskManager; taskManager->task = task; taskManager->next = next; goto meta(context, task->taskManager->spawn); ↓ struct TaskManager* taskManager = task->taskManager; goto taskManager->spawn(task, next(...)); ``` ## だが - 引っかからないパターンがある - perl script では, ``create(\w+)\((.*)\)`` みたいに実装の create が何かしらの行にないと, interface の変換がうまくいかない - なので, ちゃんと Interface file から引数情報を取る必要あり ``` c typedef struct TaskManager{ union Data* taskManager; struct Context* task; struct Context** tasks; __code spawn(Impl* taskManager, struct Context* task, __code next(...)); __code spawnTasks(Impl* taskManagerImpl, struct Context** tasks, __code next1(...), struct TaskManager* taskManager); __code setWaitTask(Impl* taskManagerImpl, struct Context* task, __code next(...)); __code shutdown(Impl* taskManagerImpl, __code next(...), struct TaskManager* taskManager, struct Queue* queue); __code incrementTaskCount(Impl* taskManagerImpl, __code next(...)); __code decrementTaskCount(Impl* taskManagerImpl, __code next(...)); __code next(...); __code next1(...); } TaskManager; ```