Re: thread awareness of the scheduler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Please, next time use a sane quoting! The quoted text should be
prepended with quoting characters, not the replies.

On Wed, Oct 13, 2004 at 21:36:57 +0530, Nilanjan Roychowdhury wrote:
> -----Original Message-----
> From: Jan Hudec [mailto:bulb@xxxxxxxxxxxxxxxxxx] On Behalf Of Jan Hudec
> Sent: Wednesday, October 13, 2004 6:42 PM
> To: matrix reloaded
> Cc: Anupam Kapoor; kernel; Nilanjan Roychowdhury
> Subject: Re: thread awareness of the scheduler
> 
> 1) Kernel can't replace kernel-threads with user-threads. Libc (since
>    libpthreads are part of it) can do it.
> 
> >>> you mean to say that NPTL does this M on N mapping ??? 

I say, that NPTL is a user-land stuff. Thus the switch couldn't depend
on kernel. But kernel can provide new API that makes the features
possible. It does so.

As I found from brief search on the internet, there is *NO* M-on-N
mapping going on! The NTPL seems to be mapping threads to processes
1-on-1! The difference is, that clone(2) was extended to allow all these
processes to have the same pid and thus show up as a single entry in
/proc. Since /proc is what ps uses to show the processes, it shows the
threaded application as a single process.

> 2) User-threads are mostly useless. When one thread blocks, the whole
>    process does. And it can't be run in parallel on SMP.
> >>> r u sure this happens in 2.4.20 + kernels ??? it looks like in
> 2.4.18 the things are different.

Here I was saying that I don't believe NTPL uses user-level threads. No,
it does not use them.

The difference that came with kernel is, that "thread groups" (that show
up as a signle process) and some other API to simplify posix thread
library were implemented. NTPL then took advantage of these new
features.

> 3) There is another thing kernel can do -- it can change semantics of
>    /proc to be by-pid and not by-tid. While each thread has different
>    tid, it has the same pid (pthreads want it). If ps does not see tids,
>    it can't show them...
> 
> >>> This is what NPTL doc says...now in /proc it is PID not TID.

Yes. And it is the *SOLE* reason for the difference in ps output. Well,
in fact, the manager thread is also gone and some ABI is being used so
it's all faster. But the basic principle -- that each thread is
a process -- has not changed.

-------------------------------------------------------------------------------
						 Jan 'Bulb' Hudec <bulb@xxxxxx>

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux