[Autogenerated] The next object type, IDE like to discuss,
is not a dispatcher object.
However,
it will help me to discuss some other synchronization
primitives in a Better context.
I'm talking here about a synchronous procedure called or a PCs app cs
our data structures representing some callback.
That has to be called by a specific thread,
which means that an a PC, is targeted, to a thread.
If you compare that to a D PC,
which sounds very familiar something we've seen in an
earlier module ad PC also wraps a function,
to be called but that function needs to be called it.
R number two, no, more no less.
And the thread calling that function could be be Anyone.
Usually that's the one that was interrupted when the
original interrupt came in a P CS, are different the purpose of an a PC,
is to run, a function, in the context of a specific thread,
which is part of a specific process.
Now when you have a PCs these a PCs might call the threat,
to become ready if it was waiting previously.
And this is mostly relevant.
To kernel a P CS which I'll discuss very soon.
Once the a PC function is done.
Then the threat might go back.
To waiting if it was there, in the first place in user mode there,
are two ways,
to use a P CS which I'll describe in the Next slide
in kernel mode the kernel a P I, to use a PCs is exported,
but it is not documented.
Let's look at the types of a P CS, that we have there,
are basically three types of a P CS,
the first one is user mode a PCs and user mode a PCs
run code in user mode obviously,
and They have two basic scenarios supported by the Windows API
the first one is by using the functions,
read file X or right.
File E X which are used, to start asynchronous,
io operations where you can specify as the last parameter.
Call back, to be called once the operation completes sounds good.
However, that callback,
is not really called immediately its being wrapped in an a PC,
and that a PCs attached, to the thread,
that originally called the read file X or right,
file X function,
and Since you can't just run these function in some arbitrary point in time.
In order for a PCs to run for usable app CSS to run
the thread has to go into an alert, bit weight or alert,
able state,
and This can be done by using the extended versions of the weight
functions such as weight for single object E X,
and weight for multiple object E X.
When specifying two the last parameter.
If any app cs have been accumulating,
they will now all run and the weight will be over
with a special value called weight.
Io completion.
The second scenario,
that is used with a PCs by the Windows API is a more generic function called Q,
user a PC which allows us to querying that in the Next demo,
then We have normal kernel a PCs normal kernel a PCs run at ARQ zero just
like normal code but they run in kernel mode and They're more powerful than
user mode a PCs and user mode code in general.
The way to Think about it.
Is that When a thread gets some C P U time if normal kernel a PCs exist,
they will run first only then the normal user mode code will run and user
mode app CSS will only run if the thread enters an alert.
Bit weight.
Finally,
we have special kernel a PCs special kernel app CSS are the most powerful AP,
CSS They're running kernel mode only at R Q L.
A PCs R Q L one you might recall,
we mentioned IP C level when we looked at our Q L levels.
Back.
In the inter wrap module So what happens?
Is the following when the threat gets any C P U time,
if it has any special channel a PCs attached,
they will be running first If there are any normal
NICs see channel a PCs attached.
They will be running next.
And then the normal user mode code of the thread will run
unless the thread at some point enters an alert,
bit state where these a PCs will run as well.
So kernel app CSS do not require alert, bit weight, but using what?
A PCs do the most common.
Example, or the most common use case for special channel a P CS,
is to run some code that the our manager has to run once.
An our operation completes and that code has to run,
in the context of the original thread, and the original process,
and So we won't discuss that in this course,
but I'll discuss io completion in a future course,
in the this series So let's see an example of using a user word a PC.
For some interesting scenario.