Thanks to the data oriented paradigm followed, the engine’s tasks are discriminated in small chunks and it is easy to perform synchronized multithreading. Therefore BEPU physics runs in synchronized multithreading mode as frustum culling does. There are other operations that could run in multithreading fashion, but this has an overhead that could overpass the benefits, so be careful to select the right tasks.

The MultiThreadingTask class allows dividing a task into the available hardware threads. Since the threads could not be restarted, this class maintains the threads sleep until more work is ready to be processed. It also set the affinity in Xbox, because this platform does not have a thread scheduler.

If you divide a task try to use thread safe operations, even look for alternatives to avoid unsafe operations. For example, the frustum culling method generates several lists with the result that are merged after the threads are done; this is faster than lock one shared list. Also, the application thread continue its execution very quickly and therefore could run a little more work than the other threads.

Last edited Jan 22, 2013 at 8:14 PM by jischneider, version 7


No comments yet.