Is setting processor affinity legal

I want to do some work specifically on CPU that is shared between me and the opponent. How do I do this?

Is setting the processor affinity for the thread legal or is it considered interference if I get the affinity wrong?

would be interested to hear the answer to this as well

Hey @markus27183,

Great question,

In most docker setups, the containers have access to all of the host machine’s resources allocated to the container, so you could typically set processor affinity as normal for threads in an application. It does seem that in Azure Container Groups (ACG) works in a fairly simple manner, by hosting the ACG on a single host machine, and assigning the resources accordingly, and should work for what you want to do.

For a bit more information of how ACG works :

We have setup the container instances to have access to a minimum of 1.5 CPUs (resource limit) and a maximum of 2 CPUs (resource allocation). If you plan on setting affinity on the shared CPU, you should be able to do this, however, this could only pose an issue when both the container instances are competing for the CPU time. In this case, Azure will limit the resources accordingly. This means that you will never be able to reduce your opponents CPU resource time to less than 1.5 CPUs.

With that being said, I do not know how this would affect your bot by setting of the processor affinity, since both container instances will have access to a minimum of half of the processing time on the shared CPU when resources are being competed for. As the setup ensures that each bot gets full access to the minimum resources allocated to them when needed.

Hope this helps answer your question !

Kind Regards,

1 Like