[lkml]   [2000]   [Aug]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: SCO: "thread creation is about a thousand times faster than onnative
Linus Torvalds wrote:
> > I would not call 8K/16K overhead "lightweight" treading.
> Oh, and pray tell how much you expect a kernel thread to take?

A stack page is _not_ required for a kernel thread, except when that
thread is blocked. A sleeping but runnable task doesn't require a stack.

That leaves approximately sizeof (struct task_struct).

(Similar optimisations are possible in user space).

> The memory overhead is negligible. An app that thinks that 16kB/thread is
> too much, should not be using kernel threads in the first place. You could
> argue that it probably shouldn't be using threads at _all_.

The alternative is user space lightweight threads which as we know can
be very light indeed - comparable with procedure calls and event loops.

Unfortunately, with Linux, you lose the possibility to do system calls
from those kind of threads without blocking the other threads. Hacks
involving timer signals can work around this but at some performance

So you have to choose -- system calls, or lightweight threads?

There's a nice way to get the best features of both. Simply: when a
kernel thread blocks (reading from disk or whatever), wake up another
kernel thread. User space can handle the rest. I think this was called
"scheduler activations" or something like that.

-- Jamie
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

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