Welcome Guest ( Log In | Register )


Important

The forums will be closing permanently the weekend of March 15th. Please see the notice in the announcements forum for details.

 
Symmetric Multiprocessing, who's balancing the load?
« Next Oldest | Next Newest » Track this topic | Email this topic | Print this topic
i4004
Posted: Jul 16 2007, 10:27 PM


Advanced Member


Group: Members
Posts: 2432
Member No.: 4935
Joined: 24-June 03



was toying with two different versions of cce:
older:
user posted image
newer:
user posted image

expecting recent version should be faster, but then seeing a good explanation why it's the same ( http://www.cinemacraft.com/eng/cpu.html ) it made me wonder:
this software doesn't seem to be optimized for multiprocessing at all, because i would say all that's happening is windows balancing the load so we have about 50% overall cpu usage and simillar cpu usage pattern on both cores....

is that correct? is that, then, an easy way to tell if program is multiprocessor optimized or not?

and one more: let's presume program is optimized for multiple cpus: how does this affect windows?
ie do windows and that program fight for cpu cycles?
can that program just say to win "sit there and wait till i'm finished!" ?
what has priority?

and, to that extent, is it even possible to write a program that would use both cores to the max?



--------------------
my signature:
user posted image
 
     Top
phaeron
Posted: Jul 17 2007, 05:39 AM


Virtualdub Developer


Group: Administrator
Posts: 7773
Member No.: 61
Joined: 30-July 02



It's unclear from the chart, but if you're seeing roughly 50% CPU on each core, then yes, CCE is bottlenecked by a single thread. Windows balances threads across the two cores, one reason being to spread the thermal load -- don't get one core getting really hot while the other one sits idle.

When this behavior occurs, then obviously the program is not taking advantage of all available CPU power. However, the inverse doesn't follow -- just because a program takes 100% of both CPUs doesn't mean it is multiprocessor optimized, only that it has multiple threads that can use multiple cores. I've seen some pretty piss poor threading solutions that burn CPU needlessly on crappy synchronization primitives, like Sleep(0). The way to tell is to measure. You can right-click on a process in Task Manager to change its affinity and force it onto one core, and compare throughput with when it has both cores available. That will give you some idea of how well the program is able to take advantage of a second core.

Of course, due to shared caches and memory, two cores means somewhat less than double the performance of a single core.

Windows will not allow a program to monopolize all CPUs for any large amount of time. For one thing, there are a number of high priority tasks that will pre-empt a regular program, such as interrupts, driver worker tasks, and the mouse pointer. It also attempts to ensure that foreground tasks get a little bit of priority boost for responsiveness and that I/O tasks are bumped when ready to improve throughput. Finally, Windows ensures that no task is starved of CPU for a very long time in order to avoid priority inversion issues -- otherwise, a lower-priority program could never get a chance to run and thus release a resource that a higher-priority task is blocked on.

The simplest way to ensure that both cores are always running is to overcommit the CPUs a bit, so that there are always more threads ready to run on any processor. The built-in thread pool APIs in Windows NT start double the number of threads as logical CPUs for this reason.
 
    Top
i4004
Posted: Jul 17 2007, 11:26 AM


Advanced Member


Group: Members
Posts: 2432
Member No.: 4935
Joined: 24-June 03



very nice, thanks.

--------------------
my signature:
user posted image
 
     Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
2 replies since Jul 16 2007, 10:27 PM Track this topic | Email this topic | Print this topic

<< Back to Off-Topic