changeset 6:f7f53d2387f3

4章 fix
author gongo@gendarme.cr.ie.u-ryukyu.ac.jp
date Fri, 06 Feb 2009 10:33:23 +0900
parents 42b2f2540153
children 6b06734f1b3a
files paper/cerium.tex paper/images/amdahl.bb paper/images/cell_arch.bb paper/images/cell_mailbox.bb paper/images/cell_ppe.bb paper/images/cell_simd.bb paper/images/cell_spe.bb paper/images/cell_spurs_pipeline.bb paper/images/cell_spurs_task.bb paper/images/cerium_sg_tree.bb paper/images/cerium_sg_tree.graffle paper/images/cerium_sg_tree.pdf paper/images/cerium_task.bb paper/images/manycore_data_split.bb paper/images/manycore_step.bb paper/images/tm_scheduler.bb paper/images/tm_sm_global.bb paper/images/tm_sm_global.graffle paper/images/tm_sm_global.pdf paper/images/tm_sm_rbuf.bb paper/images/tm_sm_state.bb paper/images/tm_sm_wbuf.bb paper/images/tm_sort.bb paper/images/tm_sort_calc.bb paper/images/tm_sync.bb paper/images/tm_task_post.bb paper/images/tm_task_struct.bb paper/master_paper.bib paper/taskmanager.tex
diffstat 29 files changed, 225 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/paper/cerium.tex	Thu Feb 05 16:51:20 2009 +0900
+++ b/paper/cerium.tex	Fri Feb 06 10:33:23 2009 +0900
@@ -1,8 +1,13 @@
 \chapter{Cerium} \label{chapter:cerium}
 
-Cerium \cite{cerium} は SceneGraph (\ref{sec:cerium_scene_graph}節)、
-Rendering Engine (\ref{sec:cerium_rendering}節)、Task Manager から構成され、
-主に以下の3つのタスクを持つ (\figref{cerium_task})。
+Cerium \cite{cerium} は、我々が提案したゲーム開発フレームワークで、
+独自に Rendering Engine (\ref{sec:cerium_rendering}節) を持つ。
+ゲーム中のオブジェクトの振る舞いや
+ルールは SceneGraph (\ref{sec:cerium_scene_graph}節) で管理し、
+それらの動きやレンダリングの処理を動的に SPE に割り振るカーネルとして
+Task Manager が用いられる。
+
+Cerium は主に以下の3つのタスクを持つ (\figref{cerium_task})。
 
 \begin{itemize}
 \item SceneGraph が持つ Polygon の座標から、実際に画面に表示する座標の
@@ -14,7 +19,7 @@
 
 \begin{figure}[htb]
   \begin{center}
-    \includegraphics[scale=0.8]{images/cerium_task.pdf}
+    \includegraphics[scale=0.5]{images/cerium_task.pdf}
     \caption{Cerium の要素}
     \label{fig:cerium_task}
   \end{center}
@@ -28,4 +33,76 @@
 
 \section{SceneGraph} \label{sec:cerium_scene_graph}
 
+本研究では、ゲーム中の一つの場面(Scene)を構成するオブジェクトや
+その振る舞い、ゲームのルールの集合を SceneGraph とする \cite{chiaki}。
+SceneGraph のノードは親子関係を持つ tree で構成される
+(\figref{cerium_sg_tree})。
+親子関係とは、親オブジェクトの回転や平行移動等の行列計算による
+頂点座標の変更が、子オブジェクトにも反映する関係のことである。
+これは子に対してスタックに積まれた親の変換行列を掛けることで実現できる。
+
+\begin{figure}[htb]
+  \begin{center}
+    \includegraphics[scale=0.8]{images/cerium_sg_tree.pdf}
+    \caption{SceneGraph}
+    \label{fig:cerium_sg_tree}
+  \end{center}
+\end{figure}
+
+\subsection{Scene の生成}
+ゲーム中に登場するオブジェクトは、オープンソースの
+3DCG制作ソフトである Blender \cite{blender} を用いる。
+Blender で記述したポリゴンオブジェクトを、座標やテクスチャイメージを
+埋め込んだ xml ファイルとして出力する。
+Blender にはPython インタプリタがあり、杉山 \cite{chiaki} が独自形式の
+xml ファイルを生成する Python スクリプトを作成している。
+xmlファイルは以下のような構造を持っている。
+
+{\small
+\begin{verbatim}
+<?xml version="1.0"?>
+<OBJECT-3D>
+    <surface name="BACK" size="6" prim="Triangle" parent="NULL">
+        <coordinate>
+            -227.432511 293.664585 -192.702660
+            235.318160 294.080875 -192.770592
+            ・・・・
+        </coordinate>
+        <normal>
+            0.000900 -1.000000 0.000000
+            ・・・・
+        </normal>
+        <model>
+            -0.016892 -30.731319 -35.638344
+        </model>
+        <texture>
+            -0.002805 0.996740
+            ・・・・
+        </texture>
+        <image name="ERTH.png.001">
+            (base64 でデコードされたテクスチャイメージ)
+        </image>
+    </surface>
+    <surface name="ENEMY" size="48" prim="Triangle" parent="BACK">
+        ・・・・
+    </surface>
+</OBJECT-3D>
+\end{verbatim}
+}
+xml には、オブジェクトの名前や親に該当するオブジェクトの名前、
+coordinate(ポリゴン情報)、texture(ポリゴンに対応するテクスチャ座標)、
+テクスチャイメージがある。
+
+xml ファイル形式を採用している理由は、
+Cerium が MacOSX や Linux、PS3 など複数の環境で動作することを目的としており、
+環境に依存しないテキスト形式でのデータ構造を構築できるからである。
+また、Cerium が将来的にネットワークを使用することを考えており、
+その際に有効なフォーマットであると考えたからである。
+
+\subsection{SceneGraph の操作}
+
+Cerium では SceneGraph を管理するクラスとして SceneGraphRoot を実装している。
+SceneGraphRoot は、
+
+
 \section{Rendering Engine} \label{sec:cerium_rendering}
--- a/paper/images/amdahl.bb	Thu Feb 05 16:51:20 2009 +0900
+++ b/paper/images/amdahl.bb	Fri Feb 06 10:33:23 2009 +0900
@@ -1,5 +1,5 @@
 %%Title: ./amdahl.pdf
 %%Creator: ebb Version 0.5.2 (+ArtBox)
 %%BoundingBox: 0 0 360 252
-%%CreationDate: Thu Feb  5 16:40:16 2009
+%%CreationDate: Fri Feb  6 10:30:52 2009
 
--- a/paper/images/cell_arch.bb	Thu Feb 05 16:51:20 2009 +0900
+++ b/paper/images/cell_arch.bb	Fri Feb 06 10:33:23 2009 +0900
@@ -1,5 +1,5 @@
 %%Title: ./cell_arch.pdf
 %%Creator: ebb Version 0.5.2 (+ArtBox)
 %%BoundingBox: 0 0 505 339
-%%CreationDate: Thu Feb  5 16:40:16 2009
+%%CreationDate: Fri Feb  6 10:30:52 2009
 
--- a/paper/images/cell_mailbox.bb	Thu Feb 05 16:51:20 2009 +0900
+++ b/paper/images/cell_mailbox.bb	Fri Feb 06 10:33:23 2009 +0900
@@ -1,5 +1,5 @@
 %%Title: ./cell_mailbox.pdf
 %%Creator: ebb Version 0.5.2 (+ArtBox)
 %%BoundingBox: 0 0 514 342
-%%CreationDate: Thu Feb  5 16:40:16 2009
+%%CreationDate: Fri Feb  6 10:30:52 2009
 
--- a/paper/images/cell_ppe.bb	Thu Feb 05 16:51:20 2009 +0900
+++ b/paper/images/cell_ppe.bb	Fri Feb 06 10:33:23 2009 +0900
@@ -1,5 +1,5 @@
 %%Title: ./cell_ppe.pdf
 %%Creator: ebb Version 0.5.2 (+ArtBox)
 %%BoundingBox: 0 0 370 327
-%%CreationDate: Thu Feb  5 16:40:16 2009
+%%CreationDate: Fri Feb  6 10:30:52 2009
 
--- a/paper/images/cell_simd.bb	Thu Feb 05 16:51:20 2009 +0900
+++ b/paper/images/cell_simd.bb	Fri Feb 06 10:33:23 2009 +0900
@@ -1,5 +1,5 @@
 %%Title: ./cell_simd.pdf
 %%Creator: ebb Version 0.5.2 (+ArtBox)
 %%BoundingBox: 0 0 402 261
-%%CreationDate: Thu Feb  5 16:40:16 2009
+%%CreationDate: Fri Feb  6 10:30:52 2009
 
