APC interrupt

Hi,
I have three basic questions here.

1.What is APC interrupt?
2.When is the APC nterrupt
issued?
3.What does the APC interrupt handler routine do?

Best regards,
Andy

An APC is a deferred procedure invocation very similar to a DPC, with
one major difference. An APC always will run in the context of a given
process. That allows an APC to use paged buffers and resources that are
local to the process, unlike in a DPC where you will need to probe and
lock buffers and use system address to avoid linear address space
translation to incorrect (or missing) memory pages. As inferred by this
statement, an APC can use paged memory, whereas a DPC will generate a
bug check on page faults.

The drawback to an APC is that it may never fire, if the process never
becomes active or is blocked within a non-alertable system call. So you
have to use an APC in explicit ways where you know that your process
will be alertable.

An APC is used to defer execution of some piece of code, for example the
completion of an asynchronous operation. In some cases, it can also
provide an asynchronous signal to a process. Again, you need to look at
when you need an APC to be sure it can be delivered.

I think your 3rd question is answered by the description of what it is.

FYI: there are also user mode APCs on Windows NT.

/TomH

-----Original Message-----
From: Andy Hao [mailto:xxxxx@yahoo.com]
Sent: Monday, April 21, 2003 9:30 PM
To: File Systems Developers
Subject: [ntfsd] APC interrupt

Hi,
I have three basic questions here.

1.What is APC interrupt?
2.When is the APC nterrupt
issued?
3.What does the APC interrupt handler routine do?

Best regards,
Andy


You are currently subscribed to ntfsd as: xxxxx@inflectionsystems.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

> The drawback to an APC is that it may never fire, if the process
never

becomes active or is blocked within a non-alertable system call. So
you

Kernel APCs are always delivered, regardless of the
alertable/non-alertable state.

Max

Thanks for the clarification. User mode APCs are not delivered when the
thread is not alertable. The following excerpt from the DDK talks about
when is an APC delivered.

Do Waiting Threads Receive Alerts and APCs?

The way a waiting thread responds to alerts and APC delivery depends on
a number of factors. In some cases, an alert will cause a wait to be
aborted, while in others it will not. Likewise, APCs are delivered to
waiting threads only under certain circumstances. The following table
summarizes the treatment of alerts and APCs by threads waiting on
dispatcher objects.

Four kernel support routines initiate a wait on a dispatcher object:
KeWaitForSingleObject
mk:.htm> , KeWaitForMultipleObjects
mk:.htm> , KeWaitForMutexObject
mk:.htm> , and KeDelayExecutionThread
mk:.htm> . All four of these routines take a pair of Boolean parameters
called Alertable and WaitMode. The effects of the values that can be
assigned to these two parameters are complex. Assigning a value of TRUE
to the Alertable parameter, for instance, does not guarantee that the
waiting thread can be alerted. The rest of this section provides a
summary of how the settings of the Alertable and WaitMode parameters
affect the behavior of the waiting thread.

Parameter Settings of KeWaitForXxx Routines

Special Kernel-Mode APC

Normal Kernel-Mode APC

User-Mode APC

Alerts

Wait Aborted?

APC Delivered and Executed?

Wait Aborted?

APC Delivered and Executed?

Wait Aborted?

APC Delivered and Executed?

Wait Aborted?

Alertable = TRUE

WaitMode = User

No

If (A) then Yes

No

If (B) then Yes

Yes

Yes, after thread returns to user mode

Yes

Alertable = TRUE

WaitMode = Kernel

No

If (A) then Yes

No

If (B) then Yes

No (since WaitMode = Kernel)

No

Yes

Alertable = FALSE

WaitMode = User

No

If (A) then Yes

No

If (B) then Yes

No (since Alertable = FALSE)

No (with exceptions, EX. ^C to terminate)

No

Alertable = FALSE

WaitMode = Kernel

No

If (A) then Yes

No

If (B) then Yes

No (since Alertable = FALSE and since WaitMode = Kernel)

No

No

A. IRQL < APC_LEVEL
B. IRQL < APC_LEVEL, thread not already in an APC, thread not in a
critical section

-----Original Message-----
From: Maxim S. Shatskih [mailto:xxxxx@storagecraft.com]
Sent: Tuesday, April 22, 2003 3:51 PM
To: File Systems Developers
Subject: [ntfsd] RE: APC interrupt

> The drawback to an APC is that it may never fire, if the process

never

> becomes active or is blocked within a non-alertable system call. So

you

Kernel APCs are always delivered, regardless of the

alertable/non-alertable state.

Max



You are currently subscribed to ntfsd as: xxxxx@inflectionsystems.com

To unsubscribe send a blank email to xxxxx@lists.osr.com</mk:></mk:></mk:></mk:>