Dual Processor..

AMDXP

2[H]4U
Joined
Jul 9, 2004
Messages
2,631
Excuse my nubbish but exactly what benifts does a dual processor have? For example if its dual 2600+ amds does that make it like a 4000+ ? even though it operates at 2.0 ghz each processor?

Are dual processors worth it?
 
no it isn't like a 4000.. with duals u have the ability to take 2 threads in at once instead of just one... clock speed is still the same, but since both cpu's take threads at the same time your system seems faster than a say 2 ghz like in your example. Once you go dually, it is hard to go back... at least until there is dual core cpus
 
soo would a dual 3200+ xp be better then an amd 64bit and such...
 
it could probably handle more info, but on alot of tasks, aka games, you wound't see as much performanc increase yet
 
ok here is something i have wondered about....
When there are new core´s comin with dual capabilites on the same chip will you be able to still put them onto a dual cpu mobo?
I guess that the mobo´s we have today are not gonna work then(whenever they arrive) or?
so are there any plans that you guys know of to make dual dual mobos? and will the cpus support it?
Is that info out yet?

and what timetable are we looking at?
 
If you're talking the opterons, the according to press realeases the dual core chips will be compatible with current motherboards, so a dual board can effectively upgrade to a quad, and a single could be a dual. I believe they are due out 4th quarter this year or 1st of next.
 
ah nice!
so the next q is what os can u run on a quad system?
will it have to be a server version of windows or will vanilla xp take advantage of the 4 cpu´s?
 
win2k servre series ibelieve for 4 or more, or i believe xp pro will also, i could be wrong though, 4 process is for some heavy lifting work though, dual is usually more than enough for teh average hardcore, superuser. I state a general rule of thumb is if you don't know what smp is or how it works, you don't need it.
 
defakto said:
I state a general rule of thumb is if you don't know what smp is or how it works, you don't need it.
Very true.

Right now I a running dual opteon 244s on a MSI K8T-Master2, and have been very pleased with the performance. As was stated earlier, they do not add in a mathematical sense but rather they compliment each other through simultaneous thread execution. This lets me have a limitless number of windows (2GB RAM, I still have not found the upper limit on simultaneous apps), and even play UT2K3 while burning 2 DVDs at once:D
 
AMDXPCottonFire22 said:
I didnt think opterons where for gaming...
Not designed for gaming, and that is not the primary purpose in my system. But they do nicely though:)
 
AMDXPCottonFire22 said:
I didnt think opterons where for gaming...
Well, they were intended as server/workstation chips. But think of it this way:
The original socket 940 Athlon FX was really just a fast Opteron, and the P4 EE is basically a fast Xeon core in P4 packaging.
 
zandor said:
Well, they were intended as server/workstation chips. But think of it this way:
The original socket 940 Athlon FX was really just a fast Opteron, and the P4 EE is basically a fast Xeon core in P4 packaging.
The huge cache makes for nice gaming, as well as simultaneous execution of GFX and physics threads in games that support it.
 
M11 said:
The huge cache makes for nice gaming, as well as simultaneous execution of GFX and physics threads in games that support it.

What are you refering to when you say simultaneous execution of GFX and physics threads in games that support it? Are you refereing to a dual system? or a single? If you're refering to a dual processor system, no game yet official has efficient support for smp processing, q3 had smp but support but it offered almost no increase and was usually a decrease.
 
devourment77 said:
<snip> Once you go dually, it is hard to go back... at least until there is dual core cpus
I strongly disagree with that statement!!
As soon as dual cores with dual sockets get here I'm putting my workstations on them.
I've got processes that run a dual 3Ghz to the ground, and I'd like to get a quad 6Ghz,
When the dual cores come out it will still be hard to go back!!
 
I'm running a cheap dual system as far as anyone is concerned (overclocked Mobile Bartons on Gigabyte Mobo) but I must say that if you have two heavy programs that need to operate fast and together, dual processor is awesome.

Windows only lets one thread use up to 50%, or one full processor. So to acturally use 100%, or both processors, you need at least two programs going, or a multithreaded program.

