Friday, March 21, 2008

More Threads - the Installer

Nine women cannot have a baby in one month - that's the classic example that gets thrown around computer science for the difficulty of parallelization - that is, just because we have ten times as many resources doesn't mean we're going to go ten times as fast.

Problems of scalability via parallelization have become very important for graphics engines as everybody and their mother now has at least two cores, and users with more serious hardware are going to have four.

I get asked a lot: "will X-Plane utilize X cores..." where X is a number larger than two. My general answer is: sometimes, maybe, and probably more in the future. I can't make strong predictions for what we'll ship in the future, but the general trend for the last 18 months has been us using more cores every time we go into a piece of code to do major architectural changes.

I've been doing a lot of work on the installer this week - the first major overhaul of the installer since we originally coded it all the way back at X-Plane 8.15. And the new installers and updaters will try to take advantage of multiple CPUs where possible. A few cases:
  • The X-Plane updater runs an MD5 checksum over the entire X-Plane folder to determine which version of the various file components you have and whether they need to be updated. This s not a fast process. I am working on threading this so that more CPUs can work on the problem at once. It looks like there will be only modest benefits from this because the process is also highly bottlenecked on the disk drive.
  • The installation engine from the DVD will use more than one CPU to decompress files. For zip compression this wasn't very important, but the scenery will be compressed via 7-zip compression to get us down to disk DVDs. 7-Zip compresses DSFs about 10% smaller per file than zip, but it's horribly slow to decompress, so being able to throw twice the CPU at it is a big win.
Now on one hand, our top performance goals are for the sim, not the installer. On the other hand, faster installations are good. But my main point here is: when we wrote new code four years ago, we assumed one CPU and a nice graphics card. We now assume at least two cores and possibly more, and that informs the design of every new feature, not just the rendering engine. If we don't create a multi-core-friendly design, we're effectively leaving at least 50% of the CPU on the table.


Anonymous said...

Please make it a bit future-proof also, so if you are writing the code - try to split the job on like 8 threads.

Parallellism is revolutionizing the way computers interact with software, and the developement is going at FAST pace! 8 cores will be reality in -one- year!

Anonymous said...


This comment doesn´t cover this topic but I cant find your e-mail adress to send you this anywhere so I post my feature request here. I hope I dont break any blog rules by this.

The request and question I have is if you are planing on using any advanced light effects in X-Plane such as the one on Please have a look at this site.

I think it will really improve the visual a lot, especially in cities and mountain areas. There is a requirement for shaddow effect in the sim to handle this "plugin". Maby even this is in the pipeline for X-Plane?

Best regards.


Benjamin Supnik said...

Anonymous: when we code new threaded algorithms, they usually have a core limit based on (1) what makes sense for the algorithm and (2) how many cores you have.

I believe that in the particular case of the installer file decompression it doesn't have a natural upper-limit...we ask the CPU how many cores it has, and then we use as many as it replies. So it runs on two cores on my iMac just because that's what the host replies.

This isn't always possible. For example, when we shift scenery, we process the tiles with one DSF per core -- since we at most have to shift 3 tiles (for a north-south shift) we never use more than 3 cores for this, even if you have them.

When we load DSF tiles, we use one core at the most; the loader has to fully finish one DSF before it can start prepping the next one (due to the way the edges are sewn together) so even if you have an 8 core machine, only one core is loading new DSFs at a time.

We always try to take the maximum parallelization when we can, to use more cores when they exist, but a lot of the time (particularly in the sim) natural limits on the algorithms cut down the number of cores we can use quite a bit.

Anonymous said...

Will X-plane in the future use Realtime-Raytraycing engine? According to Daniel Pohl, Realtime-raytracing has a very good multiple core rendering engine. In addition you can control the shadows, physics etc.
Below is the link that describes RealTime Reaytracing:


Benjamin Supnik said...

I think it's impossible to predict today what future technology X-Plane will use for rendering in the future. real-time ray tracing (RTRT) is just a clever demo in Intel's labs right wouldn't make sense for me to predict "yes, we will use this" only to have it never come to market!

Generally X-Plane doesn't get too close to the bleeding edge of technology..we think it makes more sense to spend our dev efforts on proven technologies that won't disappear and improving the sim, rather than jumping on technology bandwagons early (and having some of our work be useless when the technology never comes out).

What would have happened if we adopted HD-DVD as our distribution format? :-)

What would have happened if we adopted the PhysX card for physics? :-)

So...we'll wait and see if RTRT turns into a new rendering technology or just marketing hype. If it turns out to be viable and useful and meets x-plane's needs, THEN we'll look at using it...but we are miles away from that point right now.

If I had to place a bet, I'd bet against RTRT for a number of reasons...but the main point of this post is that LR shouldn't "bet" on the outcome of RTRT, we should wait and see.

If you are interested in the growth of technology and it's interaction with games, I suggest watching John Carmack's keynotes from QuakeCon. It's long (one video is 2 and a half hours) but basically you've got an expert in the field speaking freely about the direction of technology, and he brings up a lot of good points that counteract some of the hype out there.

Of course x-plane is very different from a 1st-person-shooter, but Carmack has things to say about all games that apply.