The first dual-core desktop processors appeared on the market in early 2005, with the release of the Intel Pentium D and AMD Athlon 64 X2. Dual core processors were really just the logical result of CPU process technology allowing Intel and AMD to make CPUs so small they could stick two into one package. For years, it was possible to get a dual processor computer, but that merely meant two physical processors were under the hood, and hence drew twice the power.
Windows XP, the prevailing operating system on the market when dual-core processors were first released, had basic multicore support. Windows XP and Windows Server 2003 were capable of seeing two logical processors per core as Core0 and Core1 and it was possible to do something called Process Affinity, where the end user told an application to run on one specific core. The vast majority of times, applications defaulted to the first core, but in some cases, especially games, one application would try to run on two cores and it would not run very well at all.
Microsoft addressed the dual-core issue with Windows Vista, adding a number of features in the deep plumbing of the operating system to prevent conflicts, lock-ups, or other problems. Multi-core was still emerging as a technology and the development cycle for Windows Vista was, shall we say, chaotic, but some important features were added.
There is, of course, only so much that Microsoft can do in terms of multi-core support. The true benefits of multi-core can only be realized at the application layer, which Microsoft is supporting by heavily modifying its Visual Studio IDE and various SDKs to support multi-threading wherever possible.
Intel has also provided its own tools to examine code and to look for areas where an application can be multithreaded, and both Intel and AMD provide their own developer support along with Microsoft. But in the end, all the work by Intel and AMD on the CPU and Microsoft on the OS will not make Adobe Photoshop multi-threaded. That’s Adobe’s job.
The task of developing multi-threaded applications will get easier when Microsoft ships Visual Studio 2010, as the upcoming release of the software development environment will offer many improvements in parallel programming support. Among them are a Task Parallel Library to run repetitive tasks in parallel when possible, Parallel Language Integrated Query (PLINQ) for parallel data operations, Microsoft Concurrency Runtime for building scheduling and resource management into the application, Asynchronous Agents Library, and the Parallel Pattern Library for C++ users.
Starting With Vista
Still, there are things Microsoft can do. Starting with Windows XP and then expanding in Vista, Microsoft introduced support for nonuniform memory architecture (NUMA) systems (AMD Opteron and Intel Nehalem families), pervasive prefetching, an improved DLL loader that creates new processes faster than Windows XP, and an improved thread pool. Vista could support multiple pools per process, something XP couldn’t do.
Vista has something called “anti-convoy features” to keep performance from degrading when a large number of threads were blocked, waiting for resources. You probably have encountered these. The whole system would freeze for several seconds and not respond to any input, then suddenly, bam, the system takes off again, running all of its processes. That was a convoy locking up everything.
If ten threads needed a resource and only nine got it but one thread failed to acquire the resource, all ten threads would lock. Vista ended this by letting threads that need a resource get that resource, then send the thread that couldn’t get a resource back to the end of the line.
Windows 7 Builds On This
Windows 7 was developed in parallel with Windows Server 2008 Release 2. The two share the same kernel and thus many features. One of them, for example, is support for up to 256 cores. AMD and Intel are at the six/eight-core range, but in a system with multiple processors, that adds up fast. Intel intends its new Nehalem-EX processor, with eight cores, to be used in servers with four sockets. That’s 32 cores and 64 threads.
Windows XP was built back in the time of Symmetric Multiprocessing (SMP), where multiple cores in a CPU were seen as separate physical CPUs, as were multithreaded CPUs like the new Core i5/i7. Memory was seen as a single fabric. Windows 7, with its NUMA concepts, sees cores as functional nodes, manages threads between the nodes, and allows for partitioning or allocating memory between cores.
This led to all kinds of headaches involving overwrites or conflicts over the same memory allocation memory. NUMA lets a portion of memory be allocated to a core. Switching memory from one core to another, though, isn’t trivial, but with Windows Vista, Microsoft added C functions to copy memory from one allocation to another.
As much as Windows 7 performs well on an older processor, you will see real benefits of Windows 7 if you get a newer computer with an Intel Core i5/i7 processor or AMD processor, since they both have NUMA support. In fact, benchmarks and tests have shown dramatic improvement when run on a Core i7 system instead of a computer with an older Core 2 Duo or Core 2 Quad processor.
Power management and core management is also improved. Intel’s Nehalem and AMD’s Phenom architectures actively monitor their cores and shut them down to conserve power. Prior to Windows 7, though, the OS ran threads wherever a core was available. This made it harder for quad-core machines to shut down idle cores, for example. Applications may create threads, but they don’t assign them to cores; that’s the operating system’s job.
So with Windows 7, there is a concerted effort to assign cores to an execution pipeline, such as a core. Now, threads get sent back to the same core where the last threads for that application executed, so an application more closely sticks with one core. This lets idle cores shut down and makes for smarter processor affinity. Instead of throwing threads at every core, it just goes to one.
Windows 7 also has something called “SMT parking” or “core parking.” Both are used interchangeably. This is a feature developed in partnership with Intel, which supports the Hyper-Threading (HT) in the new Core i5/i7s. In addition to managing the threads in cores, Windows 7 also manages the HT in the Intel chips. AMD has chosen not to use HT technology, so you won’t get the benefit on an AMD computer.
The OS recognizes which systems have Hyper-Threading and schedules for performance and thread management accordingly. It also recognizes hyperthreads and physical threads to make decisions on where to assign threads; it migrates threads to an available core at the appropriate time when necessary.
Windows 7 improved on the anti-convoy features, which benefits both Intel and AMD systems. In testing Vista, Microsoft found that a lot of lockups and system freezes came from multiple applications trying to access the Graphics Device Interface (GDI). In Vista, a single application could lock the whole system while it waited for another thread or application to let it access the GDI and redraw the system.
The Windows 7 kernel features a new GDI and improved memory allocation. Microsoft rearchitected the GDI’s internal synchronization mechanism, ending exclusive locks on the GDI by one thread. It adds a little overhead, but it keeps your whole system from freezing while multiple applications fight for the GDI — a worthwhile tradeoff.
Multi-core Windows PCs benefit because more than one application can be rendered by the GDI layer at the same time. In fact, each core can do a concurrent GDI rendering, and the GDI stack can send multiple requests out to the GPU for rendering work.
Now that multicore has become a permanent fixture in computing – not just desktops and servers, but even hand-held devices, as Intel’s Atom processor and ARM’s embedded Coretex processor are both available in dual-core designs – operating systems are being made more and more multi-core aware.
But always remember that the operating system is the program loaded and task handler. Your applications won’t be made multithreaded by Windows; that’s something the developers have to do, and they are, but that’s a whole other story.
Want more like this? Sign up for the weekly IT Expert Voice newsletter so you don’t miss a thing!