public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rob Landley <landley@webofficenow.com>
To: "J . A . Magallon" <jamagallon@able.es>, landley@webofficenow.com
Cc: "J . A . Magallon" <jamagallon@able.es>,
	landley@webofficenow.com,
	Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>,
	Timur Tabi <ttabi@interactivesi.com>,
	"linux-kernel @ vger . kernel . org"
	<linux-kernel@vger.kernel.org>
Subject: Re: Alan Cox quote? (was: Re: accounting for threads)
Date: Sun, 24 Jun 2001 14:21:12 -0400	[thread overview]
Message-ID: <01062414211303.03436@localhost.localdomain> (raw)
In-Reply-To: <Pine.LNX.3.96.1010622162213.32091B-100000@artax.karlin.mff.cuni.cz> <01062412555901.03436@localhost.localdomain> <20010625003002.A1767@werewolf.able.es>
In-Reply-To: <20010625003002.A1767@werewolf.able.es>

On Sunday 24 June 2001 18:30, J . A . Magallon wrote:

> Take a programmer comming from other system to linux. If he wants multi-
> threading and protable code, he will choose pthreads. And you say to him:
> do it with 'clone', it is better. Answer: non protable. Again: do it
> with fork(), it is fast in linux. Answer: better for linux, but it is a
> real pain in other systems.

So we should be as bad as other systems?  I'm trying to figure out what 
you're saying here...

> And worst, you are allowing people to program based on a tool that will
> give VERY diferent performance when ported to other systems. They use
> fork(). They port their app to solaris. The performance sucks. It is not
> Solaris fault. It is linux fast fork() that makes people not looking for
> the correct standard tool for what they want todo.

Hang on, the fact the LInux implementation of something is 10x faster than 
somebody else's brain damaged implementation is Linux's fault?

On Linux, there is no real difference between threads and processes.  On some 
other systems, there is unnecessary overhead for processes.  "Threads" are 
from a programming perspective multiple points of execution that share an 
awful lot of state.  Which basically, processes can be if you tell them to 
share this state.

>From a system perspective threads are a hack to avoid a lot of the overhead 
processes have poisoning caches and setting up and tearing down page tables 
and such.  Linux processes don't have this level of overhead.

So -ON LINUX- there isn't much difference between threads and processes.  
Because the process overhead threads try to avoid has been optimized away, 
and thus there is a real world implementation of the two concepts which 
behaves in an extremely similar manner.  Thus the conceptual difference 
between the two is mostly either artificial or irrelevant, certainly in this 
context.  If there is a context without this difference, then in other 
contexts it would appear to be an artifact of implementation.

On Solaris there is a difference between threads and processes, but the 
reason is that Solaris' processes are inefficient (and shown by the 
benchmarks you don't seem to like).

> Instead of trying to enhance linux thread support, you try to move
> programmes to use linux 'specialities'.

No, I'm saying Linux processes right now have 90% of the features of thread 
support as is, and the remaining differences are mostly semantic.  It would 
be fairly easy to take an API like the OS/2 threading model and put it on 
Linux.  From what I remember of the OS/2 threading model, we're talking about 
a couple hours worth of work.

Adding support for the Posix model is harder, but from what I've seen of the 
Posix model this is because it's evil and requires a lot of things that don't 
really have much to do with the concept of threading.

I will admit that Linux (or the traditional unix programming model) has some 
things that don't mesh well with the abstract thread programming model.  
Signals, for example.  But since the traditional abstract threads model 
doesn't try to handle signals at ALL that I am aware of (OS/2 didn't, Dunno 
about NT.  Posix has some strange duct-tape solution I'm not entirely 
familiar with...  In java you can kill or suspend a thread which is 
IMPLEMENTED with signals but conceptually discrete...)

> >> That is comparing apples and oranges.
> >
> >Show me a real-world program that makes the distinction you're making.
> >Something in actual use.
>
> shell scripting, for example.

You've done multi-threaded shell scripting?  I tried to use bash with 
multiple processes and ran into the fact that $$ always gives the root 
process's PID, and nobody had ever apparently decided that this was dumb 
behavior...

