We expected problems with the current engine when we attempted to do this, and sure enough the console is much less forgiving than a Windows box. The majority of our code works however. No big issues.
Arguably the greatest performance consideration for a cross-platform XNA game is how to take advantage of the underlying system's chip architecture. Windows has been using Time-Division Multiplexing (or multi-tasking) for the best part of two decades now - running multiple tasks seemingly simultaneously. This is software multi-tasking, whereby multiple tasks are allocated time on the same processor by the operating system. This happens so fast, that as long as one task doesn't get stuck, it can give the appearance of multi-threading. It is not however, true parallel processing.
In newer systems, multiple cores allow for hardware simultaneous multi-threading (SMT). The XBox 360 is no exception. It's processing power is spread across 3 cores so care must be taken to squeeze out it's potential. Each core has two hardware threads - meaning a total of 6 truely independant tasks can be run simultaneously.
The XNA Framework sets two of these hardware threads aside for it's own logic, leaving four hardware threads available for the game. While multiple software threads can be run on a hardware thread, this is difficult and time consuming to optimise - not economical for a small project like this.
On an XBox 360, thread affinities are not set automatically. This means unless we multi-thread our engine, we will only take advantage of one hardware thread on one core, which is silly when we have four at our disposal. However on a Windows machine, if there are more threads than processors, they will be time spliced, so the conclusion - code for XBox first!
The ThreadManager component I'm working on will allow easy creation, monitoring, joining and locking of threads.
Major goals are:
- The intelligent distribution of semi-independent tasks across hardware threads.
- The prevention of lock ups.
- Asynchronous loading, networking and AI logic
No comments:
Post a Comment