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 Win32 functions have similar functions in the Real-Time API. For example

Namespaces

RTSS maintains its own namespace, separate from the Windows namespace. This means that within a Windows application an object created using the Win32 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 Win32 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 SRI activity between Windows and the RTX subsystem, which could impact real-time performance.

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

Affinity Masks

From within a Win32 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 Win32 process, not an RTSS process.

Scheduling

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

 

See Also

IntervalZero.com | Support | Give Feedback