Home arrow Development Cycles arrow Page 3 - A Peek into the Future: Transactional Memory
DEVELOPMENT CYCLES

A Peek into the Future: Transactional Memory


It is no secret now that the future is about multiprocessing! The Xbox360, which was released November 2005, is equipped with three hyper-threaded processors. The new PS3 is going to be equipped with the Cell processor having eight processing units (only seven are available to programmers). Even on the PC, we are seeing a rapid increase of dual core processors on both desktops and laptops. The happy days of exponential increase in processor clock speeds are over. Welcome to the world of multiprocessing!

Author Info:
By: Mohamed Saad
Rating: 5 stars5 stars5 stars5 stars5 stars / 4
June 19, 2006
TABLE OF CONTENTS:
  1. · A Peek into the Future: Transactional Memory
  2. · Previous synchronization mechanisms
  3. · Transactional memory
  4. · So why is it not being used everywhere now?

print this article
SEARCH DEVARTICLES

A Peek into the Future: Transactional Memory - Transactional memory
(Page 3 of 4 )

Transactional memory is believed to be the synchronization scheme of the future. First, it is much harder to get a deadlock with transactional memory (even though it is still possible), and second and most importantly, it doesn't suffer from the granularity problem described above. In other words, if two threads are accessing the same data structure, but are accessing different portions of it, the transactional memory scheme will let them proceed in parallel without any overhead. Intervention is needed only when two threads try to access the same portion of a data structure.

How will the programs look?

Transactional memory doesn't use locks or tokens or anything. It is based on the concept of a transaction. This can be described as an all-or-nothing approach. If your transaction can execute from beginning to end without conflicts, it will proceed and all the changes will be made. If any conflicts occur, it will roll back and all changes are cancelled.

Remember that array copying example? Let's see how it would look.

  Subroutine Move(Array A, Array B)
   
Atomic
   
{
      Read X from Array A
     
Write X to Array B
   
}

Very simple and neat, isn't it? What does this really do? Quite simply, it tells the compiler that you should try to read an element from array A and write it to array B. But, here is the catch, you should do this as one transaction. If at any time you detect any conflicts, roll back and assume that you have done nothing. For example, if you read from A without problems, and then detect a conflict while writing to B, you should abort the writing part, AND you should throw away the value X you read from A. This last part is very important, because some other thread could be trying to move an element into A. Since we have rolled back, we can no longer use the value we read from A. We should retry the whole transaction from the beginning. This way, we are always sure our data structures are consistent and having no conflicts.

As you can see, transactional memory systems are based on an optimistic approach. They let all the threads execute and only roll back when a conflict is detected. As you might guess, in real life, conflicts don't occur all that often! So, typically a transactional memory system should be able to outperform other schemes. It is also much simpler than locks and monitors. Finally, as mentioned before, it is not easy to get a transactional memory scheme to deadlock.


blog comments powered by Disqus
DEVELOPMENT CYCLES ARTICLES

- Division of Large Numbers
- Branch and Bound Algorithm Technique
- Dynamic Programming Algorithm Technique
- Genetic Algorithm Techniques
- Greedy Strategy as an Algorithm Technique
- Divide and Conquer Algorithm Technique
- The Backtracking Algorithm Technique
- More Pattern Matching Algorithms: B-M
- Pattern Matching Algorithms Demystified: KMP
- Coding Standards
- A Peek into the Future: Transactional Memory
- Learning About the Graph Construct using Gam...
- Learning About the Graph Construct using Gam...
- Learning About the Graph Construct using Gam...
- How to Strike a Match

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials