Documentation/DocBook/kernel-hacking/basic-players.html に Linux において CPU が実行しているコンテキストについて書かれています。Documentation/DocBook/kernel-hacking/basic-players.html ではコンテキストを Players と呼んでいます。次の表は context (players) についてまとめたものです。
Context | Description | |
User Space 実行中 running a process in user space | Userland のアプリケーションやコマンドを実行している状態です。system call、例外(trap)、より優先度が高い task へ切り替えるためのプリエンプション、ハードウエア割り込みによって kernel 内の実行に移ります。kernel 内のコードは User 空間で実行されることはありません。 | |
User Space と関連した kernel 内実行 running in kernel space, associated with a process (user context) | Userland のプロセスと関連した kernel 内の処理です。system call または例外によって kernel に実行が移った状態です。デバイスドライバを開発する立場であれば system call がきっかけで kernel 内に実行が移った状況だと考えて良いでしょう。system call の open(), close(), read(), write(), ioctl(), lseek(), mmap(), poll() などです。copy_from_user()、copy_to_user() などでユーザーランドのアプリケーションと情報を交換できる状況です。 | |
User Space と関連しない kernel 内実行 running in kernel space, not associated with a process (user context) | Userland のプロセスと関連していない kernel 内の処理です。kernel 内 thread (kthread) /include/linux/kthread.h 実行中、work queue /include/linux/workqueue.h に登録した関数を実行している最中です。User Space と関連が無いのでユーザーランドのアプリケーションと情報は交換できません。上記の Userland に関連したコンテキスト、この項目に分類されるコンテキスト、次の softirq を起床するすることはできます。 | |
softirq 実行中 not associated with any process,serving a softirq, tasklet, or timer | softirq | |
---|---|---|
tasklet | ||
timer | ||
hardware 割り込み実行中 not associated with any process, serving a hardware interrupt |