A system and method for identifying compatible threads in a Simultaneous
Multithreading (SMT) processor environment is provided by calculating a
performance metric, such as cycles per instruction (CPI), that occurs
when two threads are running on the SMT processor. The CPI that is
achieved when both threads were executing on the SMT processor is
determined. If the CPI that was achieved is better than the compatibility
threshold, then information indicating the compatibility is recorded.
When a thread is about to complete, the scheduler looks at the run queue
from which the completing thread belongs to dispatch another thread. The
scheduler identifies a thread that is (1) compatible with the thread that
is still running on the SMT processor (i.e., the thread that is not about
to complete), and (2) ready to execute. The CPI data is continually
updated so that threads that are compatible with one another are
continually identified.