在SMP系统上并行运行同一中断的多个实例 [英] running multiple instances of a same interrupt parallely on an SMP system

查看:96
本文介绍了在SMP系统上并行运行同一中断的多个实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在Linux的多处理器系统上同时运行同一中断的多个实例? 如果不可能,为什么我们需要使用自旋锁在中断处理程序之间进行同步?

Is it possible to run multiple instances of a same interrupt simultaneously on a multi processor system in linux? If not possible, why do we need to synchronize between interrupt handlers using spin locks?

谢谢 文卡特什

推荐答案

Is it possible to run multiple instances of a same interrupt simultaneously on a multi processor system in linux?

通常将中断处理程序序列化.意思是,处理程序只有一个实例可以运行(在两个处理器中的任何一个上).在运行时,如果再次产生相同类型的中断,则仅在当前中断完成后才进行处理,从而将其串行化.当一个内核正在执行此"处理程序时,其他内核可能会为其他实例的处理程序提供服务.

The interrupt handlers are generally serialized. Meaning, that only one instance of the handler would be running(on either of the processors). While this is running, if same type of interrupt is again generated, it is processed only after the current one is done, thus serialized. While "this" handler is being executed by one of the core, other core might service handler of a different instance.

Why do we need to synchronize between interrupt handlers using spin locks?

即使在必须保护数据免受某些其他线程(例如,减半,用户读/写处理程序函数等)的保护的情况下,也使用自旋锁. 这种情况可能是这样的:

The spinlocks are used even in such cases as the data has to be protected against some other threads(for example bottom halved, user read/write handler functions, etc). The scenario could be something like this :

my_ISR()
{
    lock(&l);
    // data is accessed here
    unlock(&l);    
}

my_other_thread()
{
    lock(&l);
    // same data is accessed here
    unlock(&l);
}

这篇关于在SMP系统上并行运行同一中断的多个实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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