contact us | smp-faq | archives | submit news

Navigation

Home
RC5 Team
Forums
Hardware
Software/OS's
Articles
Links


Official Hardware Sponsor

Mailing List



SMP Reality - Symmetrical Multi Processors

There has been a whole lot of fuss about SMP Lately. I have read close to 30 different articles about SMP. Most of them have not gotten it right yet. I usually do not write articles, but I could not listen to people flapping their gums any more, so here it is.

In this article I will make a few assumptions. First, let's assume we are using a form of Windows NT for an OS, (NT 3.x, 4.0, and 2000) and second we will assume we are using two x86 type processors (Pentium, Pentium Pro, P2, P3, Celeron, K7, etc.).

Let us start by looking at some common terms.  

HAL - Hardware Abstraction Layer. A part of the Windows NT Executive, which controls, and hides the hardware from the software.  

Thread - A “thread” is a line of execution, or a pathway for command strings if you will.  

Thread pool - this is a store of threads maintained by Windows NT. NT will maintain threads in an open yet idle state, which can be claimed by an application. 

Multi-threaded app - an application that has the ability to have more than one thread at a time. Thus allowing it to request 2 or more strings for CPU time.  

Now that we have some groundwork laid, lets get on with it.  

The first thing I want to make clear is: the HAL controls thread distribution, not the application. The HAL is like a police dispatcher, it receives hardware request and assigns it to hardware. This includes the CPUs.  The next fact is that your CPU is NOT multitasking. It can only execute on thread at a time, period. One thread, no more. With this in mind, consider this, right now your Computer is running about 60-100 threads. Most of which are idle, however, some are active, and they must wait in line for your CPU time.  

I have heard people refer to a second CPU as a "stand-by" that kicks in when the first CPU is loaded. This is simply not true. There is no difference in the CPUs roles, in fact the CPUs ID of 0 or 1 switches many times per second.  Each CPU in a SMP system will share the workload fairly equally, there is always exceptions of course, but generally, this is the case. Now I have heard people say that you need an “SMP capable app” to get a performance increase. This also is not true.

Remember your HAL controls threads, and everything has threads, your OS, your apps, everything. So lets say you bust open Quake 2, which is single threaded.  Will you see a performance increase with two CPUs over one? YES. Why? The HAL can dedicate a CPU to the Quake 2 thread, and run the OSs threads through the Other CPU. The Machine will run better. If your run a multi-threaded app, the HAL can grab the threads from that program and execute two threads at once. It will assign one to each CPU. This brings up a key point.  If a p2 450 can only run one thread, and a dual p2 450 can run two, then why is there not a 100% performance increase?  The two CPUs must talk to each other. This bus overhead causes a drop in the performance of the CPU’s. So, in the end, you get an 80% increase.

Let me lay down a couple of graphics to help you visualize exactly what I am talking about here.

In the above breakdown we see how the HAL handles threads, and how it feeds each CPU. Once a thread has been given, it’s CPU time and is idle, The Hal breaks the thread, and feeds the available CPU a new thread. The threads awaiting a CPU to become available are held by the HAL for a free CPU. If a no threads are waiting for CPU time, the HAL will feed the CPU an idle thread, where the CPU just computes bogus commands. When a thread comes alive, the HAL breaks the idle thread and pipes it to a CPU.

 

smp2.gif (6856 bytes) 

Above we see how a single threaded app can increase in performance. Games like Quake 2 require almost constant CPU time, any interrupts made by the HAL to give the OS CPU time is a performance hit in Quake. As the diagram would suggest, by having a second CPU to give the OS it’s CPU time we eliminate this almost completely Allowing Quake II to run faster, and smoother.  

There is a thing in Windows NT called “ WOW” or, Windows on Windows. What this does is it fools older applications into thinking it is running on Windows 3.x, or DOS. It runs the application inside a program, which emulates the Windows 3.x environment. Each WOW app gets one thread, and it’s own memory space. Running an older app such as “Doom”, will still see the benefits of having more than one CPU. As the other CPU is free to run explorer, and what ever other apps you may have running.

I know this is heavily simplified, all you techno-geeks like me can put away the manuals and back off. This is just to clarify some commonly made misunderstandings. If I have made some blatantly mucked up statements then send me a mail and we will get the issue figured out.  I hope this article has helped some of you.  Basically, the bottom line is SMP kicks ass, and your whole computer will run faster, and smoother. Having two CPU’s is well worth it, and extends the life of your PC.

Gadfly

This article was written by Gadfly and originally appeared at the HardOCP.  We would like to thank them for allowing us to post it here

 
All content and design of this site is © 2CPU.com 1999, 2000 Read our privacy statement.