* NPTL [not found] <a9e22dff0707120518q16aeae73p2905226abbadd03d@mail.gmail.com> @ 2007-07-12 12:18 ` Ni@m 2007-07-12 12:27 ` NPTL David Schwartz 0 siblings, 1 reply; 9+ messages in thread From: Ni@m @ 2007-07-12 12:18 UTC (permalink / raw) To: LKML Hi! I have a question about NPTL. Are NPTL are still based on `clone` system call? Are NPTL threads are "processes" internally? Thanks! ^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: NPTL 2007-07-12 12:18 ` NPTL Ni@m @ 2007-07-12 12:27 ` David Schwartz 2007-07-12 12:37 ` NPTL Ni@m 0 siblings, 1 reply; 9+ messages in thread From: David Schwartz @ 2007-07-12 12:27 UTC (permalink / raw) To: LKML > Hi! > I have a question about NPTL. > Are NPTL are still based on `clone` system call? Yes. > Are NPTL threads are > "processes" internally? No. By definition, all the threads belong to a single process. NPTL threads are based on KSEs (kernel scheduling entities). A non-threaded process is also a KSE. A threaded process is more than one KSEs. All KSE are, obviously, scheduled by the kernel. > Thanks! You're welcome. DS ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: NPTL 2007-07-12 12:27 ` NPTL David Schwartz @ 2007-07-12 12:37 ` Ni@m 2007-07-12 12:41 ` NPTL Peter Zijlstra ` (2 more replies) 0 siblings, 3 replies; 9+ messages in thread From: Ni@m @ 2007-07-12 12:37 UTC (permalink / raw) To: davids, LKML So I can say that in linux 'thread' == 'process'? Is kernel routine 'kthread' creating a process? I'm just thinking on this subject: if to create 'real threads' - will it increase performance? Should I ever think in this way? When I say 'real thread' - I mean the thread that doen't switch context when it's starting to run. On 7/12/07, David Schwartz <davids@webmaster.com> wrote: > > > Hi! > > I have a question about NPTL. > > Are NPTL are still based on `clone` system call? > > Yes. > > > Are NPTL threads are > > "processes" internally? > > No. By definition, all the threads belong to a single process. NPTL threads > are based on KSEs (kernel scheduling entities). A non-threaded process is > also a KSE. A threaded process is more than one KSEs. All KSE are, > obviously, scheduled by the kernel. > > > Thanks! > > You're welcome. > > DS > > > - > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: NPTL 2007-07-12 12:37 ` NPTL Ni@m @ 2007-07-12 12:41 ` Peter Zijlstra [not found] ` <a9e22dff0707120557t574f9383g5363c26074ea6d6a@mail.gmail.com> 2007-07-12 12:52 ` NPTL jimmy bahuleyan 2007-07-12 12:58 ` NPTL David Schwartz 2 siblings, 1 reply; 9+ messages in thread From: Peter Zijlstra @ 2007-07-12 12:41 UTC (permalink / raw) To: Ni@m; +Cc: davids, LKML On Thu, 2007-07-12 at 15:37 +0300, Ni@m wrote: > So I can say that in linux 'thread' == 'process'? No, a process also contains an address space. > Is kernel routine 'kthread' creating a process? No, that is creating a schedule unit (task) without an address space. > I'm just thinking on this subject: if to create 'real threads' - will > it increase performance? Should I ever think in this way? > When I say 'real thread' - I mean the thread that doen't switch > context when it's starting to run. Surely you need some context switch when switching between runnable contexts. BTW, please do _NOT_ top post! ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <a9e22dff0707120557t574f9383g5363c26074ea6d6a@mail.gmail.com>]
* Fwd: NPTL [not found] ` <a9e22dff0707120557t574f9383g5363c26074ea6d6a@mail.gmail.com> @ 2007-07-12 12:58 ` Ni@m 2007-07-12 13:16 ` Bernd Petrovitsch 2007-07-12 16:48 ` Lennart Sorensen 0 siblings, 2 replies; 9+ messages in thread From: Ni@m @ 2007-07-12 12:58 UTC (permalink / raw) To: LKML >>BTW, please do _NOT_ top post! sorry >>No, a process also contains an address space. Of course .. I ment they are _almoust_ similar. >>No, that is creating a schedule unit (task) without an address space. Ok, I've already found that in kernel code ... and correctly understood. >>Surely you need some context switch when switching between runnable contexts. Hm. If the thread is running after it's sister or parent process - you do not have to switich the process context. Is this done in kernel?? Sorry if my thought are idiotic .. I'm a newby and trying to investigate the kernel. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Fwd: NPTL 2007-07-12 12:58 ` Fwd: NPTL Ni@m @ 2007-07-12 13:16 ` Bernd Petrovitsch 2007-07-12 16:48 ` Lennart Sorensen 1 sibling, 0 replies; 9+ messages in thread From: Bernd Petrovitsch @ 2007-07-12 13:16 UTC (permalink / raw) To: Ni@m; +Cc: LKML On Thu, 2007-07-12 at 15:58 +0300, Ni@m wrote: [...] > >>No, a process also contains an address space. > Of course .. I ment they are _almoust_ similar. Not really. A process has one or more threads, (virtual) memory, open file descriptors, a uid, a gid and several other resources. Historically there were only "processes". "Threads" were invented later on so there is (usually) some confusion remaining here ..... > >>No, that is creating a schedule unit (task) without an address space. > Ok, I've already found that in kernel code ... and correctly understood. > > >>Surely you need some context switch when switching between runnable > contexts. > Hm. If the thread is running after it's sister or parent process - you > do not have to switich the process context. Is this done in kernel?? "switch process context" is misleading wording - "task switch" is better (and "task" is usually the kernels view on a thread). You have at least to store the registers of the old task somewhere and load the ones from the new task. > Sorry if my thought are idiotic .. I'm a newby and trying to > investigate the kernel. Hmm, you might invest in a book about operating systems to learn the basic concepts. Bernd -- Firmix Software GmbH http://www.firmix.at/ mobil: +43 664 4416156 fax: +43 1 7890849-55 Embedded Linux Development and Services ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Fwd: NPTL 2007-07-12 12:58 ` Fwd: NPTL Ni@m 2007-07-12 13:16 ` Bernd Petrovitsch @ 2007-07-12 16:48 ` Lennart Sorensen 1 sibling, 0 replies; 9+ messages in thread From: Lennart Sorensen @ 2007-07-12 16:48 UTC (permalink / raw) To: Ni@m; +Cc: LKML On Thu, Jul 12, 2007 at 03:58:34PM +0300, Ni@m wrote: > Of course .. I ment they are _almoust_ similar. The lack of an address space seems to make them rather different too. A process contains address space, and one or more threads. A thread is hence a component of a process, but not really similar to a process since it is just part of a process. > Hm. If the thread is running after it's sister or parent process - you > do not have to switich the process context. Is this done in kernel?? You are switching out cpu registers, stack, and such, even though you are not changing address space, so you are doing a context switch. The cpu registers and state is the context. Running multiple threads of a single process in a row can avoid messing with the TLB and other address space related things, but it still switches context. -- Len Sorensen ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: NPTL 2007-07-12 12:37 ` NPTL Ni@m 2007-07-12 12:41 ` NPTL Peter Zijlstra @ 2007-07-12 12:52 ` jimmy bahuleyan 2007-07-12 12:58 ` NPTL David Schwartz 2 siblings, 0 replies; 9+ messages in thread From: jimmy bahuleyan @ 2007-07-12 12:52 UTC (permalink / raw) To: Ni@m; +Cc: davids, LKML Ni@m wrote: > So I can say that in linux 'thread' == 'process'? > No. It's more like, in linux threads are visible to the kernel (unlike in N:1 thread models, linux is 1:1). Threads are the basic unit of scheduling. A process can have >1 threads. > Is kernel routine 'kthread' creating a process? > I'm just thinking on this subject: if to create 'real threads' - will > it increase performance? Should I ever think in this way? > When I say 'real thread' - I mean the thread that doen't switch > context when it's starting to run. > What do you mean by context? Each thread has it's own stack, registers, etc. which form it's context. A process has more info like file descriptors, IPC resources, virtual memory info. Between scheduling threads of the same process these stay same. -jb -- Tact is the art of making a point without making an enemy. ^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: NPTL 2007-07-12 12:37 ` NPTL Ni@m 2007-07-12 12:41 ` NPTL Peter Zijlstra 2007-07-12 12:52 ` NPTL jimmy bahuleyan @ 2007-07-12 12:58 ` David Schwartz 2 siblings, 0 replies; 9+ messages in thread From: David Schwartz @ 2007-07-12 12:58 UTC (permalink / raw) To: LKML > So I can say that in linux 'thread' == 'process'? No. A process can have any number of threads. > Is kernel routine 'kthread' creating a process? No, since a process can have more than one thread. > I'm just thinking on this subject: if to create 'real threads' - will > it increase performance? Should I ever think in this way? > When I say 'real thread' - I mean the thread that doen't switch > context when it's starting to run. I don't follow. The kernel sometimes calls a KSE a 'process'. This is largely a legacy from when there was a one-to-one correspondence between KSEs and processes. However, this is no longer the case. In Linux, 'KSE' == 'thread'. DS ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2007-07-12 16:48 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <a9e22dff0707120518q16aeae73p2905226abbadd03d@mail.gmail.com>
2007-07-12 12:18 ` NPTL Ni@m
2007-07-12 12:27 ` NPTL David Schwartz
2007-07-12 12:37 ` NPTL Ni@m
2007-07-12 12:41 ` NPTL Peter Zijlstra
[not found] ` <a9e22dff0707120557t574f9383g5363c26074ea6d6a@mail.gmail.com>
2007-07-12 12:58 ` Fwd: NPTL Ni@m
2007-07-12 13:16 ` Bernd Petrovitsch
2007-07-12 16:48 ` Lennart Sorensen
2007-07-12 12:52 ` NPTL jimmy bahuleyan
2007-07-12 12:58 ` NPTL David Schwartz
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®