Skip to main content.


This is the archive for 19 June 2009

Friday, June 19, 2009

Falcon 0.9.2 is ready to be released, so I am exploring what to do next. Our plan was that of starting optimization since the first official release of Falcon, and we can really get big improvements in that area.

With this in mind, I started to search for a portable way to perform atomic operations.
I found some very interesting resources. With just this information and good inline wrappers, it is possible for Falcon engine to expose a cross platform atomic API which can be extremely good for multithreading. Many MT-sensible operations, as the GC block allocation and scan loops, has been designed with atomic operations in mind (in the sense that although implemented with mutexes, they are based on structures that are thought for atomic operations), and so using atomic operations there can be both simple and rewarding.

Some resources we'll be using:
A nice article on using GCC 4.1 portable atomic primitives.
GCC Docs on that.
MacOSX multithreading guide, with native CAS support operations.
MS-Windows Interlocked SDK
On SUN, there's a mysterious __rwstd::Interlocked* function set that I will investigate more.
Also, Sun C++ supports __thread keyword as gcc, which is much more efficient than functions accessing the thread local stack as TlsSetValue or posix_set_specific.