Different Methods of Threading
Throughout the presentation, Valve mentioned that implementing Multi-Core processing technology into Source was very exciting but equally scary and challenging. Even for one of the most talented gaming houses in the world, adding in this technology was quite an exercise and a real challenge.
Valve spent many months and pain staking hours trying to work out the best method of implementing Multi-Core into their games - there are millions of lines of code which need changing and that's no easy feat. There are a total of four methods which were discussed and comprehensively tested by Valve and we'll give you a quick run down now on what was discussed in the board room.
Only a single method could be chosen and we'll tell you why a certain method was selected by Valve over another and why others were fully tested but were found not feasible for implementation in the Source engine.
- Single Threading
Single threading (single core) has been around forever and it is the easiest method of the lot. You only need to program for a single core and it is a simple task but now it is obsolete and the rewards in terms of improved experiences for the gamer from single threading are not existent.
This method of threading has been around for ages and game developers know it back to front. Now though for developers like Valve, it's time for them to put on their thinking caps, push their brains to the limits, spend a lot of cash and work out the absolute best method of threading which will reap the best rewards for gamers using the Source engine.
- Coarse Threading (Multiple Single Threads)
This method of threading is a little more difficult than single threading but not all that advanced in its procedure. It places whole systems on a certain core. For instance, rendering is performed by Core 0, AI is performed by Core 1, physics is performed by Core 2 and so on. In this case, you're keeping each task individualized to a certain core - this type of technology is more difficult than single threading but isn't that hard to program and hence the ending results aren't too impressive.
Valve never intended to use this Multi-Core implementation in Source but still they felt it important to experiment with it. They noticed performance improvements of around 1.2x in real-world testing (2x using contrived gaming maps) using this method but quickly worked out it wasn't the most effective method of threading in terms of rewards for the overall gaming experience.
For one, once the number of cores on the CPU out numbers the amount of game systems required (AI and so on), the method quickly becomes obsolete as the CPU cannot be 100% utilized and that is one of the most important factors when choosing a threading method as stated many times to us by Valve.
- Fine Grained Threading
The next method which Valve tested was more difficult than Coarse Threading. The idea of this method is to take many identical tasks (data operations) and divide the work across all of the cores on the CPU.
For instance, you have 1000 operations which need to be completed - it simply delegates those operations to each core. So for the new Intel Quad Core processor, 250 operations are sent out to each core for completion. This type of threading scales well which is good news for future processors which come with 8 or 16 cores (and more) but at the same time it is difficult because Valve must make sure that each operation is completed on time by each core as that data may be required by another core and so on.
While this method scales brilliantly (as you can see from graph above) even to the point of the estimated 32 core performance, it was seen to have too many possible problems and difficulty and was marked off the list of possible threading methods.
- Hybrid Threading
The final method is Hybrid Threading and it is the method which Valve finally decided to use for implementing Multi-Core processing into the Source engine. It provides the best rewards in terms of scalability, CPU utilization and performance improvements as it the most difficult method of threading.
It is the most difficult of the lot because it uses a mixture of Coarse and Fine Grain threading technologies - Valve saw the advantages of each threading method and put them all together to create Hybrid threading for their Multi-Core technology implementation needs.
So, from the Coarse threading method, you have certain systems which can be put on a certain core or in this case, cores. For instance, Valve will place the sound processing on a single core. It is happy there - it doesn't need to interact with the other cores and data operations. Then using the method of Fine Grained and Coarse threading combined together, it can intelligently decide which cores handle which operations. Unlike Fine Grained threading alone, the operations (be it AI, physics, rendering or whatever else) can be sent out for completion by multiple cores, which means that all the cores in the computer can be utilized, all of the time. 100% CPU utilization was one of the key factors for Valve and they managed it with Hybrid threading.
In the future when CPU's are released with more than four cores, this type of threading will be able to be utilized 100% just fine as it uses the Hybrid method is able to scale to "N" amount of cores. Perfect!
We are truly in a Multi-Core processing world now and this type of Multi-Core implementation by Valve is good news for gamers as the big bucks you spend on brand new uber processor with X amount of cores will actually be able to be utilized. It will be able to provide you with plenty of cool new effects and make the game seem even more true-to-life such as individual shadows for each character in the game and even change the shape of the body of the character depending on if he/she was shot or kicked or whatever. Kick ass!
Page 2 of 4
Further Reading: Read and find more Software content at our Software reviews, guides and articles index page.
Do you get our RSS feed? Get It!