Archived

This topic is now archived and is closed to further replies.

Cactus521

AffinityMask Tweak

Recommended Posts

A brief post to distract from the news regarding ACES...Since setting up my new system and installing FSX, I've been testing the various tweaks and found I worked thru most fairly quickly. Having a Quad core system, I assumed having FSX hitting all cores would be a good thing. Yet I'd still see a very slight hesitation in turns. Usually my experiences with hesitations on slower systems was related to I/O and I started thinking as to what good it is, if FSX is hitting all cores, when one or more cores is also tasked by the O/S for I/O. So I experimented with a couple of AffinityMask ( [JOBSCHEDULER] ) settings...AffinityMask=14, which sets up FSX for the last three cores and...AffinityMask=12, which sets up FSX for the last two cores.Testing each AffinityMask entry I also monitored my core temps and confirmed that FSX was hitting the cores I had intended.What I found, and it may indeed be unique to my experience, is AffinityMask=12 offered the best smoothness for me. Why two cores out of the four and not three is beyond me, unless I have another process that is using the first two cores. I didn't see an impact in frames vs. running on four cores vs. two, just a noticeable improvement in smoothness.There's certainly no real science with my experimentation other than casual observation, but I wanted to share something that can be tried for those on quad core systems.My specs--Q82008 GB RamGT 120 w/ 1GB RamVista 64

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Thanks for the info.I might as well contribute to this by adding that I was told a few weeks ago that AffinityMask=255 is for 8 cores, for i7 users.

Share this post


Link to post
Share on other sites
Thanks for the info.I might as well contribute to this by adding that I was told a few weeks ago that AffinityMask=255 is for 8 cores, for i7 users.
Yes, 255 corresponds to "11111111" in binary, each bit when set to 1 enables affinity for that specific core. In my two examples, 12 equates to "1100" and 14 equates to "1110". Normally "1111" (15) would be the setting for a quad core system, although I believe with SP2 and above FSX will use all available cores unless the AffinityMask is set for something different.Regards,John

Share this post


Link to post
Share on other sites

I don't use SP2 simply because of the alpha texture transparency issue with addons. So the AffinityMask thing is very important to me.

Share this post


Link to post
Share on other sites
What I found, and it may indeed be unique to my experience, is AffinityMask=12 offered the best smoothness for me. Why two cores out of the four and not three is beyond me, unless I have another process that is using the first two cores. I didn't see an impact in frames vs. running on four cores vs. two, just a noticeable improvement in smoothness.There's certainly no real science with my experimentation other than casual observation, but I wanted to share something that can be tried for those on quad core systems.
Well, I tried it, and to my surprise, I find my system is smoother also with only the last two cores being assigned to FSX.In other words, Affinitymask=12.I'll try flying like this for a while and see how it behaves.Maybe the overhead of scheduling work on four cores ends up fouling up something, and just two makes for smoothersailing.. Just a guess on my part :-)Q6600@3.0, WinXP Pro, 2 GB RAM.

Share this post


Link to post
Share on other sites
I might as well contribute to this by adding that I was told a few weeks ago that AffinityMask=255 is for 8 cores, for i7 users.
If I could clarify the math used with the Affinity Mask, for:1 core your mask would be 1 which is 00001 in binary2 core your mask would be 3 which is 00011 in binary3 core your mask would be 7 which is 00111 in binary4 core your mask would be 15 which is 01111 in binary8 core your mask would be 31 which is 11111 in binaryI've got a Core i7 and my mask is set to 31! I notice smoother performance without much improvements in frame rates, although frame rates drop significantly under high load situations. I've not tried entries other than powers of two (minus 1), but after reading John's post I think I'll do some experimentation.You'll find a lot of the fsx.cfg tweaks here. The affinity mask one is about half way down the page.Mike.

Share this post


Link to post
Share on other sites
A brief post to distract from the news regarding ACES...Since setting up my new system and installing FSX, I've been testing the various tweaks and found I worked thru most fairly quickly. Having a Quad core system, I assumed having FSX hitting all cores would be a good thing. Yet I'd still see a very slight hesitation in turns. Usually my experiences with hesitations on slower systems was related to I/O and I started thinking as to what good it is, if FSX is hitting all cores, when one or more cores is also tasked by the O/S for I/O. So I experimented with a couple of AffinityMask ( [JOBSCHEDULER] ) settings...AffinityMask=14, which sets up FSX for the last three cores and...AffinityMask=12, which sets up FSX for the last two cores.Testing each AffinityMask entry I also monitored my core temps and confirmed that FSX was hitting the cores I had intended.What I found, and it may indeed be unique to my experience, is AffinityMask=12 offered the best smoothness for me. Why two cores out of the four and not three is beyond me, unless I have another process that is using the first two cores. I didn't see an impact in frames vs. running on four cores vs. two, just a noticeable improvement in smoothness.There's certainly no real science with my experimentation other than casual observation, but I wanted to share something that can be tried for those on quad core systems.My specs--Q82008 GB RamGT 120 w/ 1GB RamVista 64
Very interesting. I tried it with the i7 920. The setting of 12 does force the last 2 cores into full usage on my PC. My task manager shows 50%. The last two cores stay at 100% most of the time.....I never see it drop below 47%. Sometimes the other two cores will kick in and take all cores to 100%. What is strange about this is that without the affinity mask setting my CPU usage can be as low as 24% at times. Using this....as I said I never see it drop below 47%....and yes it does seem to be much smoother...but this will require more testing on my part and is very subjective but still very interesting how it forces the last two cores into constant high usage....and yes I get the same results as you if I use the last 3 cores....the second core..core1...is used at full and the other 3 are picking up the slack but I am not getting much total CPU usage with that setting....very strange. While I agree with you this is certainly not science maybe someone can chime in here and answer as to why this setting forces the last two cores into what for me so far is full usage.

Share this post


Link to post
Share on other sites

This is great. I didn't try it before because Nick_N said SMT (multi-threading) didn't have any effect on FSX and should be disabled in the bios. I just tried all the options and found out that the best is affinitymask=255 (or 254 if you want to have a free core for TrackIR or something else).I noticed a nice improvement, even in the loading of the flight, and now all cores work inside FSX. 7 of them are just used for texture loading, though. Frame rate in flight is slightly better also.Here are some screens:Without SMT, 4 cores working and CPU usage never exceeds 50%ScreenHunter_08Jan241000.jpgWith SMT, during the loading of the flight, 8 cores used and the loading is fasterScreenHunter_02Jan240944.jpgWith SMT during flight, 8 cores used and CPU usage sometimes reaches 100%.ScreenHunter_04Jan240950.jpgI would say, turn on SMT in the bios and put the affinity mask tweak in fsx.cfg. Get all your cores to work.Cheers

Share this post


Link to post
Share on other sites
If I could clarify the math used with the Affinity Mask, for:
I should amend my earlier post with the following correction:1 core = 1 dec or 00000001 bin2 core = 3 dec or 00000011 bin3 core = 7 dec or 00000111 bin4 core = 15 dec or 00001111 bin5 core = 31 dec or 00011111 bin6 core = 63 dec or 00111111 bin7 core =127 dec or 01111111 bin8 core =255 dec or 11111111 binSorry guys, I wasn't thinking straight.

Share this post


Link to post
Share on other sites
I should amend my earlier post with the following correction:1 core = 1 dec or 00000001 bin2 core = 3 dec or 00000011 bin3 core = 7 dec or 00000111 bin4 core = 15 dec or 00001111 bin5 core = 31 dec or 00011111 bin6 core = 63 dec or 00111111 bin7 core =127 dec or 01111111 bin8 core =255 dec or 11111111 binSorry guys, I wasn't thinking straight.Mike.
You can also specify the affinity mask for specific cores depending on which bit is setFor instance, for two cores on a 4 core system, the possible values are:Dec Value / Core # ____3 2 1 003__0 0 1 105__0 1 0 106__0 1 1 009__1 0 0 110__1 0 1 012__1 1 0 0 Back to my original observation, it seems shifting the affinity off of Core 0 and possibly Core 1 seemed to help smoothness although impact on fps seemed negligible. With each of these settings I can watch cpu usage and temps go up for the cores selected and usage/temps down for the ones that aren't.

Share this post


Link to post
Share on other sites

I am very interested to hear about this. I'm trying the n=255 setting with HT enabled.Sure looks like it's using all those threads.-jk

Share this post


Link to post
Share on other sites
You can also specify the affinity mask for specific cores depending on which bit is setFor instance, for two cores on a 4 core system, the possible values are:Dec Value / Core # ____3 2 1 003__0 0 1 105__0 1 0 106__0 1 1 009__1 0 0 110__1 0 1 012__1 1 0 0 Back to my original observation, it seems shifting the affinity off of Core 0 and possibly Core 1 seemed to help smoothness although impact on fps seemed negligible. With each of these settings I can watch cpu usage and temps go up for the cores selected and usage/temps down for the ones that aren't.
I do not know the internal architecture of the Q6600, so I do not know if it cares what cores are loaded and how the cores might contend for internal resources, but after a bit of trial, I am now flying with the mask set at 6. For me, this gives the smoothest performance.

Share this post


Link to post
Share on other sites
I do not know the internal architecture of the Q6600, so I do not know if it cares what cores are loaded and how the cores might contend for internal resources, but after a bit of trial, I am now flying with the mask set at 6. For me, this gives the smoothest performance.
Bert, I am going to try the 6 setting. I keep waiting for Nick to chime in here as this is his cup of tea. I also do not understand the architecture but set at 12 does give me smoother performance. Plus when I click on map from in the middle of flight it is opened instantly...not one bit of a delay. The load is faster also. This I can time and prove to myself without trusting my eyes. I never put this setting in as supposedly FSX was using all the cores....and it does but with the setting of 12 on my PC it is using two of the cores to their max....very interesting. Requires much more testing. Regards

Share this post


Link to post
Share on other sites

i have just tried this with my amd phenom 9850, chopped this back to two cores instead of the four i was running, and wow, it has slightly improved my frame rates, but the smoothness is outstanding i get no stutters what so ever, and the CS 757 which gave me around 20fps and slight stuttering during turns now gives me on average 25fps and no stutters what so ever, i will be monitoring this on my system and see if i get any decrease in performance.it seems counter productive to remove two cores from running FSX as you would think that you need all the processing power you can get, but it seesm to work in my brief tests, will keep you postedJason

Share this post


Link to post
Share on other sites

On my I7 it also seems to be smoother if i leave 1 core free (by setting the mask to 254 instead of 255). I wonder why...

Share this post


Link to post
Share on other sites
I just tried all the options and found out that the best is affinitymask=255 (or 254 if you want to have a free core for TrackIR or something else).
I guess that should be 127 and not 254...? 255 is 8 cores and 127 is 7 cores... right?

Share this post


Link to post
Share on other sites
I guess that should be 127 and not 254...? 255 is 8 cores and 127 is 7 cores... right?
It seems from John's investigation that you can select or deselect any of the 8 cores available on a Core i7 chip simply by setting or resetting the bits as desired. To be somewhat verbose, and to paraphrase John's notation, the alternative ways of deselecting 1 core from use while running FSX on an i7 chip are:Dec Value / Core #_____7 6 5 4 3 2 1 0254__1 1 1 1 1 1 1 0 253__1 1 1 1 1 1 0 1251__1 1 1 1 1 0 1 1247__1 1 1 1 0 1 1 1239__1 1 1 0 1 1 1 1223__1 1 0 1 1 1 1 1191__1 0 1 1 1 1 1 1127__0 1 1 1 1 1 1 1Both 127 and 254 are options in this case.

Share this post


Link to post
Share on other sites
I guess that should be 127 and not 254...? 255 is 8 cores and 127 is 7 cores... right?
Like Mike said, if you set it to 254 all cores work inside FSX except the first one.

Share this post


Link to post
Share on other sites

Hello,I'd like to give this tweak also a try...But: Is it useful for SP2? Or does it also have an affect to tweak with "affinity"?And: to set it on the last 3 cores for a quadcore, what number do I have to choose?Thank you very much!

Share this post


Link to post
Share on other sites

The Affinity Mask tweak has been possible since the release of SP1, so if you have SP2 installed then it will work for you.

And: to set it on the last 3 cores for a quadcore, what number do I have to choose?
Dec Value / Core #____3 2 1 007__0 1 1 17 would be the bit mask you would use according to John's notation. Alternatively you could experiment with setting and resetting the different bits to see which one works best for you. The bit mask values you could try in order to use only three cores while setting one aside for use by some other process would be: 14, 13, 11, 7.

Share this post


Link to post
Share on other sites

Hello,Does someone know what I need to use with my HT system? 1 or 2 cores?Thanks in advance

Share this post


Link to post
Share on other sites

