public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Mielke <mark@mark.mielke.cc>
To: Peter Chubb <peter@chubb.wattle.id.au>
Cc: "Peter Wächtler" <pwaechtler@mac.com>,
	"Ingo Molnar" <mingo@elte.hu>, "Larry McVoy" <lm@bitmover.com>,
	"Bill Davidsen" <davidsen@tmr.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [ANNOUNCE] Native POSIX Thread Library 0.1
Date: Mon, 23 Sep 2002 23:37:14 -0400	[thread overview]
Message-ID: <20020923233714.B2880@mark.mielke.cc> (raw)
In-Reply-To: <15759.53896.973330.270617@wombat.chubb.wattle.id.au>; from peter@chubb.wattle.id.au on Tue, Sep 24, 2002 at 12:48:40PM +1000

On Tue, Sep 24, 2002 at 12:48:40PM +1000, Peter Chubb wrote:
> >>>>> "Mark" == Mark Mielke <mark@mark.mielke.cc> writes:
> Mark>     OS threads: 1) thread#1 invokes a system call 2) OS switches
> Mark> tasks to thread#2 and returns from blocking
> Mark>     user-space threads: 1) thread#1 invokes a system call 2)
> Mark> thread#1 returns from system call, EWOULDBLOCK 3) thread#1
> Mark> invokes poll(), select(), ioctl() to determine state 4) thread#1
> Mark> returns from system call 5) thread#1 switches stack pointer to
> Mark> be thread#2 upon determination that the resource thread#2 was
> Mark> waiting on is ready.
> No way!  THe Solaris M:N model notices when all threads belonging to a
> process have blocked, and wakes up the master thread, which can then
> create a new kernel thread if there are any user-mode threads that can
> do work.

As I said, far from accurate, and M:N is really a compromise between
the two approaches, it is not an extreme.

M:N really doesn't mean much at all except that it makes no guarantees
that each thread requires an OS thread, or that only one thread will
be active at any given time.

M:N makes no promises to be faster, although, as with any innovation
designed by engineers who take pride in their work, it is a method of
achieving a goal... that is, getting around costly system invocations
by optimizing system invocations in user space. Is it better? Maybe? 
Has it traditionally allowed standard applications that make use of
threads to perform better than if the application used only kernel
threads? Yes.

Can the rules be broken? I have not seen a single reason to show why
they cannot be broken. M:N is a necessity for kernels that have heavy
weight thread synchronization primitives, or heavy weight context
switching. Are the rules the same with thread synchronization primitives
that have the similar weight whether 1:1 or M:N? (i.e. FUTEX) Are the
rules the same if context switching in kernel space can be made cheaper,
if the scheduling issues can be addressed, or if M:N must rely on just as
many kernel invocations?

Is M:N really cheaper in your Solaris example, where a new thread is
created by the master thread on demand? If threads were sufficiently
light-weight, I do not see how you could consider a master thread
sitting on SIGIO/select()/poll()/ioctl() switching to a thread in the
pool could be cheaper than the kernel pulling a stopped thread into
the run queue.

This is one of those things where the 'proof is in the pudding'. It is
difficult to theorize anything as almost all theory on this subject is
based on comparing performance under a different set of rules. M:N was
necessary before as 1:1 was not feasible. Now that 1:1 may be reaching
the state of being feasible, the rules change, and previous attempts
at analyzing the data mean very little. Previous conclusions mean very
little.

I am one who wants to see what happens. Worst case, M:N
implementations can use the same enhancements that were designed for
1:1, and benefit. The most obviously example, that needs to be
mentioned once again, is FUTEX. By each application, it might benefit
1:1, or M:N, but as a kernel feature, it benefits anybody who can
invent a use for it.

Fast thread switching? This provides a benefit for M:N. In fact, I would
suspect that the people comparing the best 1:1 implementation with the best
M:N implementation will find that once all the patches are applied, the
race will be closer than most people thought, but that BOTH will perform
better on 2.5.x than either ever did on 2.4.x and earlier.

mark

-- 
mark@mielke.cc/markm@ncf.ca/markm@nortelnetworks.com __________________________
.  .  _  ._  . .   .__    .  . ._. .__ .   . . .__  | Neighbourhood Coder
|\/| |_| |_| |/    |_     |\/|  |  |_  |   |/  |_   | 
|  | | | | \ | \   |__ .  |  | .|. |__ |__ | \ |__  | Ottawa, Ontario, Canada

  One ring to rule them all, one ring to find them, one ring to bring them all
                       and in the darkness bind them...

                           http://mark.mielke.cc/


  reply	other threads:[~2002-09-24  3:34 UTC|newest]

Thread overview: 112+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <987738530@toto.iv>
2002-09-24  2:48 ` [ANNOUNCE] Native POSIX Thread Library 0.1 Peter Chubb
2002-09-24  3:37   ` Mark Mielke [this message]
2002-09-23 16:36 Matthias Urlichs
  -- strict thread matches above, loose matches on Subject: below --
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-20  7:46 Joerg Pommnitz
2002-09-20  0:41 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  9:53 ` 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
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

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=20020923233714.B2880@mark.mielke.cc \
    --to=mark@mark.mielke.cc \
    --cc=davidsen@tmr.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lm@bitmover.com \
    --cc=mingo@elte.hu \
    --cc=peter@chubb.wattle.id.au \
    --cc=pwaechtler@mac.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox