Created
September 15, 2012 14:46
-
-
Save hnakagawa/3728305 to your computer and use it in GitHub Desktop.
第(3+1)回 六本木 Linux カーネル読書会 議事録
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
システムコールexit()のメイン処理は、kernel/exit.cのdo_exit関数から始まります。 | |
do_exitから呼び出されている、exit_xxx関数を読んでいけば大まかな処理が解る | |
* exit_signals | |
signalをmaskしていたりして、pending状態になっているsignalを処理している。 | |
終了したtask_structがthreadだった場合、pendingしているsignalを他のthreadに付け直す必要があり、その処理をretarget_shared_pending関数で行っている。 | |
* exit_itimers | |
いわゆるpoxiタイマー(timer_createで作る奴)の解放処理。 | |
* exit_mm | |
カーネルスレッドを除くプロセスまたスレッドのtask_struct構造体はメモリ空間を表すmm_struct構造体を保持している(スレッドでは共有)。 | |
そのmm_structの解放処理を行っている。 | |
* exit_sem | |
保持しているセマフォの解放処理。 | |
* exit_shm | |
保持している共有メモリの解放処理。 | |
* exit_files | |
struct files_struct(開いているファイルディスクリプタ)の解放処理。 | |
* exit_fs | |
struct fs_struct(プロセスの作業ディレクトリ)の解放処理。 | |
* exit_threads | |
アーキテクチャ固有のプロセス終了処理を行う。 | |
* exit_notify | |
プロセスが終了した場合、親プロセスへのSIGCHLDの配信や親プロセスの付け替え(daemon化とか)や、release_taskを呼び出しtask_structが保持している一部データ構造の解放等も行う。 | |
* exit_io_context | |
IOスケジューラ回りのデータ構造、task_struct->io_contextの解放処理。 | |
* 最終処理 | |
task_sturct->stateをTASK_DEADに変えてschedule()を呼び出している。 | |
schedule()から処理が帰る事はなく、スケジューラ処理の最終段階(finish_task_switch関数)で、task_structを解放している。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment