[KLUG Members] 2.6 and NPTL

Peter Buxton members@kalamazoolinux.org
Tue, 4 Nov 2003 04:42:36 -0500


Leafing through dselect today, I noted:

Package: libc6-i686
Maintainer: GNU Libc Maintainers <debian-glibc@lists.debian.org>
Version: 2.3.2.ds1-9
Description: GNU C Library: Shared libraries [i686 optimized]
 Contains the standard libraries that are used by nearly all programs on
 the system. This package includes shared versions of the standard C
 library and the standard math library, as well as many others.

 This set of libraries is optimized for i686 machines, and will only be
 used if you have an i686 class CPU (check the output of `uname -m').  This
 includes Pentium Pro, Pentium II/III, Celeron CPU's and similar class
 CPU's (including clones such as AMD, but not the Via C3).

 This package includes support for NPTL.  The optimized libraries will not
 be used unless you are using a 2.6 kernel.

 WARNING: Some commercial programs may not work well with these libraries.
 Most notably, IBM's JDK. If you experience problems with such
 applications, you will need to remove this package.



Native POSIX Thread Library?!? (Since October 25, apparently.) I
apt-getted and cranked it up. I've been using a self-compiled procps
package, the Robert Love/Andrew Morton version. 'ps afx' doesn't show
threads, adding the 'm' option shows them. Each thread has a PID.

Not anymore:


  PID TTY      STAT   TIME COMMAND
 3300 ?        S      0:13  \_ kdeinit: konsole         
 3302 pts/0    S      0:00  |   \_ /bin/bash
 3349 pts/0    S      1:49  |   |   \_ pan
 3315 pts/1    S      0:00  |   \_ /bin/bash
 3511 pts/1    S      0:00  |   |   \_ mutt

As you can see, Pan (the Pimp-A*s Newsreader) has one PID showing in the
'ps afxm' listing. Now we look in /proc/3349/status:

  Name:	pan
  State:	S (sleeping)
  SleepAVG:	101%
  Tgid:	3349
  Pid:	3349
  PPid:	3302
  TracerPid:	0
  Uid:	1000	1000	1000	1000
  Gid:	1000	1000	1000	1000
  FDSize:	256
  Groups:	1000 4 8 24 25 29 30 40 50 60 65533 
  VmSize:	  118736 kB
  VmLck:	       0 kB
  VmRSS:	   56440 kB
  VmData:	  105680 kB
  VmStk:	     168 kB
  VmExe:	    1140 kB
  VmLib:	    9640 kB
  Threads:	7
  SigPnd:	0000000000000000
  ShdPnd:	0000000000000000
  SigBlk:	0000000000000000
  SigIgn:	8000000000001000
  SigCgt:	0000000080000000
  CapInh:	0000000000000000
  CapPrm:	0000000000000000
  CapEff:	0000000000000000


Note the 'Threads: 7' entry 2/3's down. Pan is working fine. So are
slapd and bind9's named. Neatly, each process showed the old,
one-PID-per-thread listing until restarted, at which point their threads
became invisible to ps. This is a small demonstration of how little
interference the NPTL support in glibc creates.

A small overview of the NPTL features is here:

http://lwn.net/Articles/10465/

And many more details can be learned from its author:

http://people.redhat.com/drepper/

Adam will be interested to note that Ulrich Drepper's NPTL (benefitting
from fellow Red Hatter Ingo Molnar's kernel work) beat out an IBM
project, the NGPT (Next Generation POSIX Threading), for inclusion in
glibc:

http://www-124.ibm.com/pthreads/

-- 
Though nothing is wasted, everything is spent. -- Annie Dillard