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 wRTOS.
Syntax
BOOL RtSetThreadCLOS(
[in] HANDLE hThread,
[in] ULONG nCLOS
);
Parameters
[in] hThread
The RTSS thread handle whose CLOS value is to be explicitly set.
[in] 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
If the function succeeds, it returns TRUE. If the argument was invalid or if RDT is not supported or disabled in the wRTOS Settings, it returns FALSE.
Remarks
As a matter of wRTOS 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 wRTOS Settings.
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 | Header | Library |
|---|---|---|
|
wRTOS 1.0 SDK |
RtssApi.h |
Startup.lib |
See Also: