Original Post
Hi. This is my first post, but I've been following the forums for some time. I'm currently making the transition from XNA to C++ (various libs). I have successfully ported several projects, but my reason for making the change was for the performance benefits. I've been reading a number of posts/tutorials/presentations on data oriented design (notably Mike Acton's posts). This lead to a small performance boost in a single threaded environment, but now I want to multi-thread my task scheduler. I was hoping to make use of a lock free approach (similar to the gateway approach outlined here: http://macton.smugmug.com/gallery/8611752_9SU2a/1/568079120_gzhk8#!i=568079120&k=gzhk8) but I'm struggling.
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?
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?