Using the Real-Time API

Most Real-Time API calls are deterministic. Calls that require Windows resources (such as printf) are not deterministic because the RTSS thread may get suspended while waiting for availability of a Windows resource.

Many of the supported Windows functions have similar functions in the Real-Time API. For example, to create a Windows semaphore, you would call CreateSemaphore. To create an RTSS semaphore, you would call RtCreateSemaphore.

Namespaces

RTSS maintains its own namespace, separate from the Windows namespace. This means that within a Windows application an object created using the Windows API will be managed in the Windows namespace, while an object created using the Real-Time API (RTAPI) will be managed in the RTSS namespace. In an RTSS application, objects created using the supported Windows API, along with those created using the RTAPI, will exist in the RTSS namespace.

Selecting an API

Windows Applications should not use RTSS objects unless they need to communicate with RTSS applications. By creating objects using the RTAPI, a Windows application will use additional non-paged pool resources and add additional activity between Windows and the RTX64 subsystem through the creation of Proxy Threads, which could impact real-time performance.

When deciding which API to use (Windows or RTAPI) consider the following:

Affinity Masks

From within a Windows process, you must use RtGetProcessAffinityMask or RtSetProcessAffinityMask to get or set a process affinity mask for an RTSS process. If you use GetProcessAffinityMask or SetProcessAffinityMask, you will get or set the affinity mask for a Windows process, not an RTSS process.

Scheduling

For more information on scheduling RTSS and Windows threads, see the Thread Priority Mapping section of Thread Priorities.

Related topics: