tech-userlevel archive

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

Increase PTHREAD_KEYS_MAX



Hello

pthread_key_create() will refuse to create to create more than 
PTHREAD_KEYS_MAX pthread_key_t. I encountered situations
where some Apache setup with various modules could not work 
reliabily on NetBSD because the value is too low. From time
to time the server enters a state where it will not be able
to serve requests.

POSIX mandates PTHREAD_KEYS_MAX to be at least _POSIX_THREAD_KEYS_MAX, 
which should be 128 according to POSIX:
http://pubs.opengroup.org/onlinepubs/009695399/basedefs/limits.h.html
Oddly it is 256 in NetBSD's <limit.h>

The values are:
NetBSD 256
Linux: 1024
MacOS X: 512

Obviously we lag behind and software will suit NetBSD less and less over the
time. Since it is often the result of shared usage by modules from different 
developers, we cannot blame anyone for overflowing _POSIX_THREAD_KEYS_MAX
usage as a requirement.

I suggest for netbsd-7
- fix _POSIX_THREAD_KEYS_MAX to be 128 instad of 256
- 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.

And for later:
- Think about a dynamic allocation. For now we have an array, could we
have a queue?
-- 
Emmanuel Dreyfus
manu%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index