From: Larry McVoy <lm@bitmover.com>
To: Gregory Maxwell <greg@linuxpower.cx>
Cc: Michael Rothwell <rothwell@holly-springs.nc.us>,
linux-kernel@vger.kernel.org
Subject: Re: high load & poor interactivity on fast thread creation
Date: Wed, 27 Dec 2000 09:32:36 -0800 [thread overview]
Message-ID: <20001227093236.A1409@work.bitmover.com> (raw)
In-Reply-To: <3A266895.F522A0E2@austin.ibm.com> <20001130081443.A8118@bach.iverlek.kotnet.org> <3A266895.F522A0E2@austin.ibm.com> <4.3.2.7.2.20001227110018.00e5ba90@cam-pop.cambridge.arm.com> <3A4A22A8.D434B7F@holly-springs.nc.us> <20001227122508.A29579@xi.linuxpower.cx>
In-Reply-To: <20001227122508.A29579@xi.linuxpower.cx>
Great post. Rob Pike said it best, if you are trying to distill it down
to one sentence, when he said
"If you think you need threads, you processes are too fat"
Stevel Kleiman had a somewhat more cryptic comment (somewhat is an
understatement, it took me years to let it sink in) in reference to
a popular DB technology from a west coast University:
"They didn't use mmap"
I don't have anything as catchy, but for years I've felt that plain old
processes combined with mmap give you all the sharing you need. You do
pay a price for not sharing TLB entries if the OS is stupid (Linux' is
not).
On Wed, Dec 27, 2000 at 12:25:09PM -0500, Gregory Maxwell wrote:
> On Wed, Dec 27, 2000 at 12:11:04PM -0500, Michael Rothwell wrote:
> [snip]
> > One notable difference between Linux and NT threads and processes is
> > that it is more expensive to create new processes on NT than on Linux,
> > and on NT thread creation is cheaper than process creation. Typically
> > Windows programs use multiple threads rather than multiple processes,
> > whereas on Unix the reverse is true.
>
> This is the meaty difference. Under Linux, full *process* operations
> are faster then NT *thread* operations. The Linux 'threads' (lightweight
> processes) are somewhat faster then unlightweight processes, but nowhere
> near the magnitude of difference that NT experiences.
>
> Because of this, lightweight processes are used differently under Linux: They
> are treated just like processes and can share variable amounts of state with
> other processes.
>
> In Linux, you use threads when it makes sense to code with threads. You can
> share as little or as much makes sense with your design. You almost never use
> threads for performance reasons, because regular processes are so fast that
> it seldom makes sense to use threads for performance (they can be faster but
> usually the additional development/debugging difficulty makes it a non-issue).
>
> In Windows NT, you MUST use threads for decent performance in many places
> where processes (or other different semi-lightweight structures) might make
> more sense. Threads are the largest construction capable of really good
> performance, so you don't have the flexibility to chose what you share:
> What is shared is not a programming design decision but an OS performance
> decision.
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> Please read the FAQ at http://www.tux.org/lkml/
--
---
Larry McVoy lm at bitmover.com http://www.bitmover.com/lm
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
next prev parent reply other threads:[~2000-12-27 18:03 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-11-30 7:14 high load & poor interactivity on fast thread creation Arnaud Installe
2000-11-30 14:47 ` Ray Bryant
2000-11-30 16:11 ` Arnaud Installe
2000-11-30 16:37 ` James A Sutherland
2000-12-27 11:01 ` Ruth Ivimey-Cook
2000-12-27 17:11 ` Michael Rothwell
2000-12-27 17:25 ` Gregory Maxwell
2000-12-27 17:32 ` Larry McVoy [this message]
2000-12-27 19:43 ` Andrea Arcangeli
2000-11-30 16:12 ` Alan Cox
2000-11-30 23:00 ` David Lang
2000-12-01 9:47 ` Arnaud Installe
2000-12-01 21:20 ` David Lang
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=20001227093236.A1409@work.bitmover.com \
--to=lm@bitmover.com \
--cc=greg@linuxpower.cx \
--cc=linux-kernel@vger.kernel.org \
--cc=rothwell@holly-springs.nc.us \
/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