request a level of concurrency
cc [options] -Kthread file
int thr_setconcurrency(int new_level);
thr_setconcurrency tells the implementation
the number of lightweight processes (LWPs)
that the user would like available for running multiplexed threads.
thr_setconcurrency sets to new_level
the requested level, or degree, of concurrency,
which is the number of LWPs
that the user would like available
to execute multiplexed threads in the process.
The requested concurrency is a hint to the implementation as to
the level of concurrency expected by the user;
the implementation might use this value to affect the number of
LWPs available for running multiplexed threads.
with the THR_INCR_CONC flag
is another way to control concurrency.
the requested level of concurrency
new_level must be a non-negative integer.
thr_setconcurrency interprets it as follows:
If new_level is zero,
thr_setconcurrency sets the level of concurrency to the default level.
If new_level is greater than the current number of LWPs,
in this implementation,
will create LWPs until the number of LWPs in the pool
unless new_level exceeds a system limit.
In that case, LWPs will be created only up to the system limit.
However, if new_level exceeds the number of threads in the process,
will create new LWPs so that the number of LWPs
equals the number of threads in the process.
If new_level is less than the current number of LWPs,
will allow LWPs to terminate themselves as the result of aging.
If new_level is equal to the current number of LWPs,
thr_setconcurrency sets the new level of concurrency,
but does not create or terminate any LWPs.
When the number of LWPs becomes greater than the number of threads
in the process,
the concurrency level might automatically decay over time to be equal to
or less than the number of threads in the process.
This process is called ``aging''.
In this implementation,
if an LWP is inactive for a certain length of time,
it will terminate itself if:
the number of LWPs is greater than the requested concurrency level
or the number of LWPs is greater than the number of threads in the process
The Threads Library ensures that a sufficient number of threads
are active so that the process can continue to make progress.
While this conserves system resources,
it might not produce the most effective level of concurrency.
thr_setconcurrency permits the application
to give the Threads Library a hint
about the desired level of concurrency.
thr_setconcurrency returns zero for success
and an error number for failure, as described below.
If the following condition is detected,
thr_setconcurrency returns the corresponding value:
new_level is negative.
The creation or termination of LWPs
is not synchronous with the
call to thr_setconcurrency.
If new_level causes a system limit to
be exceeded no error is returned.
The Threads Library will always ensure that an LWP
is available to run multiplexed threads.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 01 June 2005