Hot Chips Hoping to improve the state of server software, Sun Microsystems has confirmed that it will include support for transactional memory with the first generation of its Rock processors due out in the second half of next year.

Sun's research and development teams have spent years working on a type of transactional memory that combines software and hardware aids. Now, the company looks set to be the first mainstream chip maker to build transactional memory hooks into its chips. By leading the market, Sun hopes to foster early ISV and developer support for its technology, resulting in more multi-threaded code capable of using all the horsepower available in many core processors such as Rock, which will have 16 cores and support for 32 software threads.

"There are two, main goals here," Marc Tremblay, the CTO of Sun's chip business, told us in an interview. "One is that you get higher software and system performance. The other is that you enable parallel software. You help programmers coming out of school think in parallel concepts and end up with better applications."

The transactional memory (TM) technology borrows heavily from work done over the decades in the database field.

At its most basic level, TM routes around today's lock-based programming model where developers use a variety of techniques to stop software threads from accessing shared data at the same time. Rather than assuming that software threads will charge after the same information, TM bets on the notion that in many cases a single software thread will seek a unique chunk of data.

Tremblay compares the scenario to a bunch of chefs trying to make a soup. In today's world, only one chef can grab an ingredient from the cupboard at any given time and add it to the soup, unlocking and then locking the cupboard each time. While in the TM scenario, chefs can grab unique ingredients at the same time and add them to the soup. Should two chefs happen to add salt to the soup concurrently, the TM model provides a mechanism for rolling back the soup to its pre-salted state. (Our more savvy readers will please excuse this analogy.)

In terms a bit closer to developers' hearts, you can picture writing code where tens or hundreds of instructions are part of a transaction. The TM technology creates a checkpoint at the start of the transaction and maintains all of the involved instructions until there's a commit. At that point, you see an all or nothing scenarios where either all the loads and stores go through or none do.

The lock-based programming model proves tough for developers and often leads to system issues such as dead-locking where an interdependency of software locks is created stalling the code.

So, Sun has embraced a so-called hybrid transactional memory model where it cap tap into both hardware-based and software-based TM tools.

"HyTM exploits HTM support if it is available to achieve higher performance for transactions that do not exceed the HTM's limitations, and transparently executes transactions that do in software," Sun explains on its website. "Thus HyTM can use best-effort HTM to boost performance but does not depend on HTM. Programmers can therefore develop and test transactional programs in existing systems today and enjoy the benefits of HTM support as it becomes available."

Sun's own Solaris operating system and Java virtual machine are already set to use TM. But to make TM really pay off, Sun will need the support of the software community. According to Tremblay, the company has already started reaching out to the likes of Oracle, BEA and IBM for help.

Intel, AMD, Microsoft and IBM have all discussed TM technology as well, making this one of the hottest hardware/software fields. It does, however, look like Sun will lead the market with the technology, since it will ship limited TM support with the Rock chips next year.

"For the other companies, it will be harder because an Intel or AMD don't have all the pieces," Tremblay said, returning to Sun's favorite systems company refrain.

With any luck, all of the vendors will succeed in their push around TM technology, and we'll see multi-threaded code that can tap all of the horsepower in coming chips.

"That is the big carrot," Tremblay said. "If we all rally around this, we will have much better software written by the genius and the common programmers."

There's more information on Sun's transactional memory approach here. ®