如何能快速的处理器处理中断 [英] how quick can the processor handle the interrupts

查看:155
本文介绍了如何能快速的处理器处理中断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习有关的中断。所以大部分建筑被中断驱动的,如果一切都中断驱动的,处理器可以多快的速度处理所有这些。例如,虽然pressing一个键板键,它创建一个中断请求内核寻找缓冲器为新的字符,在这种情况下,如何快速处理器可以服务,中断放时也,处理器需要切换到内核空间和上下文切换方面,花费了很多。所以,我认为,即使在所有这些如果处理器有着不错的表现,那么我只能假设,两次击键之间的时间是大量的时间在电脑速度方面?一平均,多少上下文切换在一分钟内发生了什么?我想这会给我一些想法什么我真的学习,得到一个现实生活中的感觉....谢谢....

I was studying about interrupts. So most architecture are interrupt driven, if everything is interrupt driven, how fast the processor can handle all of those. For example, while pressing a key board keys, it creates an interrupt asking the kernel to look for the buffer for new characters, in that case, how fast the processor can serve, also when an interrupt is put, the processor needs to switch to kernel space and that costs a lot in terms of context switch. So I assume, even after all these if the processor has a good performance, then I can only assume that the time between two key strokes is lots of time in terms of computer speed? One an average, how many context switch happens in one minute? I guess that would give me some idea about what I am really studying and to get an real life feel.... Thanks....

推荐答案

如何快速地取决于多个方面:

How quickly depends on multiple things:


  1. 在CPU的硬件和中断控制器(如果有的话)
  2. 延迟
  3. CPU时钟速度(通常,事件(或响应他们)没有发生快于)

  4. 与该CPU可以访问所需的存储器(系统表(例如,中断向量表,但有可能是段表和页表等),堆栈(被中断的code指令指针将是速度通常保存在堆栈上,所以ISR可以返回到),在ISR code本身和它使用的所有数据)。显然,code,数据和TLB缓存要在这里作出贡献。

  5. 要完成其工作所需的ISR的时间,特别是如果中断服务程序不能preempt对方等并发的中断都被序列化。

  6. 中断优先级。通常情况下,不同的中断源分配不同的优先级。例如,你想要不可屏蔽中断,机器检查中断(基本上,中断报告严重的硬件问题)和定时器中断来比,也就是说,键盘中断优先级越高。在基于优先级的中断处理,所有的中断,其优先级高于中断当前正在服务时,将不得不等待。所以,如果你有很多高优先级的中断,低优先级中断可有明显的和不同的滞后服务。当高优先级中断滚滚而来不休极端情况下会。这可能是由于不当的设计或硬件故障。

  7. 与其它CPU的沟通和互动。在MP系统,中断处理程序有时可能需要自旋锁才能到多个CPU之间共享资源的独占访问。如果有竞争,则ISR将等待和所有其他中断(或低优先级的所有中断)将不会提供服务,直到当前ISR完成其工作。

这是一个普遍的答案,以一个一般性的问题。

That's a general answer to a general question.

修改:我忘了提一件事。存在着一些奇怪的CPU在某些指令是可重复的(想想86的代表MOVSB​​ ),并不能开始得到服务,直至重复的指令完全结束中断,这可能需要一些时间相当于执行约1000或更简单的单个指令。因此,尽管被允许中断,可能会有一些CPU怪癖不让中断服务程序开始运行。一个这样的CPU是TI的TMS320C54XX。有了它,你必须围绕FIR滤波器code小心。如果过滤器是长并且被实现为一个重复MAC指令,它将在中断服务引入一个等待时间。

EDIT: I've forgot to mention one more thing. There exist some odd CPUs in which certain instructions are repeatable (think of x86's rep movsb) and interrupts can't start getting serviced until the repeated instruction fully finishes, which may take time equivalent to executing some 1000 or even more simple individual instructions. So, despite interrupts being enabled, there may be some CPU quirks not letting the ISRs to start running. One of such CPUs is TI's TMS320C54xx. With it you have to careful around FIR filter code. If the filter is long and is implemented as a repeated MAC instruction, it will introduce a latency in interrupt servicing.

这篇关于如何能快速的处理器处理中断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