Finding FSX.CFG and setting an affinity mask

The place for hardware and software issues, FS and non-FS related

Moderators: Guru's, The Ministry

rohan
Trident
Trident
Posts: 362
Joined: 05 Apr 2008, 12:15

Re: Finding FSX.CFG and setting an affinity mask

Post by rohan »

For those who may be interested, I've just been doing some research on the affinity mask in P3D, with some unexpected results.

P3D has been able to run in both real and virtual cores (hyper-threads) since version 1.3. However, there are some interesting twists. By default, P3D will only set itself to run on real cores, for the simple reason that the code that is assigned to the threads is the most resource use intensive code in P3D, and running resource intensive code in both the real and virtual halves of a processor core leads to poor performance. In other words, you only get the best performance using the real cores. The default behaviour is, as Paul said, equivalent to an affinity mask setting of 84. For those users lucky enough to have a 6 core CPU, the best value would be 1364.

It would seem that somewhere between version 1.3 and 2.2 (I think it was 2.0 but have seen nothing to corroborate that), the P3D thread handler has grown the ability to run more than three threads - at least five based on that mask value for a 6 core CPU.

LM's advice, like that of m$, is to always leave the first "primary" core free ...

For FSX users, the implication in that first bit of news is that FSX does not run in virtual cores ! ! !

All info available in the LM forums ...

rohan
Trident
Trident
Posts: 362
Joined: 05 Apr 2008, 12:15

Re: Finding FSX.CFG and setting an affinity mask

Post by rohan »

Another trick I found in the Avsim forums for P3D. For the source, you need to Google the phrase "Another Affinity (cores) Trick". Why ? Because Avsim in their infinite wisdom won't allow non-members to browse their forums most of the time. (Personally, I think the only time you're allowed in is between midnight and one minute past midnight).

The gist of the trick (if I understand it correctly) is to use a mask of 15 so that P3D runs in all real cores, assuming that you have hyper-threading off. Once P3D starts, use the task manager to stop the P3D process running in core 0, then use it again to restart that process. The end result is apparently much smoother running, but nobody has yet even hazarded a guess as to why it works ...

Given that the thread handler would normally start in core 0, I really can't see how this doesn't cause a CTD ...

User avatar
Paul K
Red Arrows
Red Arrows
Posts: 7815
Joined: 12 Jun 2005, 16:41
Location: Norfolk UK

Re: Finding FSX.CFG and setting an affinity mask

Post by Paul K »

Rohan, I think I read it 'officially' on the P3D forum - without any Affinity mask edit in the .cfg, it defaults to 84, and that actually is the case from observing task manager Also, I'm told that with v2.3 that default setting is going to be altered, but to what, I don't know.

GHD
Vintage Pair
Vintage Pair
Posts: 2869
Joined: 17 Sep 2004, 14:04
Location: Harton Village, UK

Re: Finding FSX.CFG and setting an affinity mask

Post by GHD »

rohan wrote:Given that the thread handler would normally start in core 0, I really can't see how this doesn't cause a CTD ...
It doesn't matter on which core it starts, it is the OS which schedules cores to applications and threads. If one sets the affinity mask to use core 3 only, the OS will switch the application and all of its threads to run on that core.
George

Image

rohan
Trident
Trident
Posts: 362
Joined: 05 Apr 2008, 12:15

Re: Finding FSX.CFG and setting an affinity mask

Post by rohan »

No, of course it doesn't matter where it starts, and of course the o/s actually starts the process in whichever core it's going to run, though the o/s may have been asked to run the process in a particular core by task manager or the app itself. And if at some future point that app spawns another thread, it may well ask for that to be run in a different core.

And using task manager or some tool to set the affinity of FSX could give the same effect as using the mask to run everything in core 3.

But do we really need all this level of detail when I'm trying to keep things simple to help others to understand a very complex subject. Did you really have a point in making this post, or are you just trying to muddy the water or pick nits ...

Post Reply