Using the Interrupt 2Fh Critical Section Services

Last reviewed: March 15, 1995
Article ID: Q78151
The information in this article applies to:
  • Microsoft Windows Device Driver Kit (DDK) for Windows versions 3.0 and 3.1

SUMMARY

In the enhanced mode of the Microsoft Windows graphical environment, MS-DOS (non-Windows) applications are scheduled for execution using a preemptive multitasking scheme; that is, the amount of time that a process is allowed to run is determined by the operating system and not by the process. Therefore, there is no way for a process, running in a virtual machine (VM), to claim the CPU for an arbitrary amount of time. In particular, the Begin Critical Section (Interrupt 2Fh Function 1681h) and End Critical Section (Interrupt 2Fh Function 1682h) services do not prevent a task switch from occurring. These services cannot be used in a terminate-and-stay-resident program (TSR) to run code consecutively.

MORE INFORMATION

The services mentioned above, Begin Critical Section and End Critical Section, call directly into the virtual machine manager's (VMM's) services Begin_Critical_Section and End_Critical_Section. As the documentation for these services points out, these VMM services impact task switching only in a limited way. The function of the global critical section is to shield a non-reentrant portion of code, such as the BIOS-resident MS-DOS services, from being entered more than once.

Whenever an application claims the global critical section, the VMM schedules for execution VMs that have a priority lower than Time_Critical_Boost. VMs into which a hardware interrupt is reflected have at least this priority; however, any virtual device driver (VxD) may assign a low execution priority to a VM. Therefore, depending on the particular system configuration, the critical section may or may not provide exclusive execution of the code.

To influence task switching behavior, code must reside in a VxD. However, there are very few scenarios in which code must be run exclusively. In most cases, the Switch VMs and Callback service (Interrupt 2Fh Function 1685h) is sufficient to leave a TSR in a consistent state. The user can disable task switching entirely by modifying setting the AllVMsExclusive option to TRUE in the SYSTEM.INI file.


Additional reference words: 3.00 3.10 DDKTSR DDKVXD
KBCategory: kbprg
KBSubcategory: D2MiscInt2fin


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: March 15, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.