LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Brian McGrew <brian@visionpro.com>
To: <linux-kernel@vger.kernel.org>, <fedora-users@rdhat.com>
Subject: Threading...
Date: Fri, 19 Jan 2007 10:43:13 -0800	[thread overview]
Message-ID: <C1D65141.16E37%brian@visionpro.com> (raw)

I have a very interesting question about something that we're seeing
happening with threading between Fedora Core 3 and Fedora Core 5.  Running
on Dell PowerEdge 1800 Hardware with a Xeon processor with hyper-threading
turned on.  Both systems are using a 2.6.16.16 kernel (MVP al la special).

We have a multithreaded application that starts two worker threads.  On
Fedora Core 3 both of these we use getpid() to get the PID of the thread and
then use set_afinity to assign each thread to it's own CPU.  Both threads
run almost symmetrically even on their given CPU watching the system
monitor.

On Fedora Core 5 with whatever new threading mechanism is being used, getpid
no longer works on threads, it returns the same PID as the parent program.
So we're using _pthread_self to get a u_long thread id back.  However,
set_afinity doesn't accept that, it wants a real PID.  So we're leaving it
to the system to schedule the threads between the CPUS.

On FC3 the threads run on 2 CPUS in symmetry and almost in parallel.
However, the problem is on FC5 it doesn't work like that.  We're seeing the
threading is almost more serial, where one thread will run on CPU1 at 100%
then as it's finishing and the CPU utilization is coming down, thread two is
coming up to 100% on CPU2 and they're ping ponging back and forth ... Which
is costing us a lot of time!

What am I missing?  What do I need to do in FC5 or the kernel or the
threading library to get my threads to run in symmetric parallel again???

Thanks!

-- 

-brian

Brian McGrew    { brian@visionpro.com || brian@doubledimension.com }
--
> With hope comes chance,
    with chance comes destiny,
    with destiny comes fate,
    And with fate comes the courtesy flush!


             reply	other threads:[~2007-01-19 18:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-19 18:43 Brian McGrew [this message]
2007-01-19 18:55 ` Threading Arjan van de Ven
2007-01-19 19:01   ` Threading Brian McGrew
2007-01-19 19:23     ` Threading Arjan van de Ven
2007-01-19 21:26     ` Threading Bill Davidsen
2007-01-20  1:18   ` Threading J.A. Magallón

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=C1D65141.16E37%brian@visionpro.com \
    --to=brian@visionpro.com \
    --cc=fedora-users@rdhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: Threading...' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).