From: Bill Huey (Hui) <billh@gnuppy.monkey.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: Ulrich Drepper <drepper@redhat.com>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [ANNOUNCE] Native POSIX Thread Library 0.1
Date: Fri, 20 Sep 2002 05:06:06 -0700 [thread overview]
Message-ID: <20020920120606.GA4961@gnuppy.monkey.org> (raw)
In-Reply-To: <Pine.LNX.4.44.0209201231430.2954-100000@localhost.localdomain>
On Fri, Sep 20, 2002 at 12:47:12PM +0200, Ingo Molnar wrote:
> our kernel thread context switch latency is below 1 usec on a typical P4
> box, so our NPT library should compare pretty favorably even in such
> benchmarks. We get from the pthread_create() call to the first user
> instruction of the specified thread-function code in less than 2 usecs,
> and we get from pthread_exit() to the thread that does the pthread_join()
> in less than 2 usecs as well - all of these operations are done via a
> single system-call and a single context switch.
That's outstanding...
> also consider the fact that the true cost of M:N threading does not show
> up with just one or two threads running. The true cost comes when
> thousands of threads are running, each of them doing nontrivial work that
> matters, ie. IO. The true cost of M:N shows up when threading is actually
> used for what it's intended to be used :-) And basically nothing offloads
> work to threads for them to just do userspace synchronization - real,
> useful work always involves some sort of IO and kernel calls. At which
> point M:N loses out badly.
It can. Certainly, if IO upcall overhead is greater than just running the
thread that's blocked inside the kernel, then yes. Not sure how this is all
going to play out...
> M:N's big mistake is that it concentrates on what matters the least:
> user<->user context switches. Nothing really wants to do that. And if it
> does, it's contended on some userspace locking object, at which point it
> doesnt really matter whether the cost of switching is 1 usec or 0.5 usecs,
> the main application cost is the lost paralellism and increased cache
> trashing due to the serialization - independently of what kind of
> threading abstraction is used.
Yeah, that's not a new argument and is a solid criticism...
Hmmm, random thoughts... This is probably outside the scope of lkml,
but...
I'm trying to think up a possible problem with how the JVM does threading that
might be able to exploit this kind of situation...Hmm, there's locks on
the method dictionary, but that's not something that's generally changing a
lot of the time... I'll give it some thought.
The JVM needs a couple of pretty critical things that are a bit off from
the normal Posix threading standard. One of them is very fast thread
suspension for both individual threads and the all threads accept the
currently running one...
In the Solaris threads implementation of JVM/HotSpot it has two methods of
getting a ucontext for doing GC and wierd exception/signal handling via
safepoints (a JIT compiler goody) and it would be nice to have...
1) Slow Version. Throw a SIGUSR1 at a thread and read/write the ucontext on
the signal frame itself.
2) Fast Version. The thread state and ucontext is examined directly to determine
the validity of the stored thread context, whether it's blocked on
a syscall (ignore it) or was doing a CPU intensive operation (use it).
That ucontext is used for various things:
a) Proper GC so that registers that might contain valid references are
taken into account properly to maintain the correctness of the
mark/sweep algorithms.
b) The thread's program counter value is altered to deal with safepoints.
(2) above being the most desireable since it's a kind of fast path for
(a) and (b).
So userspace exposure to the thread's ucontext would be a good thing.
I'm not sure how this is dealt within the current implementation of
what you folks are doing at this moment.
> primitives (including internal glibc locks), all uncontended
> synchronization is done purely in user-space. [and for the contended case
> we *want* to switch into the kernel.]
If there's any thing on this planet that's going to stress a threading
system, it's going to be the JVM. I'll give what you've said a some
thought. My bias has been to FreeBSD's KSE project for the most part
over this last threading/development run.
/me thinks...
bill
next prev parent reply other threads:[~2002-09-20 12:01 UTC|newest]
Thread overview: 114+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-20 0:41 [ANNOUNCE] Native POSIX Thread Library 0.1 Ulrich Drepper
2002-09-20 0:51 ` William Lee Irwin III
2002-09-20 1:35 ` Ulrich Drepper
2002-09-20 1:42 ` William Lee Irwin III
2002-09-20 1:56 ` Larry McVoy
2002-09-20 2:01 ` Rik van Riel
2002-09-20 2:15 ` Benjamin LaHaise
2002-09-20 2:40 ` Dave Hansen
2002-09-20 2:47 ` William Lee Irwin III
2002-09-20 2:17 ` Larry McVoy
2002-09-20 2:24 ` Rik van Riel
2002-09-20 2:32 ` Ulrich Drepper
2002-09-20 6:01 ` Linus Torvalds
2002-09-20 8:02 ` Ingo Molnar
2002-09-20 2:23 ` Anton Blanchard
2002-09-20 7:52 ` 100,000 threads? [was: [ANNOUNCE] Native POSIX Thread Library 0.1] Ingo Molnar
2002-09-20 15:47 ` Bill Davidsen
2002-09-20 9:53 ` [ANNOUNCE] Native POSIX Thread Library 0.1 Padraig Brady
2002-09-20 13:28 ` Robert Love
2002-09-20 16:01 ` Bill Davidsen
2002-09-20 9:54 ` Adrian Bunk
2002-09-20 10:53 ` Ingo Molnar
2002-09-20 19:04 ` Ulrich Drepper
2002-09-20 23:06 ` J.A. Magallon
2002-09-20 23:33 ` Ulrich Drepper
2002-09-20 23:42 ` J.A. Magallon
2002-09-20 10:20 ` Bill Huey
2002-09-20 10:47 ` Ingo Molnar
2002-09-20 12:06 ` Bill Huey [this message]
2002-09-20 16:20 ` Ingo Molnar
2002-09-20 21:50 ` Bill Huey
2002-09-20 22:30 ` dean gaudet
2002-09-20 23:11 ` Bill Huey
2002-09-21 3:38 ` dean gaudet
2002-09-21 4:01 ` Bill Huey
2002-09-21 5:06 ` Ingo Molnar
2002-09-20 23:45 ` Bill Huey
2002-09-21 4:58 ` Ingo Molnar
2002-09-22 2:51 ` Bill Huey
2002-09-21 4:48 ` Ingo Molnar
2002-09-22 1:38 ` Bill Huey
2002-09-22 13:38 ` Bill Davidsen
2002-09-22 18:41 ` Eric W. Biederman
2002-09-22 22:13 ` dean gaudet
2002-09-26 17:21 ` Alan Cox
2002-09-23 0:11 ` Bill Huey
2002-09-24 16:07 ` Eric W. Biederman
2002-09-24 23:21 ` Bill Huey
2002-09-25 3:06 ` Eric W. Biederman
2002-09-23 21:12 ` Bill Huey
2002-09-20 10:35 ` Luca Barbieri
2002-09-20 11:19 ` Ingo Molnar
2002-09-20 18:40 ` Roland McGrath
2002-09-20 21:21 ` Luca Barbieri
2002-09-20 12:37 ` jlnance
2002-09-20 16:42 ` Ingo Molnar
2002-09-24 0:40 ` Rusty Russell
2002-09-24 5:47 ` Ingo Molnar
2002-09-24 6:15 ` Rusty Russell
2002-09-20 15:43 ` Bill Davidsen
2002-09-20 16:15 ` Jakub Jelinek
2002-09-20 17:16 ` Bill Davidsen
-- strict thread matches above, loose matches on Subject: below --
2002-09-20 7:46 Joerg Pommnitz
2002-09-22 18:55 Peter Waechtler
2002-09-22 21:32 ` Larry McVoy
2002-09-23 10:05 ` Bill Davidsen
2002-09-23 11:55 ` Peter Waechtler
2002-09-23 19:14 ` Bill Davidsen
2002-09-29 23:26 ` Buddy Lumpkin
2002-09-30 14:54 ` Corey Minyard
2002-09-23 15:30 ` Larry McVoy
2002-09-23 19:44 ` Olivier Galibert
2002-09-23 19:48 ` Bill Davidsen
2002-09-23 20:32 ` Ingo Molnar
2002-09-24 0:03 ` Andy Isaacson
2002-09-24 0:10 ` Jeff Garzik
2002-09-24 0:14 ` Andy Isaacson
2002-09-24 5:53 ` Ingo Molnar
2002-09-24 20:34 ` David Schwartz
2002-09-24 7:12 ` Thunder from the hill
2002-09-24 7:30 ` Ingo Molnar
2002-09-23 22:35 ` Mark Mielke
2002-09-23 19:59 ` Peter Waechtler
2002-09-23 20:36 ` Ingo Molnar
2002-09-23 21:08 ` Peter Wächtler
2002-09-23 22:44 ` Mark Mielke
2002-09-23 23:01 ` Bill Huey
2002-09-23 23:11 ` Mark Mielke
2002-09-24 0:21 ` Bill Huey
2002-09-24 3:20 ` Mark Mielke
2002-09-23 23:57 ` Andy Isaacson
2002-09-24 18:10 ` Christoph Hellwig
2002-09-23 21:32 ` Bill Huey
2002-09-23 21:41 ` dean gaudet
2002-09-23 22:10 ` Bill Huey
2002-09-23 22:56 ` Mark Mielke
2002-09-24 10:02 ` Nikita Danilov
2002-09-23 21:22 ` Bill Huey
2002-09-23 21:03 ` Bill Huey
2002-09-24 12:03 ` Michael Sinz
2002-09-24 13:40 ` Peter Svensson
2002-09-24 14:20 ` Michael Sinz
2002-09-24 20:19 ` David Schwartz
2002-09-24 21:10 ` Chris Friesen
2002-09-24 21:22 ` Rik van Riel
2002-09-24 21:35 ` Roberto Peon
2002-09-24 21:35 ` Chris Friesen
2002-09-25 19:02 ` David Schwartz
2002-09-24 23:16 ` Peter Waechtler
2002-09-24 23:23 ` Rik van Riel
2002-09-25 19:05 ` David Schwartz
2002-09-23 16:36 Matthias Urlichs
[not found] <987738530@toto.iv>
2002-09-24 2:48 ` Peter Chubb
2002-09-24 3:37 ` Mark Mielke
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=20020920120606.GA4961@gnuppy.monkey.org \
--to=billh@gnuppy.monkey.org \
--cc=drepper@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox