[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: PTHREAD_THREADS_MAX missing?



Jakub Jelinek wrote:
The ltp-20030324 version compile of trace_sched.c fails because
PTHREAD_THREADS_MAX is not defined. ...

... Posix does not require PTHREAD_THREADS_MAX be defined; see http://www.opengroup.org/onlinepubs/007904975/basedefs/pthread.h.html


Well, better URL would be
http://www.opengroup.org/onlinepubs/007904975/basedefs/limits.h.html

Ouch. I stand corrected, thanks.


"A definition of one of the symbolic names in the following list shall be
omitted from <limits.h> on specific implementations where the corresponding
value is equal to or greater than the stated minimum, but is unspecified.

This indetermination might depend on the amount of available memory space
on a specific instance of a specific implementation. The actual value
supported by a specific instance shall be provided by the sysconf()
function."

That brings up the question: what does sysconf(_SC_THREAD_THREADS_MAX) return in nptl? Uh-oh, looks like it might be -1; see http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/posix/sysconf.c?rev=1.32

    case _SC_THREAD_THREADS_MAX:
#ifdef  PTHREAD_THREADS_MAX
      return PTHREAD_THREADS_MAX;
#else
      return -1;
#endif

Is that compliant?

Maybe sysconf could call a "get max threads" function from the thread addon here.

Is there any sensible expression such a "get max threads" function
could use to compute a reasonable upper bound on the number of threads that's lower
than PID_MAX?  e.g. min(physical memory, PAGE_OFFSET) / (2 * PAGESIZE)?

- Dan

--
Dan Kegel
http://www.kegel.com
http://counter.li.org/cgi-bin/runscript/display-person.cgi?user=78045





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]