Sign in to follow this  
Guest cbuchner1

Findings about FSX SP1+2 tile loading speed on Multicore CPUs

Recommended Posts

Findings about FSX SP1/2 Multicore functionality in conjunction with FS9 photo scenery----------------------------------------------------------------------------------------If your system has N cores, the first core performs the graphics rendering (Main Thread) and N-1 other cores perform scenery loading and compositing and other background work like placing Autogen and road traffic. Each thread is locked to one CPU core.The Main thread on the first core is split into at least two fibers. (Note: Fibers subsets of Threads that are entirely scheduled by the application). One fiber does the graphics rendering in DirectX and the other fiber is performing scheduling of work jobs for the other cores. And here is the important finding: this fiber will also perform all file I/O for loading the BMP photo terrain tiles!Microsoft probably did this to serialize the I/O and avoid disk thrashing. However modern hard drives with Native Command Queueing could actually perform better with non-serialized I/O. So in hindsight this probably wasn't a good design choice - also for reason explained in the following:In triple and quad core systems the BMP tiles are loaded "out of order" (i.e. not in sequence) because multiple cores (threads) simultaneously perform some loading of scenery tiles. However for the actual disk I/O these cores always turn to the main thread to serialize their I/O.All other cores send a message to the Main Thread on the first core to load a specific BMP tile and wait for the result. If you need "proof" of this, use Process Monitor or FileMon and observe the Thread ID of the file operations on BMP photo terrain tiles - the thread ID is always the same! So a single thread does all the I/O work.So essentially the first core becomes a bottleneck when it comes to loading FS9 photo scenery - all other cores keep waiting for the first core to return the data. You can see this nicely in Task Manager when you enable the "Show Kernel Times" option. The last N-1 cores have tremendous Kernel times (shown in red color), often around 75%. This is probably a spinlock or something similar waiting for the result returned by the first CPU core! What a waste of resources and electricity. ;) But as a side effect it always keeps the processorload at 100% and makes you think you get good use of your other cores. NOT!So how can we improve the tile loading performance then?I found that by setting ridiculously high "FIBER_FRAME_TIME_FRACTION" values in the order of 1.0 - 2.0 you can bring up your tiles per second accessed during flight. This is because the rendering process will then spend at least the same time for File I/O than it spends on graphics rendering. So it can process more tiles and deliver tiles to the other cores faster.For this tweak to work you must lock your frame rate also, anything other than "Unlimited" is fine. However your frame rate will ditch down to a measly 10-15 FPS.With this tweak, I am sometimes seeing in excess of 1200 TPS on a quad core system in mid flight flight. Yet the N-1 other cores are still quite bored - and most of the time is wasted waiting for the first core to return the data. Without applying this tweak I get 400-600 TPS during flight only.This tweak will also work for people flying over regular FS9 photoscenery (e.g. older MegaScenery releases) with FSX SP1 or later - however the sacrifice in frame rate may be a showstopper for many.

Share this post

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this