Developing a Soft Real-Time Application
Once a device is configured for real-time performance, an application can be set to run in real-time using standard Win32 APIs. The only factors that will give a thread or process real-time performance are the thread/process priority rank and the CPU core affinity.
To get real-time performance on a particular thread or process, its priority should be in the range of real-time performance and its affinity should be set to run on the real-time cores.
- Use the SetPriorityClass Function to: Set the process’ ProcessPriorityClass attribute to
REALTIME_PRIORITY_CLASS
. - Use the SetProcessAffinityMask Function to set the process to run exclusively on the cores which are reserved for the real-time application
- Use the NtSetInformationThread function to set the thread’s ThreadBasePriority to a value between 16 and 31
- Use the SetThreadAffinityMask function to set the thread to run exclusively on the cores which are reserved for the real-time application