Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In my experience, two approaches are preferred when people want to handle scripting in multithreaded environment.

  1. Synchronize every accesses to scripting module with one coarse-grained lock.
  2. No Synchronization - Scripting module should be used by just one logic thread.

Of course, both solutions are not scalable in multi-core perspective.

Question - Is there any other (multi-core) scalable solution?

share|improve this question
up vote 10 down vote accepted

Treat scripts like the GPU treats shaders- no global variables, limited inputs and outputs, that is, enforce thread safety via language rules.

share|improve this answer
Ah, side-effectless approach. It would be a good solution for some situation. Thanks for your answer! – summerlight Jan 23 '11 at 11:08

It's impossible to say what sort of synchronisation you need when you've not mentioned the kind of resources you will have your scripts accessing.

Personally, having looked at what happens in a couple of game engines and thought about the various implications of scripting with regards to concurrency, I'd be inclined to have all game logic and scripting running sequentially and have other features use your extra cores.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.