[Autogenerated] As we talked about in the Previous video,
every internet app service routine.
Once its done it wants to call the io complete,
requests function, which is the one that completes an IP an our requests packet,
and returns the appropriate result.
To whatever client initiated the original requests Here's the io cou,
requests function.
It's actually named slightly differently,
but it doesn't really matter if I go all the way down here there.
Are some requirements here, and for every kernel a P I in general,
you always have the requirement based on the R Q L which is the one,
that you, are allowed,
to use to in order to call these function in a safe
manner as you can see here it, says the io real must be less than or equal.
To dispatch, level level number two,
and You might recall from the discussion I Q L S,
that for device R Q L S, the minimum R Q L.
In fact, is three exactly.
Contradictory, to what we see here.
So in fact calling our core requests from these um,
internet up service routine or from whatever internet up service routine calls
us a blue screen with a code called iot L not less or equal.
So we can't even let jam here we can't call io copy,
two requests even though we really want to So first,
you might be wondering why can't we call our core requests Why?
Is the kernel forcefully preventing us from do that safely there.
Are a couple of reasons.
One of them, is the fact, that If we were allowed.
To call our core requests within the inter up service routine.
It would make the inter apps service routine much longer,
which means the arc core of the processor will remain in a fairly
high level for longer which is of course not ideal.
The core requests function, is a fairly complex.
One has quite a bit of work.
To do and So it wouldn't be very nice.
To have the ability,
to call this function within the inter up service routine itself.
On the other hand, we do need to call it and So the solution.
To This problem.
Is called deferred procedure.
Call or DPC, ad PCs a data structure,
that represents calling a function at arc L level two no more no less level two.
Is considered a good compromise because on the one hand,
it's not powerful enough.
To stop other interrupts coming in.
On the other hand, the scheduler is still asleep.
And cannot wake up on this processor.
So there's no context switching.
That can happen.
So using this level of two seems like a good compromise.
To use.
This means that the final operation of a typical inter up
service routine would be to take a DPC object,
fi It in with a pointer, to a function, to run,
and You can also provide up to three other parameters.
That would be passed.
To that function, and then throw, that DPC into a is managed by a processor,
and then the processor.
Once the real becomes no bigger than two will in fact start processing these D,
PCs until they error all completely done.
And then only then the R,
Tcl can drop back the regional level which is typically going to be zero.
So the last call that should be made.
Is the K insert Q DPC, a P I.
That's the official API I that current drivers can use in order to re put,
a DPC into the queue with the appropriate function.
And let the processor call it as soon as possible.
Once the R.
Co starts to drop after the intra up services routine will complete.
You might also think that Perhaps there's a different solution.
To the problem.
Perhaps all we need to do is determine the I R Q L.
And There's a simple function, to do that In fact, there's these two functions.
You can use to increase, and decrease, our coded twill.
When you are in kernel mode They're called K E,
raise R Q, and K E lower I R Q L.
So what about just simply from the up up service routine lowering,
our Q L, two level, two call our complete,
requests and then raising it back, to whatever level it,
was Initially, maybe no one will notice.
Unfortunately, these kind of sequence operations might cause a deadlock,
to happen,
and The reason for that will be explained later on in
this call When we discuss spin locks, and how these things,
are being synchronized internally.
But for now, this is not an option.
And the DPC, is the right thing, to do