Fedora Linux Support Community & Resources Center
  #1  
Old 9th February 2006, 09:02 PM
kornelix Offline
Registered User
 
Join Date: Oct 2005
Location: Germany
Posts: 95
Linux SMP Performance

There seems to be an issue here. I constructed a trivial benchmark to measure SMP performance for a simple case. Each thread of the benchmark does the following:

Code:
  while (elapsed_time < 5 seconds)
      optain a lock via pthread_mutex_lock()
      increment a counter
      release the lock via pthread_mutex_unlock()
I launched 1 to 9 threads contending for the same mutex and measured the counter value, per thread and total. Results:

Code:
   CPUs  threads  total loop rate
   ----  -------  ---------------
     1      1      27 million/sec.
     1      2      27
     1      4      27
     1      9      27   ** note A
     2      1      27
     2      2      6 
     2      4      7 
     2      9      6    ** note B
Note A: individual threads ranged from 2.2 to 3.9 million/sec.
Note B: individual threads ranged from 0.3 to 1.2 million/sec.

The hardware: AMD64 X2 3800+ (dual core)
To use only 1 CPU, I used the kernel 2.6.15-1.1830_FC4
To use both CPUs, I used the SMP kernel 2.6.15-1.1830_FC4smp

SMP performance is lower than uniprocessor performance, and allocation of CPU to threads is very uneven. Is this an AMD issue, or do Intel dual-core processors have the same problems with SMP Linux? Are any improvements in the pipeline? Is there anything invalid in my experiment?
Reply With Quote
  #2  
Old 9th February 2006, 09:16 PM
brunson Offline
Registered User
 
Join Date: Jun 2005
Location: Westminster, Colorado
Posts: 2,306
I think all you've done is identify a poor application of symetric multiprocessing.

Any time you are making a choice of whether to parallelize code you have to look at the ratio of computing to interprocess communication. If the communication is greater than the amount of processing done by the processors (taking into account bandwidth, latency, etc.) then the problems is not a good candidate for parallelization. Your synthetic test does little or no actual processing, but incurs the overhead of IPC, cache coherency and invalidation, mutex libraries, context switches, processor selection and a myriad of other complexities.

It's not (necessarily) that Linux is doing a bad job of SMP, I think you've just written a poor benchmark. Try fabricating one that does useful work for a useful amount of time on each processor, then compare it to a single processor machine.
__________________
Registered Linux User #4837
411th in line to get sued by Micro$oft
Quote:
Basically, to learn Unix you learn to understand and apply a small set of key ideas and achieve expertise by expanding both the set of ideas and your ability to apply them - Paul Murphy
Reply With Quote
  #3  
Old 9th February 2006, 10:11 PM
kornelix Offline
Registered User
 
Join Date: Oct 2005
Location: Germany
Posts: 95
The whole point was to benchmark SMP performance, not some other "useful work". The benchmark arose from a question about the overhead of locking/unlocking in multithreaded applications. 27 million per second makes the overhead insignificant for most purposes. Adding CPUs should not, however, make it slower.
Reply With Quote
  #4  
Old 9th February 2006, 10:19 PM
brunson Offline
Registered User
 
Join Date: Jun 2005
Location: Westminster, Colorado
Posts: 2,306
Quote:
Adding CPUs should not, however, make it slower.
I think you're mistaken, but what do I know.
__________________
Registered Linux User #4837
411th in line to get sued by Micro$oft
Quote:
Basically, to learn Unix you learn to understand and apply a small set of key ideas and achieve expertise by expanding both the set of ideas and your ability to apply them - Paul Murphy
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux + Performance PCs? CraigWatson Linux Chat 24 23rd June 2009 07:46 PM
How to fix the slow fullscreen performance of Flash player for Linux spoilt Guides & Solutions (No Questions) 3 5th July 2008 12:10 AM
Vista RC1 Performance on my Linux box. pparks1 Wibble 9 18th September 2006 06:02 PM
improving linux performance terry_g Using Fedora 0 13th December 2005 02:44 PM
help to suggest a code performance analysis tool on linux mounterriver Using Fedora 2 4th August 2005 01:34 PM


Current GMT-time: 04:26 (Friday, 21-11-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat
Shawinigan Instagram Photos - Fort Wayne Travel Photos - Rongai