Microsoft KB Archive/323461

= The First Time a Thread Is Scheduled After Its Creation Does Not Run at the Expected Time =

Article ID: 323461

Article Last Modified on 6/30/2005

-

APPLIES TO


 * Microsoft Windows CE Platform Builder 4.0
 * Microsoft Windows CE .NET 4.0

-



This article was previously published under Q323461



SYMPTOMS
The first time a thread is scheduled after its creation, it may not run at the expected time. Any interrupt may cause a reschedule away from the thread to a thread of equal priority, even if the thread quantum has not expired.



CAUSE
The counter for thread quantum-time remaining is left set at 0 when a new thread is created.



RESOLUTION
A supported fix is now available from Microsoft as Windows CE Core OS QFE. To resolve this problem immediately, search for the keyword &quot;QFE&quot; on the following Microsoft Web site:

http://www.microsoft.com/downloads/

The English version of this package should have the following file attributes or later:   Size         File name ---  2,198,112    020607_armv4i_wce40-q323461.exe 2,181,728   020607_armv4t_wce40-q323461.exe 2,194,016   020607_armv4_wce40-q323461.exe 2,189,920   020607_mips16_wce40-q323461.exe 2,374,240   020607_mipsii_fp_wce40-q323461.exe 4,299,360   020607_mipsii_wce40-q323461.exe 2,480,736   020607_mipsiv_fp_wce40-q323461.exe 2,357,856   020607_mipsiv_wce40-q323461.exe 2,030,176   020607_sh3_wce40-q323461.exe 2,054,752   020607_sh4_wce40-q323461.exe 1,911,392   020607_x86_wce40-q323461.exe The English version of this fix has the file attributes (or later) that are listed in the following table.   Date       Time   Size       File name              Platform --  22-May-02  13:33  1,742,526  Nkmain.lib             armv4\debug 22-May-02 13:33    110,592  Nkmain.pdb             armv4\debug 22-May-02 13:33  1,853,274  Nkprmain.lib           armv4\debug 22-May-02 13:33    110,592  Nkprmain.pdb           armv4\debug 22-May-02 13:33  1,115,300  Nkmain.lib             armv4\retail 22-May-02 13:33    110,592  Nkmain.pdb             armv4\retail 22-May-02 13:33  1,207,304  Nkprmain.lib           armv4\retail 22-May-02 13:33    110,592  Nkprmain.pdb           armv4\retail 22-May-02 13:36  1,746,450  Nkmain.lib             armv4i\debug 22-May-02 13:36    110,592  Nkmain.pdb             armv4i\debug 22-May-02 13:36  1,857,448  Nkprmain.lib           armv4i\debug 22-May-02 13:36    110,592  Nkprmain.pdb           armv4i\debug 22-May-02 13:35  1,119,296  Nkmain.lib             armv4i\retail 22-May-02 13:35    110,592  Nkmain.pdb             armv4i\retail 22-May-02 13:36  1,211,578  Nkprmain.lib           armv4i\retail 22-May-02 13:36    110,592  Nkprmain.pdb           armv4i\retail 22-May-02 13:35  1,615,586  Nkmain.lib             armv4t\debug 22-May-02 13:35    110,592  Nkmain.pdb             armv4t\debug 22-May-02 13:35  1,719,422  Nkprmain.lib           armv4t\debug 22-May-02 13:35    110,592  Nkprmain.pdb           armv4t\debug 22-May-02 13:34  1,102,464  Nkmain.lib             armv4t\retail 22-May-02 13:34    110,592  Nkmain.pdb             armv4t\retail 22-May-02 13:34  1,193,190  Nkprmain.lib           armv4t\retail 22-May-02 13:34    110,592  Nkprmain.pdb           armv4t\retail 22-May-02 13:41  1,788,362  Nkmain.lib             mips16\debug 22-May-02 13:41    110,592  Nkmain.pdb             mips16\debug 22-May-02 13:41  1,909,850  Nkprmain.lib           mips16\debug 22-May-02 13:41    110,592  Nkprmain.pdb           mips16\debug 22-May-02 13:40    997,184  Nkmain.lib             mips16\retail 22-May-02 13:40    110,592  Nkmain.pdb             mips16\retail 22-May-02 13:41  1,093,568  Nkprmain.lib           mips16\retail 22-May-02 13:40    110,592  Nkprmain.pdb           mips16\retail 22-May-02 13:38  1,784,508  Nkmipsiibmain.lib      mipsii\debug 22-May-02 13:38    110,592  Nkmipsiibmain.pdb      mipsii\debug 22-May-02 13:38  1,786,188  Nkmipsiimain.lib       mipsii\debug 22-May-02 13:38    110,592  Nkmipsiimain.pdb       mipsii\debug 22-May-02 13:38  1,906,184  Nkprofmipsiibmain.lib  mipsii\debug 22-May-02 13:38    110,592  Nkprofmipsiibmain.pdb  mipsii\debug 22-May-02 13:38  1,907,864  Nkprofmipsiimain.lib   mipsii\debug 22-May-02 13:38    110,592  Nkprofmipsiimain.pdb   mipsii\debug 22-May-02 13:37  1,134,784  Nkmipsiibmain.lib      mipsii\retail 22-May-02 13:37    110,592  Nkmipsiibmain.pdb      mipsii\retail 22-May-02 13:37  1,136,634  Nkmipsiimain.lib       mipsii\retail 22-May-02 13:37    110,592  Nkmipsiimain.pdb       mipsii\retail 22-May-02 13:37  1,237,510  Nkprofmipsiibmain.lib  mipsii\retail 22-May-02 13:37    110,592  Nkprofmipsiibmain.pdb  mipsii\retail 22-May-02 13:37  1,239,362  Nkprofmipsiimain.lib   mipsii\retail 22-May-02 13:37    110,592  Nkprofmipsiimain.pdb   mipsii\retail 22-May-02 13:42  1,854,328  Nkmain.lib             mipsII_fp\debug 22-May-02 13:42    110,592  Nkmain.pdb             mipsII_fp\debug 22-May-02 13:43  1,976,020  Nkprmain.lib           mipsII_fp\debug 22-May-02 13:43    118,784  Nkprmain.pdb           mipsII_fp\debug 22-May-02 13:42  1,196,236  Nkmain.lib             mipsII_fp\retail 22-May-02 13:42    110,592  Nkmain.pdb             mipsII_fp\retail 22-May-02 13:42  1,299,070  Nkprmain.lib           mipsII_fp\retail 22-May-02 13:42    118,784  Nkprmain.pdb           mipsII_fp\retail 22-May-02 13:40  1,843,438  Nkmain.lib             mipsiv\debug 22-May-02 13:40    110,592  Nkmain.pdb             mipsiv\debug 22-May-02 13:40  1,967,962  Nkprmain.lib           mipsiv\debug 22-May-02 13:40    110,592  Nkprmain.pdb           mipsiv\debug 22-May-02 13:39  1,192,472  Nkmain.lib             mipsiv\retail 22-May-02 13:39    110,592  Nkmain.pdb             mipsiv\retail 22-May-02 13:39  1,298,594  Nkprmain.lib           mipsiv\retail 22-May-02 13:39    110,592  Nkprmain.pdb           mipsiv\retail 22-May-02 13:44  1,919,304  Nkmain.lib             mipsiv_fp\debug 22-May-02 13:44    110,592  Nkmain.pdb             mipsiv_fp\debug 22-May-02 13:44  2,043,850  Nkprmain.lib           mipsiv_fp\debug 22-May-02 13:44    118,784  Nkprmain.pdb           mipsiv_fp\debug 22-May-02 13:43  1,260,668  Nkmain.lib             mipsiv_fp\retail 22-May-02 13:43    110,592  Nkmain.pdb             mipsiv_fp\retail 22-May-02 13:43  1,366,844  Nkprmain.lib           mipsiv_fp\retail 22-May-02 13:43    118,784  Nkprmain.pdb           mipsiv_fp\retail 22-May-02 13:31  1,449,756  Nkmain.lib             sh3\debug 22-May-02 13:31    110,592  Nkmain.pdb             sh3\debug 22-May-02 13:31  1,547,904  Nkprmain.lib           sh3\debug 22-May-02 13:31    110,592  Nkprmain.pdb           sh3\debug 22-May-02 13:30    973,798  Nkmain.lib             sh3\retail 22-May-02 13:30    102,400  Nkmain.pdb             sh3\retail 22-May-02 13:30  1,064,472  Nkprmain.lib           sh3\retail 22-May-02 13:30    110,592  Nkprmain.pdb           sh3\retail 22-May-02 13:32  1,468,026  Nkmain.lib             sh4\debug 22-May-02 13:32    102,400  Nkmain.pdb             sh4\debug 22-May-02 13:32  1,566,184  Nkprmain.lib           sh4\debug 22-May-02 13:32    110,592  Nkprmain.pdb           sh4\debug 22-May-02 13:31    991,102  Nkmain.lib             sh4\retail 22-May-02 13:31    102,400  Nkmain.pdb             sh4\retail 22-May-02 13:32  1,081,838  Nkprmain.lib           sh4\retail 22-May-02 13:32    110,592  Nkprmain.pdb           sh4\retail 22-May-02 13:29  1,477,360  Nkmain.lib             x86\debug 22-May-02 13:29    110,592  Nkmain.pdb             x86\debug 22-May-02 13:29  1,575,244  Nkprmain.lib           x86\debug 22-May-02 13:29    110,592  Nkprmain.pdb           x86\debug 22-May-02 13:29    953,550  Nkmain.lib             x86\retail 22-May-02 13:29    110,592  Nkmain.pdb             x86\retail 22-May-02 13:29  1,037,082  Nkprmain.lib           x86\retail 22-May-02 13:29    110,592  Nkprmain.pdb           x86\retail



MORE INFORMATION
For each thread, the Windows CE operating system maintains a counter for thread quantum remaining. When the counter reaches 0, the quantum time is expired, and other threads of equal priority may be scheduled. When a new thread is created, the counter is incorrectly left set to 0, which means that the thread is immediately subject to reschedule. After the reschedule is complete, the counter is reset to the default quantum, and future thread scheduling proceeds.

This QFE changes the kernel's thread-creation code to set the value of the thread quantum remaining equal to the default thread quantum, so that when the thread is scheduled for the very first time, it can use a full thread quantum.



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

Keywords: kbbug kbfix kbqfe kbenv KB323461

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.