This environment variable allows a user program to define the max
yield (wait) time for a particular thread. It is used to configure
the speed at which the pthread_yield() and sched_yield() functions
release a processor to enable another thread to run. In some cases,
such as in highly-threaded applications, improved performance
may result by using this environment variable to reduce the default
max wait time.
- Value
- Description
- positive value
- An integer value to set the maximum yield time allowable for
a pthread to wait. This value represents microseconds (1/1000 of a
millisecond).
Note: Values above 32000 (which is the current
max default) and values less than or equal to zero will be ignored.
Examples of setting _EDC_PTHREAD_YIELD_MAX:
- This example results in wait times starting at 10 milliseconds,
doubling on every successive wait (as it always has) up to a maximum
of 20 milliseconds for every wait after that.
ENVAR("_EDC_PTHREAD_YIELD_MAX=20000")
(and EDC_PTHREAD_YIELD=-1)
- This example results in wait times starting at an interval determined
by the hardware processor speed, and doubling at every successive
wait for a maximum wait of 1000 microseconds.
ENVAR("_EDC_PTHREAD_YIELD_MAX=1000")
(and EDC_PTHREAD_YIELD=-2)
- This example will result in wait times starting at 1 microsecond,
doubling on every successive wait up to a maximum of 1 millisecond.
ENVAR("_EDC_PTHREAD_YIELD_MAX=1000")
(and EDC_PTHREAD_YIELD=4096)
Note: A positive integer
specified in _EDC_PTHREAD_YIELD determines the initial Time Unit a
thread will wait for; in this example, 4096 is equivalent to 1 microsecond.
- This example results in wait times that start at 10 milliseconds
and remain at that wait time for every successive wait, because the
starting yield time is much longer than the intended maximum wait
time.
ENVAR("_EDC_PTHREAD_YIELD_MAX=10")
(and EDC_PTHREAD_YIELD=-1)