Is there the ability to define the core to which a given thread will be pinned to?
Yes, you can set the thread affinity of the automatically created context thread.
The relevant context properties for the underlying C API can be found here.
From within JavaRTO, you can provide the required “CONTEXT_THREAD_AFFINITY” property on context creation like so:
String contextProperties = new String;
int index = 0;
contextProperties[index++] = "CONTEXT_THREAD_AFFINITY";
contextProperties[index++] = "255";
contextProperties[index++] = "CONTEXT_CREATE_THREAD";
contextProperties[index++] = "1";
rc = Solclient.createContextForHandle(contextHandle, contextProperties);
Note: if you pass context properties to createContextForHandle(), you must include CONTEXT_CREATE_THREAD with a value of 1. (Its default is 0, meaning disabled, which is not supported).
Huh! I didn't know that. Cool!
As an alternative, I usually handle my CPU affinity at the shell using taskset. That way I can change at runtime.