Unless Intel has changed how hyperthread works and without it enabled only 1/2 of each physical core in i7 is being used, turning it on (IMHO) may be netting the psychological result of seeing activity in the boxes, or, the change really is affecting an issue which could be resolved through other means but in reality had nothing to do with HT being enabled/disabled to begin with.It is my understanding that FSX SP2 is multicore aware, not hyperthread... someone from Aces would need to ring in on that If you are at 4Ghz and on the fence with temps with i7 enabling the feature can throw you over the top on heat, so do be aware of that. what this reminds me of... VSYNC DISABLEDI can dig up thread after thread after thread where people SWEAR with Vsync disabled the sim ran higher frames and smootherOF course it runs higher frames... Vsync locks the frames at the refresh rate of the monitor. What I also found amazing is those running WINDOW MODE making the same statement about performance after disabling Vsync... when Vsync DOES NOT work in Windows Mode, at all!The psychological result of seeing the frame counter move over the refresh rate allowed all sorts of perfomance 'sightings' to occur all over the netI usually find when things like this get posted the results are one person says they see a difference and another says they cant see a difference, and then another says they see a small change.. then another says the system runs worse.In that, we have a tweak that does not exist but people will see what they want to see based on readouts, benchmark software and other visual aids that are giving the person what they want to see and its simply applied all the way through, or, the change really is affecting an issue which could be resolved through other means but had nothing to 'truly' do with HT being enabled/disabled to begin with. Now.. as I said, assuming Intel has not changed how hyperthread works with i7 and it somehow does not allowing full access to the physical cores when disabled, I do not see it helping. And if I had to choose between 4Ghz and HT enabled due to temps, I know which one I will take.I have run tests on properly tuned systems for both OS and FSX going back into October and I saw absolutely nothing was gained or lost by enable/disable HT in i7 on the testbed systems I ran.I normally find those who use the affinity mask tweak and say killing a core to FSX makes the system work better and run smoother in application, see that result because FSX is NOT correctly tuned, or, a 3rd party addon is influencing the result. What they are doing is a 6 of 1, 1/2 dozen of the other.. instead of using the slider to poke the software into using the hardware, or using Windows CPU Affinity for the 3rd party app they kill one part of the hardware to FSX which then tickles the rest into action. Some 3rd party addons should have their own resource and is better off not being placed on the same primary (0-1) cores as FSX.The same thing can be accomplished by assigning CPU Affinity in Windows to the 3rd party app.There are a lot of different ways to accomplish the same goalUsing the Affinity Mask in RTM was required however past SP1 that was pretty much done away with.. the app will find the core resources without the line edit if they are there and if the system and BIOS are working correctly.I will look at it again when I get time to see if I missed something.. which is possible :( but nothing I saw when I ran i7 tests back in Oct-Nov indicated HT was doing anything for FSX with i7 except heating up the proc in a high clock. All my test were run on SP2/Acceleration as I do not use RTM or SP1 at all..I am also on WindowsXP x64 although I did run FSX on Windows7 and saw no difference either so there are few different wildcards out there in configurations that may need to be looked at.The bottom line to all this is.. if you think you have found something that works for you. no matter the 'what' or 'how'.. use it :(

Share this post


Link to post
Share on other sites
On my I7 it also seems to be smoother if i leave 1 core free (by setting the mask to 254 instead of 255). I wonder why...
Since the OS will tend to use Core0 (the first core), it makes some sense that running FSX on the other cores would help.Just an uneducated guess :(

Share this post


Link to post
Share on other sites
Using the Affinity Mask in RTM was required however past SP1 that was pretty much done away with.. the app will find the core resources without the line edit if they are there and if the system and BIOS are working correctly.
Nick, I wonder if more cores really add to the performance, or possibly just add to the congestion.FSX is multi-core aware and will assign work, but does this always translate into better performance?Just like a freeway with additional lanes does not necessarily enable more traffic, if the lanes merge backinto just one lane further along..I can see all cores on my Q6600 getting used in the default configuration, but with the mask set to 6 (0110), only two cores get used by FSX and the sim runs smoother.Not really better fps, but more consistency and less "hesitation" when making turns and overall smoother feel.The fact that I get at least as good performance with two cores enabled as with four, tells me that the last two cores cannotbe doing much to help. The only benefit I can point to is a faster initial load. Maybe my system is congested somewhere else,but I've got FSX on a separate Raptor drive, running the CPU at 3.0GHz, defrag, and don't run any additional stuff. I know that some systems run better with more autogen rather than less, and I wonder if this is a similar case, where a differentload pattern is handled better.. although common wisdom might have expected a different outcome.

Share this post


Link to post
Share on other sites