process - Linux Kernel Code Execution Contexts -


when process executing in user space issues system call or triggers exception, enters kernel space , kernel starts executing on behalf of process. kernel said executing in process context. when interrupt occurs kernel executes in interrupt context. have studied kernel execution in kernel thread, kernel processes runs in background.

my questions :

  1. does kernel execute in other contexts?

  2. suppose process in user space never executes system call or triggers exception or no interrupt occurs, kernel code ever execute ?

the kernel runs periodically, sets timer fire interrupt @ predefined frequency (100 hz (linux 2.4/x86), 1000hz (early linux 2.6/x86), 250hz (newer linux 2.6/x86)).

the kernel need in order preemptive multitasking. otoh, oses doing cooperative multitasking (windows 3.1, classic mac os) needn't this, , switch tasks on response call running task (which lead runaway tasks hanging whole system).

note there effort optimize use of timer: newer linux smarter when there no runnable tasks, sets timer far in future can, allow cpu sleep longer , deeper, , preserve power (the config_nohz kernel config option). running powertop show number of wakeups per second, on idle system can lower 250 wakeups per second you'd expect of traditional implementation.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -