Managing threads concurrency
The size of the pool of available LWPs
(the ``actual concurrency level'')
will vary over time.
The Threads Library manages the size of this pool
automatically and dynamically according
to rules outlined below.
The programmer can influence the algorithm by changing
the ``requested concurrency level''
(with thr_setconcurrency, see below);
the actual concurrency level may be either greater than or less than
the requested level.
The rules governing implicit changes to the actual concurrency level are:
Initially, for each program,
there is a single LWP available for execution of threads.
The size of the pool is incremented when a thread is created
with the THR_INCR_CONC flag to
The newly created thread is not necessarily picked up by that newly created LWP.
If all of the LWPs of a process are blocked in system calls,
then the process cannot execute any threads.
the kernel sends a SIGWAITING type signal to the process
when this condition occurs.
Additional LWPs are created if there are additional runnable threads.
The number of LWPs should not exceed the number of threads
-- at least not for long
-- that would be wasteful.
An LWP that remains unassigned to a thread for a certain time
is said to have ``aged'' and will be terminated
Aging will terminate LWPs until the size of the pool equals the
if there are few threads,
the actual number of LWPs may be less than the requested level.
requested level of concurrency
number of active (running or runnable) threads
A thread can use the
to change the requested concurrency level mentioned in the algorithm above.
The syntax is:
This request is serviced asynchronously.
The rules governing the explicit changes in actual concurrency
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004