The way I hit near 100% is by hosting a dedicated game server (with lots of AI power, like 90% CPU - or really 45% total on dual rig) on one processor, and then running the game on the other processor. I do not notice a slow down that you would see if you tried this on a single processor computer. Same speeds if I host the game as if someone else decides to sit out and host the game. Then again, my video card isn't the best, so I might be losing like 2% performance and not even notice it, but with this much power (and considering that anyone else who hosts half this much AI can't even play the game), it doesn't matter at all.

And the fact that I can play music and do a few other things in the background when I'm not the game server (or *only* giving the AI like 75% dedication) is awesome.
 
Tim_axe said:
Windows only lets one thread use up to 50%, or one full processor. So to acturally use 100%, or both processors, you need at least two programs going, or a multithreaded program.


That's not quite an accurate statement. A thread can never use more than one processor, windows or not, you would need multiple threads to use more than one. Wether you're talking a windows, vax vms, or an IBM AS400, a thread cannot run on more than one processor at a time.
 
I guess this can be filed under something like "Win2K not the best multiprocessor os", etc., but I'd like to mention this and maybe gain some insight into what it happening.

I don't know the correct name -- thread, process, some task, etc -- but Win2K tries to balance a program across the two processors. It does hurt performance, so I have to set processor affinity, etc, to correct it. But I'll post a screen capture demonstrating this, although I don't quite know what it means other than it sucks for performance.


1 instance of F@H with processor affinity to "both" processors (default). It "load balances" or something, and generally hurts performance...especially when two instances do this horrible act...

photos_dualcpu_loadbalancing.png
 
ok so is there a way to put certain processes in a dedicaded cpu?
like say I put all my system stuf in cpu 0 and the rest(lets say a game) in cpu 1 ?
talking about XP here or windows in general....
would not that be better for perfomance? to give the choosen process a "empty" cpu to use all by it self?
 
yes

in the task manager you can set a process's CPU Afinity to any one of your cpu's
 
In general with win2k you do NOT need to set processor affinity, it will balance quite well on it's own, and if you set affinity it has a habit of creating instability(i've locked up my dual opteron 246 with folding at home by setting the affinity, even with priority on low for the processes.) I've never seen an instance where you even need to worry about affinity at all.

Tim_Axe what you are seeing on the cpu graph is not one process being run across two cpu's at once but windows is juggling the process between the two to make sure that the load is balanced with all the other processes running so it's trying to get the most cpu it can at any give time. You're not seeing an performance decrease, just alof of wierd activity on the monitor. Also, since you're running a dual rig, you might as well start a second console session of FAH :>) take advantage of that second processor.
 
So why are we not seeing applications and games doing this "shuffle"?
If I have 1 good cpu in a normal singlecpu system doing all the work shouldnt one be able to do a dual system with processes that are cpu bound/moved/shuffled really fast and scalable?

I read the forum and it seems that appz like photoshop and such have a good support but games does not have it when it comes to dual enhancements....
Even if you dont use the balancing feature(wich seems to have timing issues or?) with 2 cpu´s doing 50/50 of the work load, one could dedicate more power to the processes that you deem important...or am I missing something here?
Can applications not interface with the balancing of the cpu and shuffle of processes to empty 1 cpu ??
 
A single process, like a game cannot use more than 1 processor, so it will never be able to use more than 50 percent of the total cpu usage in teh system, aka, 100 percent of one processor. The os will move processes from one process to another as those processes need more power, or if they are using less. I'm not sure how it does it, i don't really know the inner workings of the load balancing, but i do know that you can create an instability by setting an a processor affinity at time.
 
I think the OS is supposed to identify the needs of a program/process better than us (people) can, and much faster too, and then makes sure that each program that needs the processor has as much room as possible. For example, if you had 3 programs wanting to take up a lot of power, or 50% each (one full processor) the OS would balance it so each process gets 33.3% of the total power. And I guess Windows is shuffling just incase this happens.

