tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Increase PTHREAD_KEYS_MAX
On Wed, May 13, 2015 at 02:02:26PM +0200, Joerg Sonnenberger wrote:
> > - fix _POSIX_THREAD_KEYS_MAX to be 128 instad of 256
> This doesn't make sense. It should reflect the actual limit.
The actual limit is PTHREAD_KEYS_MAX. _POSIX_THREAD_KEYS_MAX
is the constant defined in the standard.
> > - increase PTHREAD_KEYS_MAX to 2048 so that we lead again for some time
> > this would increase memory footprint of programs linked with -lpthread
> > of 14 kB on ILP32 systems, and 28 kB on LP64 systems.
>
> I am against raising it that much. The overhead is *per thread*, so it
> sums up easily.
This is not my understanding of both the code and the documentation.
pthread_key_create(3) saus:
The pthread_key_create() function creates a thread-specific data key
visible to all threads in the process.
The data attached to a pthread_key_t is thread-specific. The array is
not.
> A queue doesn't make sense, O(1) is really required here. On-demand
> growing of the array shouldn't be too hard to implement though.
I am not sure if we can use realloc() there. Even if we can, it means
we have to call malloc() on first usage.
--
Emmanuel Dreyfus
manu%netbsd.org@localhost
Home |
Main Index |
Thread Index |
Old Index