From: "David Schwartz" <davids@webmaster.com>
To: "Mike Black" <mblack@csi-inc.com>,
"linux-kernel" <linux-kernel@vger.kernel.org>
Subject: RE: Pthread performance
Date: Sun, 13 Jul 2003 13:11:44 -0700 [thread overview]
Message-ID: <MDEHLPKNGKAHNMBLJOLKEEEOEFAA.davids@webmaster.com> (raw)
In-Reply-To: <022401c3479e$2b1cd2e0$c8de11cc@black>
> I found a benchmark program for threads and found a major
> difference between a single CPU and dual CPU system.
> Here's the code:
> http://www-124.ibm.com/pipermail/pthreads-users/2002-April/000176.html
> Is this showing context switches going between CPUs??
No.
> Wouldn't one expect the dual CPU to run twice as fast instead of
> ten times slower?
Not necessarily. The code doesn't do much other than modified shared data
without a lock. Not only does this invoke undefined behavior, but it
penalizes SMP machines because only they are subject to cache ping-ponging.
> As you can see from the timing user time increases by a factor of
> 4 and system time by a factor of 10.
> I seem to remember something about gettimeofday() possibly being
> a problem but couldn't find a reference to it.
> Anybody have an explanation/fix for this?
The program doesn't seem to measure anything useful and invokes undefined
behavior.
If you would like a fix, try this:
#define sched_yield() while(false)
DS
prev parent reply other threads:[~2003-07-13 19:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-07-11 11:18 Pthread performance Mike Black
2003-07-13 20:11 ` David Schwartz [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=MDEHLPKNGKAHNMBLJOLKEEEOEFAA.davids@webmaster.com \
--to=davids@webmaster.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mblack@csi-inc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.