(BTW, default affinity is both processors so it can shuffle. We're talking about setting affinity as assigning a process to only 1 processor, instead of the default of both.)

I haven't run into instability by setting processor affinity. I've noticed a few issues with default (both/shuffle) affinity on Mozilla. The loading icon would pause, then go extra fast, pause, etc. And so far, I'm convinced one BSOD was caused by not setting affinity for two F@H instances. It could be that i'm on a tight rope of stability (Prime95 stable at this speed, but just not at ~40MHz faster). But I kind of like keeping a game and a game server off of the same processor, so I set affinity.


And yup, I'm running two F@H instances when this is on. :)
 
defakto said:
The os will move processes from one process to another as those processes

Well, the OS schedules threads. It doesn't schedule processes. A thread gets some information from its schedule from the process, but the OS certainly doesn't "move processes from one processor to another".

defakto said:
need more power, or if they are using less. I'm not sure how it does it,
The move isn't based on "power" requirements. The moves are based on a thread being runnable.

Let's fiture that the OS knows it has two processors. It also knows that it has a certain number of threads, and it knows the relative priorities for each of those threads. And it knows when a given thread becomes runnable.

Say you have ThreadA running on CPU #0. It uses up its quantum, and is stopped. The OS looks around and sees that ThreadF is runnable, so it gets scheduled on CPU #0, which is now free because ThreadA got suspended.

At the same time, ThreadB is running on CPU #1. It finishes its quantum, and is stopped. The OS doesn't have many runnable threads at this instant. The next candidate is ThreadA.

The OS could do one of two things: it could schedule ThreadA on CPU #1. Or it could give ThreadB another quantum on CPU #1.

The right answer isn't obvious; it might not even be practically computable. If ThreadB gets scheduled, it will continue to run and be very happy because the CPU #1 cache is very warm with its old data. It should really sail!

On the other hand, scheduling ThreadB means that ThreadA might be starving. And there might be synchronization relationships between ThreadA and ThreadB, so the problem could be pretty deep.

Say the OS schedules ThreadA, then, on CPU #1. ThreadA starts running, but is a bit sluggish because it has been pounding memory, and now its cache is cold. Nothing in the CPU #1 cache has anything to do with what the thread had been doing back on CPU #0, where the cache is quite well-populated ... or, at least, it was.

For some applications, binding to a processor helps significantly because the cache hits go up as that cache stays hot. For others, binding to a processor is a hinderance because the threads have to wait until that processor is available. Waiting wastes more time than cache misses.

There really are applications where setting affinity -- at least on the thread level -- significantly helps performance. If you haven't seen them yourself, maybe you haven't looked hard enough.

defakto said:
but i do know that you can create an instability by setting an a processor affinity at time.

It's hard for me not to say that this only happens when there's a bug in the software in question. The affect of manually setting thread affinity could possibly happen automatically in the operating system.

If you set all the threads in a process to affine to a particular CPU manually, you're doing something the OS might have decided to do automatically itself. Say you only have two processes; A and B. A has no affinity. But B is affined to CPU #1. It's quite possible that the OS will bind Process A to CPU #0, since it's the spare resource. Then, you're exacerbating the same bug in the software, but you haven't set processor affinity for the process in question.

The affinity certainly changes the relative timing of execution for a process. All threads are moving to one processor, not just some or one or a few. And no threads will truly execute concurrently, since only one can be running at a time on the thread. If affinity is changing program behaviour, then the program necessarily has race conditions that might be shown without setting affinity at all.

.B ekiM
 
defakto said:
A single process, like a game cannot use more than 1 processor, so it will never be able to use more than 50 percent of the total cpu usage in teh system,

I'm sorry, but this is patently false.

A single process may contain many threads. I can create a process that creates 32 threads, and would therefore be able to concurrently use 32 processors.

A single process can certainly use 100 percent of all available CPU resource, system-wide.

.B ekiM
 
Mikeblas, actually you're statement is false.

There is one game on the market that support SMP that i know of, quake3, some of the newer ones may support it but i'm not to familiar with their game angines at all.

The reason being just because something is multi threaded does not mean it is coded in such a way that it can handle multiple processors on the software level. You need to worry about race conditions, starvation, as well as other things with SMP enabled software. example, simplistic but an example:

Game X runnning three threads. Sound, graphics and AI thread. on game x, if you just run a thread arbitrarily on another processor you're going to hit some issues. Say, processor 0 is running graphics, so it's taking a pretty hefty load out of the system. Processor 1 is running the ai because it's the best damn ai out there so it needs massive info. Say sound get shuffled over onto processor 1 because the ai count is low however, as it's going, some more ai comes into play, therebye takeing more power, the sound doesn't have as much cpu power behind it, it can't complete it's information in time, so it ends up playing out of syc with the graphics on teh screen.

Being multithreaded does not mean a Process or program support SMP. It's part of the step, but not entirely what is needed. There's more programming down at the kernel of the program that allows it to support smp. If smp was just as simple as threads OpenBSD would have had it a long time ago.
 
defakto said:
Mikeblas, actually you're [sic] statement is false.

Which one? That a single process can contain multiple threads? Nope, that's certainly true.

That a single process can use 100 percent of the CPU resources, even on an SMP system (even on a NUMA system, for that matter) system-wide? Nope, that's certainly true.

defakto said:
There is one game on the market that support SMP that i know of,

Your original statement used games as an example, but was not limited to games.

If you have multiple threads, and have multiple CPUs available, and haven't set affinity for those threads, the threads will run on separate processors. That's the way Windows works.

defakto said:
if you just run a thread arbitrarily on another processor you're going to hit some issues.

If the code is buggy, sure. Code that doesn't worry about synchronization of shared resources between multiple threads won't always run correctly even on single processor machines.

A good developer anticipates those issues and codes for them. Or, doesn't create the extra threads.

Your statement that "a single process ... cannot use more than 1 processor" is false. A single process can use as many processors as it likes. Indeed, if it makes efficient or correct use of those resources is an open question -- and completely up to the person who codes the process.

But it is certainly possible for a single process to use more than 50 percent of the total CPU in the system.

.B ekiM
 
I'm drawn to writing code like an alcoholic is drawn to the bar. So, when I'm not at the bar, I'm compelled to write code. It's not too useful, but the point is to show how a single process can create some threads and use up both CPUs in a multiproc system.

Run it with the number of threads you want to create.

.B ekiM

Code:
#include <stdio.h>
#include <tchar.h>
#include <process.h>

#include <math.h>
#include <stdlib.h>

#include <conio.h>

#include <windows.h>

volatile LONG g_lCandidate = 3;
volatile bool g_bQuit = false;

class CThreadInfo;
unsigned int __stdcall ThreadProc(void* pInfo);

class CThreadInfo
{
public:
	CThreadInfo()
	{
		m_hThread = NULL;
		m_szName[0] = 0;
	}

	~CThreadInfo()
	{
		if (m_hThread != NULL && m_hThread != INVALID_HANDLE_VALUE)
			CloseHandle(m_hThread);
	}

	HANDLE Create(int nName)
	{
		wsprintf(m_szName, "Thread%d", nName);
		m_hThread = (HANDLE) _beginthreadex(NULL, 0, ThreadProc, this, 0, NULL);
		return m_hThread;
	}

	char m_szName[100];
	HANDLE m_hThread;
};

unsigned int __stdcall ThreadProc(void* pvParam)
{
	CThreadInfo* pInfo = (CThreadInfo*) pvParam;

	while (!g_bQuit)
	{
		// get a candidate to test
		LONG lCandidate = InterlockedIncrement(&g_lCandidate);
		if ((lCandidate & 1) == 0)
		{
			// it's even, and so it is certainly not prime
			continue;
		}

		// it's odd, so it might be prime
		LONG lUpperLimit = (LONG) sqrt((double)lCandidate);
		bool bIsPrime = true;
		for (LONG lDivisor = 3; lDivisor < lUpperLimit; lDivisor += 2)
		{
			if (lCandidate % lDivisor == 0)
			{
				bIsPrime = false;
				break;
			}
		}

		if (bIsPrime)
		{
//			printf("%s: %d is prime\n", pInfo->m_szName, lCandidate);
		}
	}

	return 0;
}

int _tmain(int argc, _TCHAR* argv[])
{
	// did we get a parameter?
	if (argc != 2)
	{
		printf("usage:\n\tThreadPrime <number_of_threads>\n\n");
		return 1;
	}

	// was it a useful parameter?
	int nThreads = atoi(argv[1]);
	if (nThreads > 64 || nThreads < 1)
	{
		printf("can't create %d threads\n", nThreads);
		return 1;
	}

	// create all the threads
	CThreadInfo* infos = new CThreadInfo[nThreads];
	for (int nIndex = 0; nIndex < nThreads; nIndex++)
	{
		if (INVALID_HANDLE_VALUE == infos[nIndex].Create(nIndex))
		{
			printf("Couldn't create thread %d\n", nIndex);
			g_bQuit = true;
			break;
		}
	}

	// if we created them, wait for keyboard input to shut 'em down
	if (!g_bQuit)
	{
		while (!_kbhit())
			Sleep(0);
	}

	// ask the threads to quit running
	g_bQuit = true;

	// then wait for them to quit running.
	// we need an array of handles to wait on

	HANDLE* hWait = new HANDLE[nThreads];
	memset(hWait, 0, sizeof(HANDLE) * nThreads);

	DWORD dwWaitCount = 0;
	for (int nIndex = 0; nIndex < nThreads; nIndex++)
	{
		if (infos[nIndex].m_hThread != NULL)
		{
			hWait[dwWaitCount] = infos[nIndex].m_hThread;
			dwWaitCount++;
		}
	}

	printf("Waiting for shutdown...");
	DWORD dwDisposition = WaitForMultipleObjects(dwWaitCount, hWait, TRUE, 10000);
	printf(" wait returned %d\n", dwDisposition);

	// done waiting, so remove the array
	delete [] hWait;

	// no more threads, so close all their handles and free that memory
	delete [] infos;

	return 0;
}
 
I'm not a coder at all, however, when trying to compile with DevC++ i get invalid on line 51.
 
defakto said:
I'm not a coder at all, however, when trying to compile with DevC++ i get invalid on line 51.

Line 51, by my count, is the call to InterlockedIncrement(). I can't guess why your compiler doesn't support the Win32 API, but "Invalid" seems like a pretty useless error message. I can't imagine that you're happy with that compiler.

You can download a built executable from here.

.B ekiM
 
I don't use...ever...but i didn't have any othercompiler at the moment so i snagged it quick off the net as it's free. Unfortunately Invalid is all it gave me for an answer.
 
defakto said:
What are you refering to when you say simultaneous execution of GFX and physics threads in games that support it? Are you refereing to a dual system? or a single? If you're refering to a dual processor system, no game yet official has efficient support for smp processing, q3 had smp but support but it offered almost no increase and was usually a decrease.

doom 3 takes full advantage of my dually. both procs run at around 90% capacity.

and SMP came disabled in Q3...that's probably why you saw no increase.

and you have to remember that one proc can handle the game, and the other can handle windows threads.
 
defakto said:
That's not quite an accurate statement. A thread can never use more than one processor, windows or not, you would need multiple threads to use more than one. Wether you're talking a windows, vax vms, or an IBM AS400, a thread cannot run on more than one processor at a time.

I think you need to read his post again. Nothing he said was inaccurate. He never said one thread could use both processors...he said one thread can use one processor, and in order to use both processors you need to run a multithreaded program or you need to run multiple programs.
 
lynxlynx said:
ok so is there a way to put certain processes in a dedicaded cpu?
like say I put all my system stuf in cpu 0 and the rest(lets say a game) in cpu 1 ?
talking about XP here or windows in general....
would not that be better for perfomance? to give the choosen process a "empty" cpu to use all by it self?

google a program called smp seesaw. it lets you set processor affinities.

also, windows allows you to do this too, but it's not quite as easy and it doesn't work as well.
 
Leright said:
I think you need to read his post again. Nothing he said was inaccurate. He never said one thread could use both processors....

Even if I had, would I have been incorrect?

Certainly, the same thread doesn't execute on two different processors simultaneously. But a single thread might be scheduled for one quantum on one processor, then scheduled on another processor for its next time slice.

.B ekiM
 
Leright said:
also, windows allows you to do this too, but it's not quite as easy and it doesn't work as well.

In what way does it fail?

.B ekiM
 
mikeblas said:
Even if I had, would I have been incorrect?

Certainly, the same thread doesn't execute on two different processors simultaneously. But a single thread might be scheduled for one quantum on one processor, then scheduled on another processor for its next time slice.

.B ekiM

n/m
 
Last edited:
Back
Top