阅读:2131回复:7
Apc中断级上线程能否被抢先
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上可否抢先????我对第三点的理解是对的吗? |
|
|
沙发#
发布于:2003-03-06 08:21
没有人知道吗?昨天请教了一个高手,他说在apc上也可以抢先,他认为第一句话是不对的,各位大侠也提提自己的看法啊
|
|
|
板凳#
发布于:2003-03-06 16:22
1、at the same IRQL
2、No thread switching, not “preemption” |
|
地板#
发布于:2003-03-07 14:31
不可以抢先吧,抢先是发生在PASSIVE_LEVEL上的。
|
|
|
地下室#
发布于:2003-03-07 14:51
语气很不确定哦
在programming windows driver model这本书上,提到apc的时候模模糊糊,可能是由于apc比较少用到,搞到我也不能确定 那位大侠能十分确定的告诉我答案 |
|
|
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. |
|
驱动牛犊
![]() |
6楼#
发布于:2009-11-14 17:31
不能
|
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,可以置评下,嘿嘿。 |
|
|