Rob Earhart's WebLog

Threadpool

So I've checked in the new Longhorn threadpool.  (Unmanaged).

If you use the threadpool, I think you'll enjoy it; there are a number of API features which should make it very easy to write correct code which uses it, particularly in the area of cleanup and dll unload synchronization, which the old QueueUserWorkItem() interface was sorely lacking in.  Performance and scalability should be a little better, too.

So now it's back to fixing bugs, at least for a little while; there are a lot of edge cases in ntdll.dll and kernel32.dll which never really were thought through properly.  I spent a bit of time this past fall plowing through these; this is a good time to do some more before the next big project.

I wish I had time before the kernel team stops Longhorn work to do some serious work in the PE loader code; there are a number of performance problems with having one big loader lock per process, so making that a bit more granular would be great.  It'd also be nice to untangle it a bit; currently there're callouts to various components sprinkled throughout the code.  Maybe once Longhorn ships...

Published Wednesday, January 19, 2005 11:36 AM by earhart
Filed under:

Comments

 

Pavel Lebedinsky said:

Are the docs for the new threadpool publicly available?

Good luck fixing the loader lock mess. The current design is (in my opinion) just asking for problems:

1. Create a set of rules that forbid doing most non-trivial things in code that runs inside the loader lock.

2. Expose a very easy way for people to write such code without even realizing it (static C++ constructors/destructors).

3. Provide no mechanism to enforce the rules.

4. Make sure that even when the rules are violated, things still seem to work correctly 99% of the time.

5. Watch people fall into the same trap over and over again.

Really, how are people supposed to find out that (for example) declaring a global CComBSTR object is a big no-no, when it works just fine in the vast majority of cases?
January 24, 2005 4:12 AM
 

Ramanujam said:

wow that's great..........to hear...
even we are working on kernel 32....in our IBM labs
February 15, 2005 6:11 AM
Anonymous comments are disabled

© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker