Sponsored By

Feature: 'Multi-Threaded Interlocked Operations'

In today's other Gamasutra feature, veteran game programmer Philippe Paquet, currently working at U.S. developer The Collective, discusses the advantages and implementation of interlocked operations within a multi-threaded programming environment.

Quang Hong, Blogger

June 30, 2006

1 Min Read

In today's other Gamasutra feature, veteran game programmer Philippe Paquet, currently working at U.S. developer The Collective, discusses the advantages and implementation of interlocked operations within a multi-threaded programming environment. Here, he discusses the pros of interlocked operations: "Compared to classic lock mechanisms, interlocked operations are the most lightweight and efficient synchronization primitives. The advantages are many. Interlocked operations are directly supported by the hardware in the form of one or many processor instructions. Compiler support is provided in the form of intrinsic functions. That configuration is very cache friendly. The flow in the instruction cache will not be disturbed by using an interlocked operation while the data cache may take a minimal hit, depending on the platform memory model. There is no wait state with interlocked operations. When you try to acquire a mutex object or a critical section, your thread may have to wait for them to be released while interlocked operations are performed immediately. That specific property is the base of lockless programming. Lockless programming is a model where synchronization is achieved using non locking primitives. Alternative names are or lock-free, non-blocking and wait-free programming. As lockless programming is notoriously difficult, don't expect to make your application totally lockless. Instead, concentrate your efforts on trying to make lockless some of the algorithms you are using." You can now read the full Gamasutra feature on the subject, including example code implementations (no registration required, please feel free to link to this feature from external websites)

Read more about:

2006

About the Author(s)

Quang Hong

Blogger

Quang Hong is the Features Editor of Gamasutra.com.

Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like