Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
Parallel Programming Guide for HP-UX Systems > Chapter 6 Parallel optimization features

Idle thread states

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Glossary

 » Index

Idle threads can be suspended or spin-waiting. Suspended threads release control of the processor while spin-waiting threads repeatedly check an encached global semaphore that indicates whether or not they have code to execute. This obviously prevents any other process from gaining control of the CPU and can severely degrade multiprocess performance.

Alternately, waking a suspended thread takes substantially longer than activating a spin-waiting thread. By default, idle threads spin-wait briefly after creation or a join, then suspend themselves if no work is received.

When threads are suspended, HP-UX may schedule threads of another process on their processors in order to balance machine load. However, threads have an affinity for their original processors. HP-UX tries to schedule unsuspended threads to their original processors in order to exploit the presence of any data encached during the thread’s last timeslice. This occurs only if the original processor is available. Otherwise, the thread is assigned to the first processor to become available.

Determining idle thread states

Use the MP_IDLE_THREADS_WAIT environment variable to determine how threads wait. The form of the MP_IDLE_THREADS_WAIT environment variable is shown in Table 6-1 “Form of MP_IDLE_THREADS_WAIT environment variable”.

Table 6-1 Form of MP_IDLE_THREADS_WAIT environment variable

LanguageForm
Fortran, Csetenv MP_IDLE_THREADS_WAIT=n

 

where

n

is the integer value, represented in milliseconds, that the threads spin-wait. These have values as described below:

  • For n less than 0, the threads spin-wait.

  • For n equal to or greater than 0, the threads spin-wait for n milliseconds before being suspended.

By default, idle threads spin-wait briefly after creation or a join. They then suspend themselves if no work is received.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© Hewlett-Packard Development Company, L.P.