home *** CD-ROM | disk | FTP | other *** search
- DOCUMENT:Q106253 08-DEC-1993 [W_NT]
- TITLE :Program priority and Multithreaded applications.
- PRODUCT :Windows NT
- PROD/VER:3.10
- OPER/SYS:WINDOWS
- KEYWORDS:
-
- --------------------------------------------------------------------
- The information in this article applies to:
- - Microsoft Windows NT operating system version 3.1
- - Microsoft Windows NT Advanced Server version 3.1
- --------------------------------------------------------------------
-
- SUMMARY
- =======
-
- When a program is started under Windows NT it will have a priority
- class that is either Normal or equal to the priority class specified
- in the command line when using the START command (Idle, Normal, High
- or Realtime). The priority class determines which priority (from 1 to
- 31) the program will run at. In a multithreaded application, threads
- spawned by the program can be lower or higher than the current
- priority class of the program; however all thread priorities will be
- relative to the priority class of the parent program. While a program
- can change itÆs priority class after starting, all of its threads will
- still have the same relative priority.
-
- MORE INFORMATION
- ================
-
- When a process spawns a thread, one of the parameters in the function
- call sets the thread priority relative to the priority of the parent
- process. This parameter can have one of the following values: Idle,
- Lowest, Below Normal, Normal, Above Normal, Highest and Time Critical.
- The starting priority set for the thread will be based upon that
- parameter and the current priority of the process starting the thread.
- The priorities are as follows:
-
- RELATIVE PROCESS PRIORITY CLASS
- THREAD Normal, in Normal, in
- PRIORITY Idle Background Foreground High Realtime
- -------------------------------------------------------------------
- Time Critical 15 15 15 15 31
- Highest 6 9 11 15 26
- Above Normal 5 8 10 14 25
- Normal 4 7 9 13 24
- Below Normal 3 6 8 12 23
- Lowest 2 5 7 11 22
- Idle 1 1 1 1 16
-
- The table above lists the base priority of a thread which is set by
- calling the function SetThreadPriority, however a threadÆs priority
- can change as the thread executes. The system can boost a threadÆs
- priority higher as time goes on and then reduce the priority back down
- to the base, however Windows NT will never reduce a thread lower than
- itÆs base priority. The system will boost a threadÆs priority when a
- user interacts directly with a thread, including mouse and keyboard
- input or simply bringing the thread to the foreground.
-
- For more information on process priorities, query on the following key
- words:
-
- priority and process
-
- Additional reference words: 1.00
- KBCategory:
- KBSubCategory: pertune
-
- =============================================================================
-
- 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.
-
- Copyright Microsoft Corporation 1993.