I think, therefore I blog

How To Enable Native POSIX Threads on Debian Sarge

By , 4 April 2008

How To Enable Native POSIX Threads on Debian Sarge

Ja, okej, so Sarge is getting a bit ancient but in the 3 years we've been running our server we've only had to reboot once to install a new kernel, so I'm not in a big hurry to upgrade. I did notice today though, while assessing the performance of the server, that our Java app server is spawning one process per thread. And here I was thinking that Java supported native kernel threads. Well, actually it does. My surprise was that, until fairly recently, it was Linux that didn't support kernel threads.

We were using the LinuxThreads library which creates user threads mapped to Linux processes with a shared memory space. The latest way to do threading is with the Native POSIX Thread Library (NPTL) which creates real kernel lightweight processes (LWPs). It needed Linux 2.6 which we had, but despite reading reports of people using it on Sarge, I couldn't find any articles explaining how to switch from LinuxThreads to NPTL.

So... I thought I'd better write one. It's not too hard:

How To Enable Native POSIX Threads on Debian Sarge

1. Figure out what threading system you are using:


2. Check that you have a 2.6 kernel:

mong:/# cat /proc/version
Linux version 2.6.8 (root@mong) (gcc version 3.3.5 (Debian 1:3.3.5-13)) #1 Wed Jan 17 15:16:19 EST 2007

3. And the libc6-* package for your architecture, which is built for NPTL:

mong:/# uname -m
mong:/# apt-get install libc6-i686

4. Kick-start NPTL (presumably this wouldn't be necessary if you could reboot):

mong:~# export LD_LIBRARY_PATH=/lib/tls/i686/cmov/ 
mong:~# ldconfig

5. Recheck your setup and restart your apps:

NPTL 0.60
mong:~# /etc/init.d/myapp restart

Et voila, no more pesky heavyweight threads!


About Roger Keays

How To Enable Native POSIX Threads on Debian Sarge

Roger Keays is an artist, an engineer, and a student of life. Since he left Australia in 2009, he has been living as a digital nomad in over 40 different countries around the world. Roger is addicted to surfing. His other interests are music, psychology, languages, and finding good food. Click here to subscribe to his weekly blog, or stalk him on Facebook and Twitter.

Leave a Comment

Please visit https://RogerKeays.com/blog/how-to-enable-native-posix-threads-on-debian-sarge to add your comments.

Join Over 1000 Subscribers

I write every Sunday about travel, psychology, and technology. Thousands of people just like you have already subscribed—and for good reason. It'll change your life. And it's free :)

Read a Good Book

“A spellbinding true story of love, passion and adventure. One can’t help but be swept away by 100% Love Guaranteed.” —Dr Tammie Matson, author of Elephant Dance.

Chat For A While

Your Vote Matters

Which animal will take over when humans go extinct?