RtSetThreadCLOS

RtSetThreadCLOS overwrites a thread’s implicit or default Class of Services (CLOS), which is based on its priority when set to Priority-based CLOS performance mode. Otherwise, all RTSS threads are CLOS 0.

NOTE: RtSetThreadCLOS is only supported in the RTSS environment. It cannot be called from a Windows application linked to RTX64.

Syntax

BOOL RtSetThreadCLOS(
	HANDLE hThread,
	ULONG nCLOS
);

Parameters

hThread

The RTSS thread handle whose CLOS value is to be explicitly set.

nCLOS

A CLOS value from 0 to the number of CLOS – 1, where 0 identifies the highest performance, or DEFAULT_CLOS, which resets back to the implicit/default CLOS based on the thread’s priority. The number of CLOS is obtained by calling RtGetRDTCapability.

Return Value

Returns TRUE if the function succeeds; returns FALSE if the argument was invalid or if RDT is not supported or disabled in the RTX64 Control Panel.

Remarks

As a matter of RTX64 policy for extensibility, CLOS 0 is considered and configured as the highest priority CLOS, followed by CLOS 1, and so on.

A thread has implicit/default CLOS which is based on its priority when the Subsystem is configured to use Priority-based CLOS performance mode. The implicit/default CLOS and priority are inversely mapped with the RTSS priority range (0~127) by the number of CLOS available to RTSS processors/cores. With Flat performance mode the default CLOS is 0. Use real-time function RtGetRDTCapability to determine the number of CLOS.

For example, the mapping table below is for the number of CLOS equal to 7 when the Subsystem is configured to use Priority-based CLOS performance mode.

CLOS RTSS Priority Range
0 109~127
1 90~108
2 72~89
3 54~71
4 36~53
5 18~35
6 0~17

The implicit/default CLOS of RTSS thread can be overwritten by RtSetThreadCLOS. When the thread is scheduled to run, its CLOS is used to guide the hardware’s LLC fill policy and memory throttling.

As MBA controller is provided per processor core (the maximum of the delay values of the per-thread CLOS applies to the core), it is recommended to disable Hyper-Threading in the BIOS if the MBA Priority-based CLOS performance mode is configured in the RTX64 Control Panel.

Since MBA uses a programmable rate controller between the cores and the last-level shared caches and memory controller, bandwidth to these caches may also be reduced. Care should be taken to throttle only bandwidth-intense threads that do not use the off-core caches effectively.

Requirements

Minimum Supported Version RTX64 3.5
Header RtssApi.h
Library Rtx_Rtss.lib

See Also:

RtGetRDTCapability

RtGetThreadCLOS

Optimizing Performance with Intel Resource Director Technology (RDT)