我刚读了一篇文章,上面写着:
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 - "kernel preemption"和 "interrupt"之间有什么区别吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9473301/