본문 바로가기

Programming

Preemptive kernel vs Non-preemptive kernel

the preemption is -> The ability of the operating system to preempt or stop a currently scheduled task in favour of a higher priority task. The scheduling may be one of, but not limited to, process or I/O scheduling etc.


Under Linux, user-space programs have always been preemptible : the kernel interrupts user-space programs to switch to other threads, using the regular clock tick. So, the kernel doesn't wait for user-space programs to explicitly release the processor (which is the case in cooperative multitasking). This means that an infinite loop in an user-space program cannot block the system.


However, until 2.6 kernels, the kernel itself was not preemtible : as soon as one thread has entered the kernel, it could not be preempted to execute an other thread. However, this absence of preemption in the kernel caused several problems with regard to latency and scalability. So, kernel preemption has been introduced in 2.6 kernels, and one can enable or disable it using the CONFIG_PREEMPT option. If CONFIG_PREEMPT is enabled, then kernel code can be preempted everywhere, except when the code has disabled local interrupts. An infinite loop in the code can no longer block the entire system. If CONFIG_PREEMPT is disabled, then the 2.4 behaviour is restored.



즉, 커널모드로 수행중인 프로세스가 cli ~ sti 를 하지않은 구간에서도 context switch 가 될수있느냐 없느냐의 차이.

라고 한마디로 요약할수 있을것 같다.

'Programming' 카테고리의 다른 글

Settingup ARMv7 environment with QEMU  (3) 2013.10.24
How NX is implemented in x86 Linux  (0) 2013.10.22
Linux kernel memory allocation  (0) 2013.09.25
QEMU NAT configuration  (0) 2013.09.17
Windows PE Structure  (0) 2013.09.12