Preemption and yielding with a VxD

0 Likes

Problem:

Can I assume that my VxD will run without preemption? If not, under what circumstances might my VxD be preempted?

Resolution:

A VxD will generally run without being pre-empted. Another process may be scheduled when one of the following events occurs:

[1] The VxD returns to ring 3. This may occur implicitly through a return from an event handler, or explicitly in a nested execution block.

[2] The VxD blocks on a semaphore or other synchronization object.

[3] The VxD access data which is not present in memory (typically, pageable data.)

[4] The VxD executes code which is not present in memory (typically, pageable code.)

If a VxD needs to busy-wait, but wants to allow other processing to continue, the following code sequence will allow the scheduler to run other waiting tasks:

Enable_VM_Ints(); // Optional, allows hardware interrupts (like STI)

Begin_Next_Exec(); // Create nested execution context

Resume_Exec(); // Ring-3 transfer allows scheduler to run

End_Nest_Exec(); // Terminate nested block

Old KB# 11992
Comment List
Anonymous
Related Discussions
Recommended