I have this problem related to the concept of Direct Memory Access (DMA). Does the OS/Linux Kernel have some ways to know which instruction is using DMA and which doesn't? Or the DMA is completely implemented by hardware and OS has no access to the DMA controller?
我有这个问题与直接内存访问(DMA)的概念有关。 OS / Linux内核是否有一些方法可以知道哪条指令正在使用DMA而哪些指令不使用?或者DMA完全由硬件实现,操作系统无法访问DMA控制器?
1 个解决方案
#1
1
Your question is not very clear, because DMA is not about CPU instructions. It's a piece of hardware that handles memory access without involving the CPU. For example it would be highly unproductive to receive a network packet byte by byte from a network adapter. Instead the OS sets up a DMA region that is accessible by the network adapter which writes the received data directly into that region without having to occupy the CPU. So, of course the OS is aware of DMA, it is one of its tasks to manage its configuration in order to preserve CPU cycles for more useful work.
你的问题不是很清楚,因为DMA与CPU指令无关。它是一块处理内存访问而不涉及CPU的硬件。例如,从网络适配器逐字节地接收网络数据包将是非常没有效益的。相反,操作系统设置一个可由网络适配器访问的DMA区域,该区域将接收的数据直接写入该区域,而不必占用CPU。因此,操作系统当然知道DMA,它是管理其配置的任务之一,以便为更有用的工作保留CPU周期。
#1
1
Your question is not very clear, because DMA is not about CPU instructions. It's a piece of hardware that handles memory access without involving the CPU. For example it would be highly unproductive to receive a network packet byte by byte from a network adapter. Instead the OS sets up a DMA region that is accessible by the network adapter which writes the received data directly into that region without having to occupy the CPU. So, of course the OS is aware of DMA, it is one of its tasks to manage its configuration in order to preserve CPU cycles for more useful work.
你的问题不是很清楚,因为DMA与CPU指令无关。它是一块处理内存访问而不涉及CPU的硬件。例如,从网络适配器逐字节地接收网络数据包将是非常没有效益的。相反,操作系统设置一个可由网络适配器访问的DMA区域,该区域将接收的数据直接写入该区域,而不必占用CPU。因此,操作系统当然知道DMA,它是管理其配置的任务之一,以便为更有用的工作保留CPU周期。