Sunday, March 8, 2009

Windows 7 to scale to more Cores

So Microsoft has dodged the core scheduling issue inherent with SetThreadAffinityMask.

They did this for Win64, where SetThreadAffinityMask allows explicit scheduling of 64 threads ( as compared to 32 for Win32 ) with a clever hack to enable "thread groups". Each "thread group" is limited to 64 threads, but now there are 4 thread groups. Adding this "layer" gets round that limitation.

See Mark Russinovich on Channel 9
http://channel9.msdn.com/shows/Going+Deep/Mark-Russinovich-Inside-Windows-7/

One way to access this functionality is via the CCR runtime
http://blogs.msdn.com/nativeconcurrency/archive/2009/02/04/concurrency-runtime-and-windows-7.aspx

Good news is that the low-level access will still be available, see
http://www.microsoft.com/whdc/system/Sysinternals/MoreThan64proc.mspx
at least for now.

Its pretty clear MS is trying to steer developers away from the low-level, however.

I'll have to play with threads and the default scheduler to see if that is realistic, and if the Windows 7 scheduler is better than previous schedulers. As I found when in Aces Studio, to get predictable performance games have to take the step of explicitly scheduling their own threads, at least prior to Windows 7.

Overall, this is good news for programmers trying to exploit parallelism, and IHVs who have hardware plans to provide silicon with more cores than that.

Oh, and no joy for Win32. The rub for Win32 is you can only schedule 32 threads explicitly so soon Win32 will not be able to cope with the number of cores available from an explicit scheduling standpoint. If thats not clear, there should be 4-way ( 4 socket ) mobo's soon if not already ( Apple is already shipping a box with dual 8-cores for 16 cores total ), and that means early in the lifetime of Windows 7 the hardware will be bumping up against this limit for Win32.

I hear that as the bell is tolling for Win32. Which is a good thing, since based on the overall pace of technology change over the last 28 years, Windows 7 should have been 64-bit only.

1 comments:

said...

Good post! Agree that Win7 really should have been 64-bit only and have (together with many other game developers) lobbied for it.

But unfortunately it didn't happen. One of the main reasons I think was the availability of many not too old Intel Pentium M CPUs that are 32-bit only.