Black Box IEEE 1284 Betriebsanweisung Seite 98

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 98
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 97
Page 98 of 98 The Black Box Toolkit
Copyright © 2004 The Black Box Toolkit Ltd. All rights reserved.
14. APPENDIX A
Realtime priority
Excerpt taken from the Microsoft Developer Network (MSDN)
“Threads are scheduled to run based on their scheduling priority. Each thread is assigned a scheduling priority. The
priority levels range from zero (lowest priority) to 31 (highest priority). Only the zero-page thread can have a priority
of zero. (The zero-page thread is a system thread responsible for zeroing any free pages when there are no other
threads that need to run.)
The system treats all threads with the same priority as equal. The system assigns time slices in a round-robin
fashion to all threads with the highest priority. If none of these threads are ready to run, the system assigns
time slices in a round-robin fashion to all threads with the next highest priority. If a higher-priority thread
becomes available to run, the system ceases to execute the lower-priority thread (without allowing it to finish
using its time slice), and assigns a full time slice to the higher-priority thread. For more information, see
Context Switches.
The priority of each thread is determined by the following criteria:
The priority class of its process
The priority level of the thread within the priority class of its process
The priority class and priority level are combined to form the base priority of a thread. For
information on the dynamic priority of a thread, see Priority Boosts.
Each process belongs to one of the following priority classes:
IDLE_PRIORITY_CLASS
BELOW_NORMAL_PRIORITY_CLASS
NORMAL_PRIORITY_CLASS
ABOVE_NORMAL_PRIORITY_CLASS
HIGH_PRIORITY_CLASS
REALTIME_PRIORITY_CLASS
By default, the priority class of a process is NORMAL_PRIORITY_CLASS. Use the CreateProcess function to
specify the priority class of a child process when you create it. If the calling process is
IDLE_PRIORITY_CLASS or BELOW_NORMAL_PRIORITY_CLASS, the new process will inherit this class.
Use the GetPriorityClass function to determine the current priority class of a process and the
SetPriorityClass function to change the priority class of a process.
Processes that monitor the system, such as screen savers or applications that periodically update a display,
should use IDLE_PRIORITY_CLASS. This prevents the threads of this process, which do not have high
priority, from interfering with higher priority threads.
Use HIGH_PRIORITY_CLASS with care. If a thread runs at the highest priority level for extended periods,
other threads in the system will not get processor time. If several threads are set at high priority at the same
time, the threads lose their effectiveness. The high-priority class should be reserved for threads that must
respond to time-critical events. If your application performs one task that requires the high-priority class
while the rest of its tasks are normal priority, use SetPriorityClass to raise the priority class of the application
temporarily; then reduce it after the time-critical task has been completed. Another strategy is to create a
high-priority process that has all of its threads blocked most of the time, awakening threads only when critical
tasks are needed. The important point is that a high-priority thread should execute for a brief time, and only
when it has time-critical work to perform.
You should almost never use REALTIME_PRIORITY_CLASS, because this interrupts system threads that
manage mouse input, keyboard input, and background disk flushing. This class can be appropriate for
applications that "talk" directly to hardware or that perform brief tasks that should have limited
interruptions.”
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/scheduling_priorities.asp
Seitenansicht 97
1 2 ... 93 94 95 96 97 98

Kommentare zu diesen Handbüchern

Keine Kommentare