The default thread quantum, the amount of time that the schedule allows a thread to run before scheduling a different thread to run, has been set to 100 milliseconds since Windows CE 3.0. Prior to Windows CE 3.0 the quantum was shorter (if memory serves me right it was 25 ms.) The change to 100 ms was made to improve real time performance. The longer quantum allows most real time threads to run as long as they need to service hardware, but stops them if they get greedy to allow other threads to run. The down side of the 100 ms quantum is that threads that need to run for a long time block other threads, so in some systems a shorter or longer thread quantum can improve performance of the system.
Maybe you have heard or read that the default thread quantum is 100 ms, but with a disclaimer that the OEM can change it. Let’s take a quick look at how to mdoify the default thread priority.
In all versions of Windows CE, the default thread quantum is set within the kernel and can be modified by the the OEM in the OAL or HAL. The traditional place for the OEM to modify the default thread quantum is in OEMInit().  It could theoretically be set other places like from OEMIoControl(), but that would mean that threads started prior to changing the default would have a different thread quantum.
Windows CE 3.0 through 5.0
The Windows CE 3.0 through 5.0 kernel is built as a monolithic exe and the default thread quantum is set with single global variable.  The default thread quantum is set in dwDefaultThreadQuantum which  can be modified by the OEM.  To do so you must define dwDefaultThreadQuantum as extern and then set its value:
extern DWORD dwDefaultThreadQuantum;
 
 
void OEMInit()
{
                dwDefaultThreadQuantum = 50;
}
Windows CE 6.0
The Windows CE 6.0 kernel is built as dll and the OAL is built as an exe. The default thread quantum is set with a member of a global structure.  The global structure is g_pOemGlobal and the member is dwDefaultThreadQuantum. The g_pOemGlobal structure is defined in oemglobal.h, which is included by oal.h so mdofiying the default thread quantum is done by:
void OEMInit()
{
                g_pOemGlobal->dwDefaultThreadQuantum = 50;
}
 
 
Copyright © 2009 – Bruce Eitman
All Rights Reserved