7.1. Parallelism

The most obvious way to implement parallelism would be to have a dedicated processor for each simulation object, and to have an operating system that keeps all these processors running in lockstep synchronization with each other.

At this stage in the history of computer science, of course, our computers are serial. At best you might have four processors running on your desktop machine. We simulate parallelism by keeping a master array of our ‘physics objects’ and trying to arrange our program so that the updates of the objects happen in a parallel fashion.

But why use an array? Why not give each object a concurrent execution thread, and let the threads execute in parallel? The fact is, by default, threads aren’t really parallel. ...

Get Software Engineering and Computer Games now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.