linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "J . A . Magallon" <jamagallon@able.es>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Kip Macy <kmacy@netapp.com>,
	ognen@gene.pbi.nrc.ca, linux-kernel@vger.kernel.org
Subject: Re: threading question
Date: Fri, 15 Jun 2001 01:05:57 +0200	[thread overview]
Message-ID: <20010615010557.A3869@werewolf.able.es> (raw)
In-Reply-To: <Pine.GSO.4.10.10106121200330.20809-100000@orbit-fe.eng.netapp.com> <E15Abr6-00057R-00@the-village.bc.nu>
In-Reply-To: <E15Abr6-00057R-00@the-village.bc.nu>; from alan@lxorguk.ukuu.org.uk on Thu, Jun 14, 2001 at 20:28:32 +0200


On 20010614 Alan Cox wrote:
>
>So you have two choices
>1.	Pthread performance is poorer due to library glue
>2.	Every single signal delivery is 20% slower threaded or otherwise due
>	to all the crap that it adds 
>	And it does damage to other calls too.
>

Pthreads are a standard. You say 'use linux native calls, are faster and
make signal management efficient'. But then portability goes to hell. Now
I can run the same code on Linux, Irix and Solaris. Your way, I would
have to write three versions with clone(), sproc() and lwp_xxxx().
Take the example of OpenGL on IRIX boxes. Time ago it was a wrapper over
IrisGL. Now it is native. If you have a notably poor implimentation of
an standard nobody will use your system.

>In the big picture #1 is definitely preferable. 
>
>There are really only two reasons for threaded programming. 
>
>- Poor programmer skills/language expression of event handling
>
>- OS implementation flaws (and yes the posix/sus unix api has some of these)
>
>Co-routines or better language choices are much more efficient ways to express
>the event handling problem.
>
>fork() is often a better approach than pthreads at least for the design of an
>SMP threaded application because unless you explicitly think about what you
>share you will never get the cache affinity you need for good performance.
>

Joking ? That only works if your more complex structure is an array. Try
to get a rendering program with a complex linked lits-tree data structure
for the geometry, materials, textures, etc and
thinking on cache affinity. You can only think about that locally: mmm, I
need a counter for each thread, I would not put them all in an array because
I will trash caches, lets put them in separate variables; need to return
data to a segment of a big array, lets use a local copy and then pass it back.
But no more. Yes, you can change all your malloc() or new for shm's, but
what is the gain ? That is the beauty of shared memory boxes.

What linux needs is a good implementation for POSIX threads. I do not mean
putting pthreads right into the kernel, but perhaps some small change or
addition can make the user space much much faster. There are many apps that
can benefit much from using threads, use a big data segment in ro mode,
and just communicate a bit between them (a threaded web server, a rendering
program).

-- 
J.A. Magallon                           #  Let the source be with you...        
mailto:jamagallon@able.es
Linux Mandrake release 8.1 (Cooker) for i586
Linux werewolf 2.4.5-ac13 #1 SMP Sun Jun 10 21:42:28 CEST 2001 i686

  parent reply	other threads:[~2001-06-14 23:04 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-12 18:24 threading question ognen
2001-06-12 18:39 ` Davide Libenzi
2001-06-12 18:57 ` from dmesg: kernel BUG at inode.c:486 Olivier Sessink
2001-06-12 18:58 ` threading question Christoph Hellwig
2001-06-12 19:07   ` ognen
2001-06-12 19:15     ` Kip Macy
2001-06-12 19:29       ` Christoph Hellwig
2001-06-12 19:15     ` Christoph Hellwig
2001-06-13 12:20     ` Kurt Garloff
2001-06-13 13:35       ` J . A . Magallon
2001-06-13 14:17         ` Philips
2001-06-13 15:06           ` ognen
2001-06-12 21:44   ` Davide Libenzi
2001-06-12 21:48     ` ognen
2001-06-14 18:15       ` Alan Cox
2001-06-14 22:42         ` threading question (results after thread pooling) ognen
2001-06-14 23:00           ` Mike Castle
2001-06-12 21:58     ` threading question Albert D. Cahalan
2001-06-12 23:48       ` J . A . Magallon
2001-06-12 19:06 ` Kip Macy
2001-06-12 19:14   ` Alexander Viro
2001-06-12 19:25     ` Russell Leighton
2001-06-12 23:27       ` Mike Castle
2001-06-13 17:31   ` bert hubert
2001-06-14  6:45     ` Helge Hafting
2001-06-14 18:28   ` Alan Cox
2001-06-14 19:01     ` bert hubert
2001-06-14 19:22       ` Russell Leighton
2001-06-15 11:29       ` Anil Kumar
2001-06-14 23:05     ` J . A . Magallon [this message]
2001-06-16 14:16     ` Michael Rothwell
2001-06-16 15:19       ` Alan Cox
2001-06-16 18:33         ` Russell Leighton
2001-06-16 19:06         ` Michael Rothwell
2001-06-16 21:30           ` Coroutines [was Re: threading question] Russell Leighton
2001-06-12 22:41 ` threading question Pavel Machek
2001-06-13 19:05 Hubertus Franke
     [not found] <fa.f6da6av.agod3u@ifi.uio.no>
     [not found] ` <fa.e54jbkv.kg4r99@ifi.uio.no>
2001-06-16 22:22   ` Dan Maas

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=20010615010557.A3869@werewolf.able.es \
    --to=jamagallon@able.es \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=kmacy@netapp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ognen@gene.pbi.nrc.ca \
    /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;
as well as URLs for NNTP newsgroup(s).