Jump to content
  • Advertisement
Sign in to follow this  
Pombal

Threading in component based systems

This topic is 2691 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I was wondering what would be the best approach to make a component system parallel. My idea is to make each component a "job" or task that could run in parallel with other tasks. One of my concerns is synchronization because ideally no locks should be used. If this was already discussed could you point me to the thread? I searched and found nothing.

Share this post


Link to post
Share on other sites
Advertisement
You can do two levels of parallelism in a component system, there are components that can run in parallel and component instances that can run in parallel. The simplest thing to do is make sure that no instances can talk to each other within a component type. If they do have to talk to one another, use a lock-free message queue to deliver messages to be processed the next frame. That way you can just toss all instances into a thread pool, waiting on each type to finish the parallel update before launching the next type.

Share this post


Link to post
Share on other sites
Could you elaborate on the difference between components and component instances?
And if you're waiting for a type of component to finish updating, suppose you have 4 threads and 3 of them finished updating that type. They could do no work because the remaining thread didn't finish updating that type and we didn't launch the next type. Did I misunderstood something?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!