- Are LinuxThreads real kernel-level threads?
- Posted by Rich H on January 4th, 2004
I understand a call to pthread_create() is actually a clone() wrapper.
According to man pages for clone (Linux 2.4.18) - a clone call creates a new
process.
So, my understanding of LinuxThreads is that there is no support for actual
kernel-level or user-level threads,,,,,,right?
Thanks for your time
Rich
- Posted by Willem on January 4th, 2004
Rich wrote:
) I understand a call to pthread_create() is actually a clone() wrapper.
) According to man pages for clone (Linux 2.4.18) - a clone call creates a new
) process.
)
) So, my understanding of LinuxThreads is that there is no support for actual
) kernel-level or user-level threads,,,,,,right?
A clone call creates a new process that shares parts of its execution
process. Or, in other words, a thread.
The manual page for clone(2) also mentions the follosing:
--
The main use of clone is to implement threads: multiple threads of control
in a program that run concurrently in a shared memory space.
--
Does that answer your question ?
SaSW, Willem
--
Disclaimer: I am in no way responsible for any of the statements
made in the above text. For all I know I might be
drugged or something..
No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT
- Posted by Robert Wessel on January 6th, 2004
"Rich H" <mynewsmail@datasystemsintegration.com> wrote in message news:<P0YJb.731209$HS4.5485975@attbi_s01>...
In Linux, threads are somewhat hybrid creatures from a kernel
perspective. While threads do share a single address space, they are
implemented at the lowest level by separate kernel "processes."
Specifically, clone2() gets called with a CLONE_VM flag to create a
thread.
In most respects this structure makes little or no difference to the
application. The argument has been made that thread *creation* (not
use or switching) is slightly more expensive on Linux than on a *nix
with "proper" kernel thread support, but the difference is modest at
best, and most applications only rarely create threads anyway.
On a more practical matter, this structure does create some oddities
when you query the OS for lists of running processes.