Wednesday, September 20, 2006

Concurrency without Threads

I'm still investigating options for implementing concurrent solutions in game-like applications. I haven't found many high level languages which provide options for using real threads. Ruby, Chicken-Sceme, Bigloo Scheme, Ruby, Erlang. None of these provide real threading.

I think it's time I stopped thinking about threads, and started thinking about concurrency.

One idea I'm considering is the use of a Linda style system which is designed to provide a tuple-space on a local machine only. For performance reasons, access to the tuple-space would need to be implemented via some kind of shared memory facility.

The tuple-space approach could be ideal for game development processes. For example, the main process could push scene information into the tuple-space, where it is read by a second process which performs culling operations on the scene, and pushes the viewable set of scene nodes back into the tuple space. Meanwhile, the main process could be running the physics simulation, processing sound etc. This approach would require writing a separate program which works cooperatively and concurrently with the main program. No forking, and no threading.

1 comment:

Anonymous said...

I'm also investigating the issue of concurrency in games and right now i'm leaning towards an approach similar to Stackless Python's tasklets but a bit more generic (the tasklets would be assigned to real threads if the hardware or OS supports them).

Linda sounds like a nice generic approach for synchronizing tasklets, thanks for pointing it out.

Popular Posts