Processor Affinity

Having the ability to configure multiple dedicated RTSS processors introduces the concept of processor affinity. Processor affinity means you can specify which processor(s) a given process or thread should run on. This topic describes basic processor affinity concepts you should understand before you begin any parallel programming within RTX64.

Affinity Levels

There are three levels of affinity in the RTSS subsystem:

Subsystem affinity refers to the set of processors you have dedicated to RTSS.

Process affinity refers to the processors that the threads of a given process may run on. If you don't specify a processor for a process to run on, its main thread will run it on the lowest-numbered RTSS processor available in the system. The set of processors that a process's threads can run on must be a subset of the set of processors available to the RTSS subsystem.

NOTE: Proxy threads are run on the lowest-numbered RTSS core along with Subsystem activity for IPC communication. This may result in this core having higher latency than others.

Thread affinity determines the processors that an individual thread can run on. By default, a thread will run on the lowest-numbered RTSS processor available for the process to run on. The set of processors a thread can run on must be a subset of the set of processors its process can run on.

Processor Affinity Masks

Process and thread affinity are specified using processor affinity masks. A processor affinity mask specifies the set of processors on which a process or thread may run.

Ideal Processor

Within RTX64, you can set an ideal processor for a thread. When a thread has an ideal processor set, that is the processor the thread will always run on. RTX does not support load balancing so this behavior deviates from how Windows handles setting an Ideal Processor. In Windows and other systems that do support load balancing, the ideal processor is the preferred processor for the thread and the system will try to run the thread on the ideal processor when possible, but it is not guaranteed. In RTX64, use of the ideal processor is guaranteed.

Setting Processor Affinity

When starting a process via the RTX64 Task Manager utility, you can set the processor affinity mask for the process and the ideal processor for its main thread. If you are using the RtssRun command line, see Running an RTSS Application for details.

Related topics: