系统相关
首页 > 系统相关> > linux – “内核抢占”和“中断”之间有什么区别吗?

linux – “内核抢占”和“中断”之间有什么区别吗?

作者:互联网

我刚看了一篇文章说:

Reasons to control the interrupt system generally boil down to needing to provide synchronization. By disabling interrupts, you can guarantee that an interrupt handler will not preempt your current code. Moreover, disabling interrupts also disables kernel preemption. Neither disabling interrupt delivery nor disabling kernel preemption provides any protection from concurrent access from another processor,however.

所以我只是想知道中断和内核抢占之间的区别.

或者我们可以说禁用内核抢占还会禁用中断吗?

解决方法:

当进程中断时,内核会运行一些代码,这可能与进程的作用无关.
完成后,可能会发生两件事:
1.同样的过程将再次获得CPU.
2.一个不同的进程将获得CPU.目前的进程被抢先一步.

因此抢占只会在中断后发生,但中断并不总是会导致抢占.

标签:linux,linux-kernel,interrupt,preemption
来源: https://codeday.me/bug/20190714/1455854.html