📜  操作系统中抢占式内核与非抢占式内核之间的区别

📅  最后修改于: 2021-08-25 17:35:57             🧑  作者: Mango

1.抢占式内核:
顾名思义,抢占式内核是一种始终执行准备运行的最高优先级任务的内核。除非并且直到功能是互斥的,否则它不能使用不可重入的函数。

示例: Linux 2-6

2.非抢占式内核:
顾名思义,非抢占式内核是一种内核,它在内核数据结构上没有竞争条件,因为一次仅一个进程在内核中处于活动状态。对于实时应用程序,它被认为是一个严重的缺点,因为它不允许抢占以内核模式运行的进程。

示例: Linux 2.4

操作系统中的抢占式内核和非抢占式内核之间的区别:

Preemptive Kernel 

 Non-Preemptive Kernel 

It is a process that might be replaced immediately.  It is a process that continuous to run until it finishes handling execution handler or voluntarily relinquishes CPU. 
It is more suitable for real time programming as compared to non-preemptive kernels.   It is less suitable for real-time programming as compared to preemptive kernel.  
In this, higher priority task that are ready to run is given CPU control.   In this, each and every task are explicitly given up CPU control.  
It generally allows preemption even in kernel mode.   It generally does not allow preemption of process running in kernel mode.  
Responsive time is deterministic and is more responsive as compared to non-preemptive kernel. Response time is nondeterministic and is less responsive as compared to preemptive kernel.
Higher priority task becomes ready, currently running task is suspended and moved to ready queue. Higher priority task might have to wait for long time.  
It does not require semaphores.   Shared data generally requires semaphores.  
It cannot use non-reentrant code.   It can use non-reentrant code.  
It is more difficult to design preemptive kernels as compared to non-preemptive kernel. It is less difficult to design non-preemptive kernels as compared to preemptive kernels.  
They are more secure and more useful in real-world scenarios.   They are less secure and less useful in real-world scenarios.