--- a/paper/images/cell_spe.bb	Thu Feb 05 16:51:20 2009 +0900
+++ b/paper/images/cell_spe.bb	Fri Feb 06 10:33:23 2009 +0900
@@ -1,5 +1,5 @@
 %%Title: ./cell_spe.pdf
 %%Creator: ebb Version 0.5.2 (+ArtBox)
 %%BoundingBox: 0 0 380 340
-%%CreationDate: Thu Feb  5 16:40:16 2009
+%%CreationDate: Fri Feb  6 10:30:52 2009
 
--- a/paper/images/cell_spurs_pipeline.bb	Thu Feb 05 16:51:20 2009 +0900
+++ b/paper/images/cell_spurs_pipeline.bb	Fri Feb 06 10:33:23 2009 +0900
@@ -1,5 +1,5 @@
 %%Title: ./cell_spurs_pipeline.pdf
 %%Creator: ebb Version 0.5.2 (+ArtBox)
 %%BoundingBox: 0 0 533 187
-%%CreationDate: Thu Feb  5 16:40:16 2009
+%%CreationDate: Fri Feb  6 10:30:52 2009
 
--- a/paper/images/cell_spurs_task.bb	Thu Feb 05 16:51:20 2009 +0900
+++ b/paper/images/cell_spurs_task.bb	Fri Feb 06 10:33:23 2009 +0900
@@ -1,5 +1,5 @@
 %%Title: ./cell_spurs_task.pdf
 %%Creator: ebb Version 0.5.2 (+ArtBox)
 %%BoundingBox: 0 0 507 229
-%%CreationDate: Thu Feb  5 16:40:16 2009
+%%CreationDate: Fri Feb  6 10:30:52 2009
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/paper/images/cerium_sg_tree.bb	Fri Feb 06 10:33:23 2009 +0900
@@ -0,0 +1,5 @@
+%%Title: ./cerium_sg_tree.pdf
+%%Creator: ebb Version 0.5.2 (+ArtBox)
+%%BoundingBox: 0 0 425 274
+%%CreationDate: Fri Feb  6 10:30:52 2009
+
Binary file paper/images/cerium_sg_tree.graffle has changed
Binary file paper/images/cerium_sg_tree.pdf has changed
--- a/paper/images/cerium_task.bb	Thu Feb 05 16:51:20 2009 +0900
+++ b/paper/images/cerium_task.bb	Fri Feb 06 10:33:23 2009 +0900
@@ -1,5 +1,5 @@
 %%Title: ./cerium_task.pdf
 %%Creator: ebb Version 0.5.2 (+ArtBox)
 %%BoundingBox: 0 0 470 535
-%%CreationDate: Thu Feb  5 16:40:16 2009
+%%CreationDate: Fri Feb  6 10:30:52 2009
 
--- a/paper/images/manycore_data_split.bb	Thu Feb 05 16:51:20 2009 +0900
+++ b/paper/images/manycore_data_split.bb	Fri Feb 06 10:33:23 2009 +0900
@@ -1,5 +1,5 @@
 %%Title: ./manycore_data_split.pdf
 %%Creator: ebb Version 0.5.2 (+ArtBox)
 %%BoundingBox: 0 0 587 154
-%%CreationDate: Thu Feb  5 16:40:16 2009
+%%CreationDate: Fri Feb  6 10:30:52 2009
 
--- a/paper/images/manycore_step.bb	Thu Feb 05 16:51:20 2009 +0900
+++ b/paper/images/manycore_step.bb	Fri Feb 06 10:33:23 2009 +0900
@@ -1,5 +1,5 @@
 %%Title: ./manycore_step.pdf
 %%Creator: ebb Version 0.5.2 (+ArtBox)
 %%BoundingBox: 0 0 549 335
-%%CreationDate: Thu Feb  5 16:40:16 2009
+%%CreationDate: Fri Feb  6 10:30:52 2009
 
--- a/paper/images/tm_scheduler.bb	Thu Feb 05 16:51:20 2009 +0900
+++ b/paper/images/tm_scheduler.bb	Fri Feb 06 10:33:23 2009 +0900
@@ -1,5 +1,5 @@
 %%Title: ./tm_scheduler.pdf
 %%Creator: ebb Version 0.5.2 (+ArtBox)
 %%BoundingBox: 0 0 517 492
-%%CreationDate: Thu Feb  5 16:40:16 2009
+%%CreationDate: Fri Feb  6 10:30:52 2009
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/paper/images/tm_sm_global.bb	Fri Feb 06 10:33:23 2009 +0900
@@ -0,0 +1,5 @@
+%%Title: ./tm_sm_global.pdf
+%%Creator: ebb Version 0.5.2 (+ArtBox)
+%%BoundingBox: 0 0 523 364
+%%CreationDate: Fri Feb  6 10:30:52 2009
+
Binary file paper/images/tm_sm_global.graffle has changed
Binary file paper/images/tm_sm_global.pdf has changed
--- a/paper/images/tm_sm_rbuf.bb	Thu Feb 05 16:51:20 2009 +0900
+++ b/paper/images/tm_sm_rbuf.bb	Fri Feb 06 10:33:23 2009 +0900
@@ -1,5 +1,5 @@
 %%Title: ./tm_sm_rbuf.pdf
 %%Creator: ebb Version 0.5.2 (+ArtBox)
 %%BoundingBox: 0 0 405 225
-%%CreationDate: Thu Feb  5 16:40:16 2009
+%%CreationDate: Fri Feb  6 10:30:52 2009
 
--- a/paper/images/tm_sm_state.bb	Thu Feb 05 16:51:20 2009 +0900
+++ b/paper/images/tm_sm_state.bb	Fri Feb 06 10:33:23 2009 +0900
@@ -1,5 +1,5 @@
 %%Title: ./tm_sm_state.pdf
 %%Creator: ebb Version 0.5.2 (+ArtBox)
 %%BoundingBox: 0 0 370 342
-%%CreationDate: Thu Feb  5 16:40:16 2009
+%%CreationDate: Fri Feb  6 10:30:52 2009
 
--- a/paper/images/tm_sm_wbuf.bb	Thu Feb 05 16:51:20 2009 +0900
+++ b/paper/images/tm_sm_wbuf.bb	Fri Feb 06 10:33:23 2009 +0900
@@ -1,5 +1,5 @@
 %%Title: ./tm_sm_wbuf.pdf
 %%Creator: ebb Version 0.5.2 (+ArtBox)
 %%BoundingBox: 0 0 505 487
-%%CreationDate: Thu Feb  5 16:40:16 2009
+%%CreationDate: Fri Feb  6 10:30:52 2009
 
--- a/paper/images/tm_sort.bb	Thu Feb 05 16:51:20 2009 +0900
+++ b/paper/images/tm_sort.bb	Fri Feb 06 10:33:23 2009 +0900
@@ -1,5 +1,5 @@
 %%Title: ./tm_sort.pdf
 %%Creator: ebb Version 0.5.2 (+ArtBox)
 %%BoundingBox: 0 0 553 371
-%%CreationDate: Thu Feb  5 16:40:16 2009
+%%CreationDate: Fri Feb  6 10:30:52 2009
 
--- a/paper/images/tm_sort_calc.bb	Thu Feb 05 16:51:20 2009 +0900
+++ b/paper/images/tm_sort_calc.bb	Fri Feb 06 10:33:23 2009 +0900
@@ -1,5 +1,5 @@
 %%Title: ./tm_sort_calc.pdf
 %%Creator: ebb Version 0.5.2 (+ArtBox)
 %%BoundingBox: 0 0 360 216
-%%CreationDate: Thu Feb  5 16:40:16 2009
+%%CreationDate: Fri Feb  6 10:30:52 2009
 
--- a/paper/images/tm_sync.bb	Thu Feb 05 16:51:20 2009 +0900
+++ b/paper/images/tm_sync.bb	Fri Feb 06 10:33:23 2009 +0900
@@ -1,5 +1,5 @@
 %%Title: ./tm_sync.pdf
 %%Creator: ebb Version 0.5.2 (+ArtBox)
 %%BoundingBox: 0 0 577 554
-%%CreationDate: Thu Feb  5 16:40:16 2009
+%%CreationDate: Fri Feb  6 10:30:52 2009
 
--- a/paper/images/tm_task_post.bb	Thu Feb 05 16:51:20 2009 +0900
+++ b/paper/images/tm_task_post.bb	Fri Feb 06 10:33:23 2009 +0900
@@ -1,5 +1,5 @@
 %%Title: ./tm_task_post.pdf
 %%Creator: ebb Version 0.5.2 (+ArtBox)
 %%BoundingBox: 0 0 335 388
-%%CreationDate: Thu Feb  5 16:40:16 2009
+%%CreationDate: Fri Feb  6 10:30:52 2009
 
