Jump to content
Posted 13 February 2012 - 06:04 AM
Posted 13 February 2012 - 06:21 AM
Senior Systems Programmer
Posted 13 February 2012 - 07:06 AM
Posted 13 February 2012 - 08:13 AM
Specifically, I am currently working on my physics system. I have one task that updates forces (simple vec3 PODs) by applying drag based on the current velocity. Likewise I have a collision resolution task. How can I atomically update the vector3D's on an x86? I was considering storing a queue in the gateway of requested changes, but this still wouldn't avoid one thread reading a vector while the gateway was midway through applying an update. Is the gateway approach unsuitable for non-PS3 games?
Vector3D old_position; Vector3D new_position; // similar for other values, such as velocity perhapsTo apply drag, read from old_position (old_velocity), compute new values, write them to new_position (at same index).
Likewise I have a collision resolution task.
Posted 13 February 2012 - 09:07 AM
Atomicity, especially on multi-core depends on cache lines. The problem you should be worried about is false sharing. When two cores work on values sharing the same line, each write causes a cache sync, stalling both of them.
Posted 13 February 2012 - 09:36 AM
(from profiling I know that the physics systems are the bottleneck
Posted 13 February 2012 - 10:10 AM
Posted 13 February 2012 - 10:42 AM
Passing data between threads is incredibly expensive, so work done separately must be orders of magnitude bigger to absorb it.
Interesting. I had assumed that the threading overhead would be low enough
Yes, but one core does updates, the other does collision. Both operate on their local copy of entire state they need.
that splitting the update integration and the collision systems to different cores would make sense
Are there any open source projects that you know of demonstrating these ideas?