Afaics it's used to tune the number of kernel threads in systems with two layers of threads, i.e. where the user level threads are distributed among a smaller set of kernel level threads which are those that are known by the scheduler in the kernel. Not all thread libraries have this architecture, at least not visibly in the interface.
The effect is that a higher concurrency level makes more threads that are in a runnable state known to the kernel scheduler. That might cause it to preempt more often (at least the manpage for thr_setconcurrency on Solaris implies that), but it's really up to how the scheduler works.
This has nothing to do with pthread_attr_setschedparam. That function affects real time scheduling. It would be pointless to have an interface for it in thread_create since no pike level thread can be a real time thread due to the interpreter lock.
/ Martin Stjernholm, Roxen IS
Previous text:
2003-10-08 16:04: Subject: Thread question
Hi there,
After looking in Pike thread sources it seems that there is a void thread_set_concurrency(int concurrency) function but it is not used because of that:
/* SIGH! No setconcurrency in posix threads. This is more or less
- needed to make usable multi-threaded programs on solaris machines
- with only one CPU. Otherwise, only systemcalls are actually
- threaded.
*/ #define th_setconcurrency(X)
Do you know what this function was for ? Why it is not available ?
More generally is it possible to add an option in thread_create for the same as pthread_attr_setschedparam() ?
-- David Gourdelier
/ Brevbäraren