--- a/paper/images/tm_task_struct.bb	Thu Feb 05 16:51:20 2009 +0900
+++ b/paper/images/tm_task_struct.bb	Fri Feb 06 10:33:23 2009 +0900
@@ -1,5 +1,5 @@
 %%Title: ./tm_task_struct.pdf
 %%Creator: ebb Version 0.5.2 (+ArtBox)
 %%BoundingBox: 0 0 591 364
-%%CreationDate: Thu Feb  5 16:40:16 2009
+%%CreationDate: Fri Feb  6 10:30:52 2009
 
--- a/paper/master_paper.bib	Thu Feb 05 16:51:20 2009 +0900
+++ b/paper/master_paper.bib	Fri Feb 06 10:33:23 2009 +0900
@@ -5,6 +5,12 @@
 year = 2008
 }
 
+@manual{cell_abi,
+author = "{International Business Machines Corporation, Sony Computer Entertainment Incorporated, Toshiba Corporation}",
+title ="{Cell Broadband Engine Linux Reference Implementation Application Binary Interface Specification}",
+year = 2007
+}
+
 @manual{cell_cpp,
 author = "{International Business Machines Corporation, Sony Computer Entertainment Incorporated, Toshiba Corporation}",
 title = "{C/C++ Language Extensions for Cell Broadband Engine Architecture Version 2.6}",
@@ -84,7 +90,7 @@
 
 @misc{blender,
 title = "{Blender.jp - Blender Japanese Website}",
-howpublished = "\url{http://blender.jp/}"
+howpublished = "{http://blender.jp/}"
 }
 
 @article{kono,
@@ -112,4 +118,5 @@
 author = "",
 title = "{Simple DirectMedia Layer}",
 howpublished = "{http://www.libsdl.org/}"
-}
\ No newline at end of file
+}
+
--- a/paper/taskmanager.tex	Thu Feb 05 16:51:20 2009 +0900
+++ b/paper/taskmanager.tex	Fri Feb 06 10:33:23 2009 +0900
@@ -434,17 +434,31 @@
 \begin{table}[htb]
   \caption{STaskManager API} \label{tab:sm_api}
   \hbox to\hsize{\hfil
-  \begin{tabular}{c|l} \hline \hline
+  \begin{tabular}{l|l} \hline \hline
     create\_task  & Task を生成する \\ \hline
-    run           & 実行 Task Queue の実行 \\ \hline
     allocate      & 環境のアライメントを考慮した allocater \\ \hline
     \hline
     get\_input    & add\_inData で指定したデータを取得する \\ \hline
     get\_output   & add\_outData で指定した領域に書き込むバッファを取得する \\ \hline
     get\_param    & add\_param で指定した 32 bit データを取得する \\ \hline
+    \hline
+    global\_alloc & タスク間で共用する領域のアロケート \\ \hline
+    global\_get   & global\_alloc した領域のアドレスを取得 \\ \hline
+    global\_free  & global\_alloc した領域の free()  \\ \hline
+    \hline
+    dma\_store    & DMA 送信 \\ \hline
+    dma\_load     & DMA 受信 \\ \hline
+    dma\_wait     & DMA 転送完了を待つ \\\hline
+    \hline
+    mainMem\_alloc & メインメモリ上のアロケート \\ \hline
+    mainMem\_get   & mainMem\_alloc した領域のアドレス(メインメモリ空間) \\ \hline
+    mainMem\_wait  & mainMem\_alloc が完了するまで待つ \\ \hline
   \end{tabular}\hfil}
 \end{table}
 
+ここからは、\tabref{sm_api} に挙げた CPU スレッド上の機能を説明する。
+
+
 \subsection{Input Data の取得}
 
 \ref{sec:stask_code} 節の コードの rbuf には、
@@ -502,9 +516,97 @@
 タスク終了後、out に該当するメインメモリの領域が
 out と同じ値になっている。
 
