lkml.org 
[lkml]   [1999]   [Jul]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: kernel thread support - LWP's
IMHO there are three common usages for multiple threads in a program,
and only one of them really wants kernel threads.

a) asynchronous IO - what you really want is *asynchronous IO*, not
threads emulating asynchronous IO. The thread overhead is unnecessary
expensive for AIO (thread creation/destruction, thread stack allocation,
etc.).

b) using SMP features within a parallelized app - yes, threads are a
good idea here.

c) parallel programming languages such as VHDL, which support parallel
execution blocks. It turns out that the locking overhead of using real
threads (especially on SMP) is much higher than the gain - use a
cooperative user-level approach instead. These blocks do very little
work (e.g. assign a variable with a simple statement), and often all
active blocks fit into the cache, avoiding the context switch refill
Larry mentioned. Since there is no/little local state on the stack or in
registers to preserve when switching from one block to the other, the
user-level approach is much much faster. I've compared a Solaris thread
implementation of such a hardware simulation with a complete user-level
approach, and the latter was 3 to 5 times faster *overall* (including
the actual simulation work).

--
Bernd Paysan


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:53    [W:0.037 / U:0.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site