David (dblume) wrote,

So you want to be a software developer?

We live in interesting times. The free lunch we got from Moore's Law is over. So we all have to program with concurrency in mind.

No big deal? Consider the fact that most of C++'s standard smart pointers still don't support atomic writes. Not Boost's (documentation), not Loki's (despite an MT ownership policy) not Scott Meyers's. What's that mean?

shared_ptr p(new int(42));

// thread A (supposedly owning)
p = shared_ptr(new int(1942));      // re-writes p

// thread B (supposedly reading)
    shared_ptr p2(p);

What otherwise looks like one thread owning the resource and another thread inspecting it, is actually undefined behavior.

Herb Sutter and Andrei Alexandrescu have written complex multi-part articles in the C/C++ User's Journal addressing variants of the issue, and almost always with corrections the next month. It's a topic almost impossible to get right.

The current state of the art seems to be led by Joe Seigh with his atomic_ptr. Apparently similar to patent 20060037026.

An "introductory" article can be found in the December 2004 issue of the CUJ, Atomic Reference Counting Pointers by William K. Reinholz.
Tags: programming

  • Progress on my Google+ and LJ backups

    Since Google is going to shut down Google+, I decided it was time to really make a home for my LiveJournal backup and my Google+ backup. Working…

  • Getting Shit Done

    I came across an old LifeHacker article Get Shit Done Blocks Distracting Web Sites So You Can Do As the Name Instructs, that mentions a productivity…

  • Happy Birthday, Me. I got you data portability!

    My list of addresses has made its way from a physical address book, to a Palm Pilot, to Microsoft Outlook, to Google Contacts to the iPhone Contacts…

  • Post a new comment


    Comments allowed for friends only

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 1 comment