+\subsection{タスク間の共用領域}
+
+各タスクは独立して動作するため、使用するメモリ領域も
+他のタスクと干渉することは無い。
+しかし、処理によってはタスク間で同じデータを使用する場合がある。
+
+例えば、\ref{sec:cerium_rendering_draw_span} 節で後述するが、
+ポリゴンのレンダリング時はテクスチャイメージが必要となり、
+そのデータは SPE の LS 上に置かなければならない。
+このとき、各タスクで同じテクスチャイメージを使うことがあり、
+その場合、タスク毎に同じデータを持つよりも、LS 上に一つロードして
+そのデータを各タスクが参照することが望ましい (\figref{tm_sm_global})。
+
+\begin{figure}[htb]
+  \begin{center}
+    \includegraphics[scale=0.7]{./images/tm_sm_global.pdf}
+  \end{center}
+  \caption{タスク間の共用領域とそのアクセス方法}
+  \label{fig:tm_sm_global}
+\end{figure}
+
+共用領域をアロケートするには、\verb+global_alloc(int id, int size)+ を使う。
+id は、アロケートした領域に割り振る番号で、
+size がアロケートするバイト数を表す。
+アロケートした領域のアドレスは \verb+global_get(int id)+ で、
+\verb+global_alloc()+ 時に指定した id を渡すことで取得できる。
+\verb+global_alloc()+ した領域は、TaskManager 側で解放することは無いので
+ユーザが \verb+global_free(int id)+ を実行する必要がある。
+
+共用領域は、各 SPE 上に置かれるので、違う SPE の領域を参照することはできない。
+したがって、同じデータを使う可能性のタスクを
+同じ SPE 上で実行させることにより、メモリ使用量も軽減できる。
+
+
+\subsection{DMA 命令}
+
+タスクの入力データや結果の出力データの操作は、
+TaskManagerが パイプラインに沿ってDMA を行っている。
+しかし、タスク内でメインメモリ上の新たなデータが必要になる可能性がある。
+この時、タスク内で明示的に DMA 転送命令を出すことができる。
+
+\verb+dma_load(unsigned int ls, unsigned int ea, int size, int tag)+
+はメインメモリ上のデータ ea から、SPE の LS 上の領域 ls に
+size バイトの DMA 転送を行う。
+Cell の DMA 転送ではタグを使用することになっており、
+指定したタグ毎に DMA 転送完了待ちを行うことができる。
+タグは Cell の仕様では 0 〜 31 を使用することが出来る。
+
+同じ様に、\verb+dma_store(unsigned int ls, unsigned int ea, int size, int tag)+
+では SPE から PPE への DMA 送信を行う。
+
+DMA 送受信の完了を待つのが \verb+dma_wait(int tag)+ ある。
+
+\verb+dma_load()+ や \verb+dma_store()+ は DMA 命令の発行だけだが、
+\verb+dma_wait()+ では転送を待たなくてはならず、そこでタスクが一時ストップ
+してしまう。これは並列度を下げてしまう要因である。
+対処法としては、load や store を発行した後、すぐに wait には入らず
+別の処理を行う。こうすることにより、DMA 転送の開始から終了までの
+待ち時間を隠蔽することができ、並列度を下げることはなくなる。
+
+\subsection{メインメモリ上のアロケート}
+
+SPE 上でデータを操作しているとき、例えばリストや木構造の場合は
+新しい要素が生成される場合がある。
+このとき、SPE 上で生成されたデータはそのままではメインメモリには反映されない。
+反映させるには、メインメモリ上の領域をアロケートし、そこに
+DMA でデータを転送すればよい。
+
+STaskManager では、メインメモリ上のアロケートを行う
+\verb+mainMem_alloc(id, size)+ が実装されている。
+id は領域に割り振る番号で、size バイト分アロケートする。
+SPE からメインメモリへのアロケート命令は Mailbox を用いており、
+\verb+mainMem_alloc()+ を実行後すぐにアロケートされるわけではない。
+\verb+mainMem_wait(int id)+ で、指定した id の領域のアロケート完了の
+メールが来るのを待ち、
+\verb+mainMem_ger(int id)+ で、領域のアドレスが得られる。
+このときのアドレスはメインメモリ空間であることに気をつける必要がある。
+
+ちなみに、Cell には Callback 機能があり、PPE 上で関数を実行し、
+その値を SPE に渡すということができる \cite{cell_abi} 。
+SPE 上での printf() といったシステムコールも、Callback 機能で
+実装されている。
+
+Callback を使えば、malloc() を PPE 上で実行し、その返り値であるアドレスを
+SPE に渡すという手法で、この \verb+mainMem_alloc()+ 実装できる。
+しかし、Callback は一度 SPE そのものを停止させるため、並列度の観点から
+\verb+mainMem_alloc()+ を実装することになった。
+
 \subsection{CPU スレッドでのタスク生成}
 
-各 CPU 内でも、タスクを生成することはできる。
+各 CPU 内でも、メインスレッドと同じ様にタスクを生成することができる。
 
 \begin{verbatim}
 Task *task = smanager->create_task(TASK_ID);