> Or multithreaded web servers.

Apache has a thread pool, you know.  Keeps the suckers around...

> With the above
> test (fork() + immediate exec()), you just try to mesaure the speed of
> fork(). Say you have a fork'ing server. On each connection you fork and
> exec the real transfer program.

Like a CGI script, you mean?  Not using mod_perl or mode_php but shelling out?

And you're worried about performance?

> There time for fork matters. It can run
> very fast in Linux but suck in other systems.

And this is linux's problem, is it?

> Just because the programmer
> chose fork() instead of vfork().

So "#define fork vfork" would not be part of the "#ifdef slowaris" block then?

I'm still a bit unclear about what the behavior differences of them actualy 
are.  I believe vfork is the hack that goes really funny if you DON'T exec 
immediately after calling it.  Yet the argument here was about THREADS, which 
don't DO that.  So the entire discussion is a red herring.  If you're going 
to fork and then exec, you're not having multiple points of execution in the 
same program.

Linux can do this efficiently on a process level because its fork is 
efficient (and it has clone() which allows more control over what gets shared 
between processes.)  Solaris makes an artificial distinction between 
processes and threads because A) its fork implementation sucks, B) it doesn't 
allow granualr control over what gets shared between processes.

How does any of this point to a deficiency in Linux rather than Solaris?  
(Don't give me "standards", there's an official standard for EBCDIC.)

> >> The clean battle should be linux fork-exec vs vfork-exec in
> >> Solaris, because for in linux is really a vfork in solaris.
> >
> >But the point of threading is it's a fork WITHOUT an exec.
>
> Not always, see above.

Does "vfork" without "exec" work reliably?  Anybody wanna clear this up?

> >I'm not going to comment on the difference between fork and vfork becaue
> > to be honest I've forgotten what the difference is.  Something to do with
>
> Time.

You are clearly oversimplifying or else "fork" wouldn't exist.  Even Sun 
isn't going to put in an intentionally slower API that's otherwise 
functionally identical to another API.  If nothing else they'd implement one 
as a wrapper that calls the other with the arguments converted.

Rob

  reply	other threads:[~2001-06-25  1:24 UTC|newest]

