Gaffer Docs

What is Gaffer?

Gaffer is a game and simulation library with a focus on concurrency. As multicore chips are becoming the norm in consumer platforms, developers applying traditional game programming patterns are finding it increasingly difficult to utilize the entire system's resources on these new hardware architectures.

In lieu of describing this trend in detail, I direct you to Herb Sutter's excellent article, The Free Lunch Is Over.

I've been interested in both game and concurrent programming for many years. Gaffer is an effort to collect concurrent patterns I've studied and apply them to game programming. It turns out this is a challenging proposition, mostly due to the fact that games maintain a great deal of state information that must be availalble to multiple engine sub-systems.

Anytime you have shared access to data, concurrency becomes challenging. You options include:

  1. Use locks (doesn't scale past a few threads).
  2. Make copies of the data (impractical since game state data can be large and change often).
  3. Store state changes by helper processes into a list of "instructions" that are then executed serially by a master process each frame (decreases performance).
  4. Utilize hardware instructions that enable lockless concurrency (complexity increases and not very portable).
  5. Come up with a software approach that minimizes the need for data sharing, organizes processes within cores around the data they have access to, and still maintains useful concurrency on multi-core systems.

Gaffer represents my attempt at this fifth option.