Scheduling Threads

When the operating system creates a new process, it also creates at least one thread and assigns that thread a priority level. Processes running under Windows CE are not assigned a priority class, so preemption is based solely on the thread's priority. Threads with a higher priority are scheduled to run first. Threads with the same priority level run in a round-robin fashion, with each receiving a slice of execution time. Threads at a lower priority do not run until all threads with a higher priority have finished. All threads are created with a default priority of THREAD_PRIORITY_NORMAL.

    To change the priority level of a thread
Priority Description
THREAD_PRIORITY_TIME_CRITICAL Indicates 3 points above normal priority.
THREAD_PRIORITY_HIGHEST Indicates 2 points above normal priority.
THREAD_PRIORITY_ABOVE_NORMAL Indicates 1 point above normal priority.
THREAD_PRIORITY_NORMAL Indicates normal priority.
THREAD_PRIORITY_BELOW_NORMAL Indicates 1 point below normal priority.
THREAD_PRIORITY_LOWEST Indicates 2 points below normal priority.
THREAD_PRIORITY_ABOVE_IDLE Indicates 3 points below normal priority.
THREAD_PRIORITY_IDLE Indicates 4 points below normal priority.