Questions tagged [nptl]

The Native POSIX Thread Library (NPTL) is a software feature that enables the Linux kernel to run programs written to use POSIX Threads efficiently.

29 questions
31
votes
3 answers

What is the difference between NPTL and POSIX threads?

What is the basic difference between NPTL and POSIX threads? How have these two evolved?
Whoami
  • 13,930
  • 19
  • 84
  • 140
22
votes
3 answers

Java I/O vs. Java new I/O (NIO) with Linux NPTL

My webservers use the usual Java I/O with thread per connection mechanism. Nowadays, they are getting on their knees with increased user (long polling connection). However, the connections are mostly idle. While this can be solved by adding more…
Sajid
  • 891
  • 2
  • 13
  • 24
5
votes
4 answers

NPTL caps maximum threads at 65528?

The following code is supposed to make 100,000 threads: /* compile with: gcc -lpthread -o thread-limit thread-limit.c */ /* originally from: http://www.volano.com/linuxnotes.html */ #include #include #include…
rekamso
  • 196
  • 1
  • 7
5
votes
1 answer

pthread_create() : What is default priority and shceduling policy

The HP man page (link) says "By default, the new thread's scheduling policy and priority are inherited from the creating thread---that is, by default, the pthread_create(3) routine ignores the scheduling policy and priority set in the…
Lunar Mushrooms
  • 8,358
  • 18
  • 66
  • 88
5
votes
3 answers

Setting the thread /proc/PID/cmdline?

On Linux/NPTL, threads are created as some kind of process. I can see some of my process have a weird cmdline: cat /proc/5590/cmdline hald-addon-storage: polling /dev/scd0 (every 2 sec) Do you have an idea how I could do that for each thread of my…
elmarco
  • 31,633
  • 21
  • 64
  • 68
3
votes
4 answers

Why NPTL threading in Linux still assignee unique PID to each thread?

I am reading pthread man and seeing following: With NPTL, all of the threads in a process are placed in the same thread group; all members of a thread group share the same PID. My current architecture is running on NPTL 2.17 and when I run htop…
Rudziankoŭ
  • 10,681
  • 20
  • 92
  • 192
3
votes
2 answers

How to ensure a signal handler never yields to a thread within the same process group?

This is a bit of a meta question since I think I have a solution that works for me, but it has its own downsides and upsides. I need to do a fairly common thing, catch SIGSEGV on a thread (no dedicated crash handling thread), dump some debug…
Kristina
  • 15,859
  • 29
  • 111
  • 181
3
votes
3 answers

Are there specific defines of linuxthreads and nptl

I hav a programme, which must work differently for linuxthreads and nptl. Are there defines in this libs, that can be used in my programme to detect, is nptl is used or is linuxthreads is? UPDATE1: For runtime there is a getconf GLIBC_LIBPTHREADS,…
osgx
  • 90,338
  • 53
  • 357
  • 513
3
votes
1 answer

Linking against NPTL for pthread function pthread_condattr_setclock

I've written some pthread code that use timed waits on a condition variable but in order to ensure a relative wait I've set the condvar's clock type to CLOCK_MONOTONIC using pthread_condattr_setclock(). In order to compile and link…
TheJuice
  • 4,434
  • 2
  • 26
  • 36
3
votes
0 answers

LinuxThreads/NPTL: Is it reliable to assign constant value 0 to variable of type pthread_t (ignoring POSIX compliance)

I am reviewing code using POSIX threads and running on Linux platform using older LinuxThreads implementatation of POSIX threads (cross-compiled code, target MIPS/uClibc if it makes any difference). If there is any difference in the answer for NPTL…
FooF
  • 4,323
  • 2
  • 31
  • 47
3
votes
2 answers

Kernel Level Thread Library

I have to implement kernel level thread but while searching on the net I found that there are three ways to create kernel level thread in linux: NPTL kthread linuxThreads It was written somewhere that linuxThreads are now abandoned. But I am…
Abhishek Gupta
  • 6,465
  • 10
  • 50
  • 82
2
votes
1 answer

Why does pthread_mutex_lock always return 0 (but no errors) when a program is not linked to the pthreads library?

I recently stumbled upon what I thought was quite a weird behavior of the pthreads library (or at least its implementation in Linux Mint 16, Ubuntu EGLIBC 2.17-93ubuntu4, NPTL 2.17, gcc Ubuntu/Linaro 4.8.1-10ubuntu9 ). When compiling a pthreads…
arsk
  • 23
  • 4
2
votes
2 answers

performance of pthread_cond_broadcast when no one is waiting on condition

If I call pthread_cond_broadcast and no one is waiting on the condition, will the pthread_cond_broadcast invoke a context switch and/or call to kernel? If not, can I rely on it being very fast (by fast I mean, just running a small number of…
tohava
  • 5,344
  • 1
  • 25
  • 47
1
vote
2 answers

Do I need to do anything special to use NPTL (as opposed to pthreads)?

Do I need to do anything special to use NPTL instead of pthreads? I am on kernel 2.3.23... I am asking because I am looking at some code which is presumably working with NPTL but I can see that it still includes pthreads, which AFAIK has problems…
Alan B.
  • 11
  • 1
1
vote
2 answers

Determine whether a thread is blocked

Does anyone know of a way to determine whether a thread is currently blocking? Basically, I want to check whether a certain thread is blocking (in this case on a AF_UNIX datagram socket receive call) and send it a signal to interrupt if it is. I'm…
deuberger
  • 3,578
  • 6
  • 31
  • 33
1
2