Thread overview: 156+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-19 14:53 accounting for threads Dan Kegel
2001-06-19 14:57 ` J . A . Magallon
2001-06-19 15:44 ` ognen
2001-06-19 15:58   ` Alan Cox quote? (was: Re: accounting for threads) Dan Kegel
2001-06-19 16:02     ` David S. Miller
2001-06-19 16:12       ` Padraig Brady
2001-06-19 19:10       ` bert hubert
2001-06-19 19:18         ` Alan Cox
2001-06-19 19:32           ` bert hubert
2001-06-19 19:43           ` Alexander Viro
2001-06-20 15:22           ` Jes Sorensen
2001-06-20 15:33             ` Alexander Viro
2001-06-20 15:59               ` Threads are processes that share more bert hubert
2001-06-20 16:15                 ` Alexander Viro
2001-06-20 18:48                 ` Martin Devera
2001-06-20 19:19                   ` Unknown PCI Net Device Greg Ingram
2001-06-20 22:53                     ` Andreas Dilger
2001-06-20 22:56                       ` Jeff Garzik
2001-06-20 23:00                       ` Alan Cox
2001-06-20 22:08                 ` Threads are processes that share more Stephen Satchell
2001-06-20 22:14                   ` ognen
2001-06-20 23:10                   ` J . A . Magallon
2001-06-24 23:47                     ` Larry McVoy
2001-06-25  2:23                       ` David S. Miller
2001-06-20 16:39               ` Alan Cox quote? (was: Re: accounting for threads) george anzinger
2001-06-20 18:35                 ` Alexander Viro
2001-06-21  4:11                   ` Rusty Russell
2001-06-21 23:37                     ` Alexander Viro
2001-06-21 23:55                       ` Alexander Viro
2001-06-22 14:53                         ` Richard Gooch
2001-06-20 16:40               ` Jes Sorensen
2001-06-20 20:09               ` Rob Landley
2001-06-20 19:05           ` Victor Yodaiken
2001-06-20 14:35         ` Mike Porter
2001-06-20 11:56           ` Rob Landley
2001-06-19 16:02     ` Ben Pfaff
2001-06-19 16:09     ` Larry McVoy
2001-06-19 16:26       ` Matthew Kirkwood
2001-06-19 16:52         ` Larry McVoy
2001-06-19 18:18           ` Rob Landley
2001-06-19 23:31           ` Timur Tabi
2001-06-20 11:52             ` Rob Landley
2001-06-20 21:20               ` Albert D. Cahalan
2001-06-20 18:12                 ` Rob Landley
2001-06-20 23:28                   ` Dan Podeanu
2001-06-21  0:42                   ` D. Stimits
2001-06-20 20:18                     ` Rob Landley
2001-06-21  1:57                       ` D. Stimits
2001-06-21 14:46                         ` Idea: Patches-from-linus mailing list? (Was Re: Alan Cox quote? (was: Re: accounting for threads)) Rob Landley
2001-06-21 14:02                   ` Alan Cox quote? (was: Re: accounting for threads) Jesse Pollard
2001-06-21 14:18                     ` Rob Landley
2001-06-22 14:46               ` Mikulas Patocka
2001-06-22 13:29                 ` Rob Landley
2001-06-24 21:41                   ` J . A . Magallon
2001-06-24 16:55                     ` Rob Landley
2001-06-24 22:30                       ` J . A . Magallon
2001-06-24 18:21                         ` Rob Landley [this message]
2001-06-25 13:48                           ` J . A . Magallon
2001-06-24 22:39                         ` Steven Walter
2001-06-24 23:50                         ` Larry McVoy
2001-06-24 20:24                           ` Rob Landley
2001-06-25  0:05                           ` J . A . Magallon
2001-06-25  0:32                             ` Gerhard Mack
2001-06-25  0:59                               ` Davide Libenzi
2001-06-25  2:18                         ` Galen Hancock
2001-06-20 14:59             ` Matthias Urlichs
2001-06-20 19:14           ` Victor Yodaiken
2001-06-20 21:01           ` RE:Why use threads ( was: Alan Cox quote?) David Schwartz
2001-06-20 21:26             ` Why " Victor Yodaiken
2001-06-20 22:18               ` David Schwartz
2001-06-20 22:41                 ` Davide Libenzi
2001-06-20 22:47                   ` [OT] " Jeff Garzik
2001-06-21  0:21                   ` David Schwartz
2001-06-21  0:56                     ` Davide Libenzi
2001-06-21  1:32                       ` David Schwartz
2001-06-21  2:22                         ` Davide Libenzi
2001-06-21  2:43                           ` David Schwartz
2001-06-21 16:10                             ` Davide Libenzi
2001-06-21 19:55                               ` Marco Colombo
2001-06-20 22:43                 ` Mike Castle
2001-06-21  1:43                   ` David Schwartz
2001-06-19 17:10       ` Alan Cox quote? (was: Re: accounting for threads) Matti Aarnio
2001-06-19 17:20       ` Mike Castle
2001-06-19 17:37         ` Larry McVoy
2001-06-19 17:45           ` Mike Castle
2001-06-19 18:08             ` Georg Nikodym
2001-06-19 19:38               ` Georg Nikodym
2001-06-19 19:56                 ` Michael Meissner
2001-06-19 17:53           ` Steve Underwood
2001-06-19 19:01             ` Alan Cox
2001-06-20  2:57               ` Michael Rothwell
2001-06-20  3:04                 ` Larry McVoy
2001-06-20  3:38                   ` John R Lenton
2001-06-20 10:21                   ` john slee
2001-06-20 18:08                     ` Larry McVoy
2001-06-20 16:21                   ` Davide Libenzi
2001-06-20  9:14                 ` Alan Cox
2001-06-22  2:36                   ` Michael Rothwell
2001-06-19 17:36       ` Jonathan Lundell
2001-06-19 17:41         ` Larry McVoy
2001-06-19 20:57         ` David S. Miller
2001-06-19 21:11           ` Jonathan Lundell
2001-06-19 21:15             ` David S. Miller
2001-06-19 23:56               ` Jonathan Lundell
2001-06-20  0:19                 ` Mike Castle
2001-06-20  0:28                   ` Larry McVoy
2001-06-20  1:30                     ` Ben Greear
2001-06-20  2:14                       ` Mike Castle
2001-06-20  9:00                     ` Henning P. Schmiedehausen
2001-06-20 11:25                       ` [OT] Threads, inelegance, and Java Aaron Lehmann
2001-06-20 11:25                         ` Rob Landley
2001-06-20 17:36                           ` Martin Dalecki
2001-06-20 19:27                             ` Mike Harrold
2001-06-20 17:46                               ` Rob Landley
2001-06-20 19:53                               ` Martin Dalecki
2001-06-20 17:53                                 ` Rob Landley
2001-06-21  7:45                                   ` Albert D. Cahalan
     [not found]                               ` <mailman.993067219.29993.linux-kernel2news@redhat.com>
2001-06-20 20:16                                 ` Pete Zaitcev
2001-06-20 22:05                                   ` Alan Cox
     [not found]                           ` <20010621000725.A24672@werewolf.able.es>
2001-06-20 19:15                             ` Rob Landley
2001-06-21  9:40                               ` Jonathan Morton
     [not found]                             ` <mailman.993083762.1429.linux-kernel2news@redhat.com>
2001-06-21  3:13                               ` Pete Zaitcev
2001-06-21 13:59                                 ` Rob Landley
2001-06-21 16:48                           ` Adam Sampson
2001-06-20 15:12                         ` Ben Greear
2001-06-20 15:44                           ` Russell Leighton
2001-06-20 16:32                             ` Davide Libenzi
2001-06-20 16:54                               ` Russell Leighton
2001-06-20 17:03                               ` Tony Hoyle
2001-06-20 15:10                                 ` Rob Landley
2001-06-20 20:23                                   ` Tony Hoyle
2001-06-21  8:12                                     ` Henning P. Schmiedehausen
2001-06-20 20:40                                   ` Richard B. Johnson
2001-06-20 20:48                                     ` Tony Hoyle
2001-06-20 21:00                                     ` Daniel Phillips
2001-06-20 21:06                                       ` Richard B. Johnson
2001-06-20 18:14                               ` Henning P. Schmiedehausen
2001-06-20 16:53                           ` Larry McVoy
2001-06-20 12:36                             ` Rob Landley
2001-06-20 21:14                           ` Aaron Lehmann
2001-06-20 18:09                         ` Henning P. Schmiedehausen
2001-06-20 19:05                         ` William T Wilson
2001-06-20  0:04           ` Alan Cox quote? (was: Re: accounting for threads) Chris Ricker
2001-06-20  0:59             ` Robert Love
2001-06-19 18:01       ` Alan Cox quote? Kai Henningsen
2001-06-19 18:49         ` Larry McVoy
2001-06-19 21:12           ` Richard Gooch
2001-06-19 22:50             ` Henning P. Schmiedehausen
2001-06-19 20:12         ` Henning P. Schmiedehausen
  -- strict thread matches above, loose matches on Subject: below --
2001-06-19 19:48 Alan Cox quote? (was: Re: accounting for threads) Joerg Pommnitz
2001-06-19 19:59 ` Alexander Viro
2001-06-20 19:36 Rok Papež
2001-06-20 20:16 ` Cort Dougan
2001-06-22  5:19 Chester Lott
     [not found] <Pine.GSO.4.21.0106211931180.209-100000@weyl.math.psu.edu.suse.lists.linux.kernel>
2001-06-22  7:33 ` Andi Kleen
2001-06-30  9:16 Jan Hudec

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=01062414211303.03436@localhost.localdomain \
    --to=landley@webofficenow.com \
    --cc=jamagallon@able.es \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikulas@artax.karlin.mff.cuni.cz \
    --cc=ttabi@interactivesi.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