linux - "kernel preemption"和 "interrupt"之间有什么区别吗?

标签 linux linux-kernel interrupt preemption

我刚读了一篇文章,上面写着:

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/

相关文章:

c++ - 使用 volatile 类成员进行中断处理

windows - Web 应用程序 IPC/RPC 与客户端应用程序

linux - 登录流量到达与 Linux 的 promisc 接口(interface)

控制台上的 linux kprint 消息

c - Linux内核模块无线接口(interface)比特率

linux - Linux 中的时钟源

linux - 如何在 shell 脚本中用户输入后添加新行

c - 等待所有线程计时器回调完成的安全方法

assembly - INT 10, 13h 如何与属性一起使用?

linux-kernel - 我的中断处理程序应该禁用中断还是 ARM 处理器自动执行此操作?