rookie_cn
驱动牛犊
驱动牛犊
  • 注册日期2002-11-28
  • 最后登录2004-02-08
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:2009回复:7

Apc中断级上线程能否被抢先

楼主#
更多 发布于:2003-03-05 11:01
In <<programming windows driver mode>>,我看到3句话:
1.Once above PASSIVE_LEVEL, the operating system won\'t allow preemption by another activity at the same IRQL
2.No thread switching occurs at or above DISPATCH_LEVEL
3.关于KeWaitforSingleObject irql限制方面的:
Callers of KeWaitForSingleObject must be running at IRQL <= DISPATCH_LEVEL. Usually, the caller must be running at IRQL = PASSIVE_LEVEL and in a nonarbitrary thread context. A call while running at IRQL = DISPATCH_LEVEL is valid if and only if the caller specifies a Timeout of zero. That is, a driver must not wait for a nonzero interval at IRQL = DISPATCH_LEVEL.
我对KeWaitforsingleObject工作在dispatch level时必须设置timeout=0的理解是在dispatch level上不能线程抢先,所以不能block thread,但根据上面提到的第一句话来理解,在apc上也不能抢先,那它应该说在>=apc时必须指定timeout=0才对啊,他为什么不说呢????

究竟apc上可否抢先????我对第三点的理解是对的吗?
rookie_cn:相信我,我会让你成为世界上第2幸福的人 girl:那谁是第一幸福的人 rookie_cn:拥有了你,还有谁比我幸福
rookie_cn
驱动牛犊
驱动牛犊
  • 注册日期2002-11-28
  • 最后登录2004-02-08
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2003-03-06 08:21
没有人知道吗?昨天请教了一个高手,他说在apc上也可以抢先,他认为第一句话是不对的,各位大侠也提提自己的看法啊
rookie_cn:相信我,我会让你成为世界上第2幸福的人 girl:那谁是第一幸福的人 rookie_cn:拥有了你,还有谁比我幸福
arthurtu
驱动巨牛
驱动巨牛
  • 注册日期2001-11-08
  • 最后登录2020-12-19
  • 粉丝0
  • 关注0
  • 积分26分
  • 威望161点
  • 贡献值0点
  • 好评度35点
  • 原创分0分
  • 专家分0分
  • 社区居民
板凳#
发布于:2003-03-06 16:22
1、at the same IRQL
2、No thread switching, not “preemption”
ice_fire333
驱动老牛
驱动老牛
  • 注册日期2002-10-08
  • 最后登录2007-08-13
  • 粉丝0
  • 关注0
  • 积分31分
  • 威望4点
  • 贡献值0点
  • 好评度1点
  • 原创分0分
  • 专家分0分
地板#
发布于:2003-03-07 14:31
不可以抢先吧,抢先是发生在PASSIVE_LEVEL上的。
赵客缦胡缨,吴钩霜雪明。银鞍照白马,飒沓如流星。   十步杀一人,千里不留行。事了拂衣去,深藏身与名。   闲过信陵饮,脱剑膝前横。将炙啖朱亥,持觞劝侯嬴。   三杯吐然诺,五岳倒为轻。眼花耳热后,意气素霓生。   救赵挥金槌,邯郸先震惊。千秋二壮士,煊赫大梁城。   纵死侠骨香,不惭世上英。谁能书阁下。白首太玄经。
rookie_cn
驱动牛犊
驱动牛犊
  • 注册日期2002-11-28
  • 最后登录2004-02-08
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
地下室#
发布于:2003-03-07 14:51
语气很不确定哦
在programming windows driver model这本书上,提到apc的时候模模糊糊,可能是由于apc比较少用到,搞到我也不能确定
那位大侠能十分确定的告诉我答案
rookie_cn:相信我,我会让你成为世界上第2幸福的人 girl:那谁是第一幸福的人 rookie_cn:拥有了你,还有谁比我幸福
arthurtu
驱动巨牛
驱动巨牛
  • 注册日期2001-11-08
  • 最后登录2020-12-19
  • 粉丝0
  • 关注0
  • 积分26分
  • 威望161点
  • 贡献值0点
  • 好评度35点
  • 原创分0分
  • 专家分0分
  • 社区居民
5楼#
发布于:2003-03-07 15:30
Once a CPU is executing at an IRQL above PASSIVE_LEVEL, an activity on that CPU can be preempted only by an activity that executes at a higher IRQL.


so,当然可以。看书不仔细呀。

Thread priority is a very different concept than IRQL. Thread priority controls the actions of the scheduler in deciding when to preempt running threads and what thread to start running next. No thread switching occurs at or above DISPATCH_LEVEL, however. Whatever thread is active at the time IRQL rises to DISPATCH_LEVEL remains active at least until IRQL drops below DISPATCH_LEVEL. The only \"priority\" that means anything at elevated IRQL is IRQL itself, and it controls which programs can execute rather than the thread context within which they execute.

lee922@gmail.co
驱动牛犊
驱动牛犊
  • 注册日期2007-07-31
  • 最后登录2010-06-22
  • 粉丝0
  • 关注0
  • 积分39分
  • 威望340点
  • 贡献值0点
  • 好评度35点
  • 原创分0分
  • 专家分1分
6楼#
发布于:2009-11-14 17:31
不能
Leonsoft
驱动小牛
驱动小牛
  • 注册日期2003-05-08
  • 最后登录2012-08-11
  • 粉丝1
  • 关注0
  • 积分21分
  • 威望281点
  • 贡献值1点
  • 好评度103点
  • 原创分0分
  • 专家分0分
7楼#
发布于:2009-11-16 17:49
首先,Windows NT下一个thread有2个APC queue,一个是user mode,另一个是kernel mode。如果是user mode下的APC,代码运行在Passive_level IRQL上的,这个时候thread当然是可以被preempt的,如果是Kernel Mode下的APC,哈哈,注意了,Kernel Mode下的APC还分Normal和Sepcial, Normal运行在passive_level上,但是会preempt user mode下的代码,Special运行在APC_LEVEL上,会preempt user mode的代码和运行在kernel mode passive_level上的代码。

Wooocock,可以置评下,嘿嘿。
I will do the best with what the God gave me.
游客

返回顶部