Friday, January 7, 2011

Differential Reference Counting

Just published an article on Differential Reference Counting - reference counting algorithm which provides strong thread-safety and permits useful use cases that are not permitted by plain atomic reference counting (like boost::shared_ptr).


  1. I guess this is not correct way to use the smart pointer.
    This does not differ from the variant with a regular global pointer, without any reference counting at all.

    T * ptr;

    // thread 1
    ptr->SomeMethod(); //The problem is the same - who is freeing it at this time?

    To use it properly, we have to increment the reference counter safely in the thread, who is already an owner of the resource :

    // thread 1
    shared_ptr ptr(new T);
    // now this thread is a sole owner of the resource

    // lets share it with another thread.
    shared_ptr ptr2 = ptr;// The counter was incremented in this thread - nobody could free it.

    CreateThreadWithContext(Thread2Func, ptr.get());

    // thread 2
    void Thread2Func(T * p)
    shared_ptr ptr(p, false);// false means NOT to increment reference counter again

    ptr->SomeMethod();// You can use it safely, You are already an owner, nobody can free it.

    }// destructor of shared_ptr decrement reference counter, and free the resource, if this thread is its last owner.

    It may be enough for safe life-time management.

    But your idea is interesting as a access point to some resource.

    1. The effectiveness of IEEE Project Domains depends very much on the situation in which they are applied. In order to further improve IEEE Final Year Project Domains practices we need to explicitly describe and utilise our knowledge about software domains of software engineering Final Year Project Domains for CSE technologies. This paper suggests a modelling formalism for supporting systematic reuse of software engineering technologies during planning of software projects and improvement programmes in Project Centers in Chennai for CSE.

      Spring Framework has already made serious inroads as an integrated technology stack for building user-facing applications. Spring Framework Corporate TRaining the authors explore the idea of using Java in Big Data platforms.
      Specifically, Spring Framework provides various tasks are geared around preparing data for further analysis and visualization. Spring Training in Chennai

  2. > I guess this is not correct way to use the smart pointer.

    It's an incorrect way to use a reference counting algorithm, if it does not support such usage. However, if it does support such usage, then it's a correct usage.
    Btw, smart pointers are no more than a syntactic sugar.

  3. Students, this blog post will help you make a right college packing list to move to the dorm.

  4. เกมออนไลน์ แจกเครดิตฟรี slot online คลิกเลย


  5. How do you clean a fabric sofa?

    How much does it cost to have a sofa cleaned?

    How do you clean a sofa?

    Can you get a couch professionally cleaned?

    شركة تنظيف كنب بمكة بالبخار

    شركة تنظيف كنب بمكة بالبخار

  6. Charlie Hunnam sons of anarchy vest is an ideal vest for Bikers if you are willing to impress the viewers. SHOP NOW!

  7. You are one straightforward writer for this. And get tok know about Subway Surfers download now!

  8. Browse all Instagram on the web, Instagram web viewer online, Picks the most popular hashtag and interesting users and story on Instagram viewer.

  9. great stuff looking forward more content
    zara 4p analysis

  10. If you are looking expert in assignment then hire our experts Assignment help

  11. There are a great number of absolutely uncountable dating sites all over the globe, all are monotonous and there is very hard time seeking love. I have paid little interest whatsoever to these pages, I always assumed that these sites were just a hoax and it was difficult to find love. However, I was happily shocked when I sought such a fantastic service as ukrainian mail order brides. It was really simple to choose a girl so all of them were on the website and the staff helped me choose the girl that was just the one I wanted!