Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Use Cases for Concurrent Data Structures

2 views
Skip to first unread message

Scott Meyers

unread,
Sep 2, 2010, 3:37:21 PM9/2/10
to
Libraries of data structures designed to support concurrent operations and to
scale well with the number of threads are common, e.g., ConcurrentHashMap and
ConcurrentLinkedQueue in Java, ConcurrentQueue and ConcurrentBag in .NET,
concurrent_queue and concurrent_vector in TBB and PPL. If the comments in a
recent thread in comp.lang.c++ ( http://tinyurl.com/2ey8mta ) are
representative, however, there is considerable skepticism that such data
structures are useful and some concern that designs employing them are almost
certainly misguided. Considerable googling on my part has failed to turn up
examples of compelling use cases for these kinds of data structures, but I find
it hard to believe that the people at Sun, Microsoft, and Intel (among others)
have devoted so much effort to creating libraries of data structures for which
there is little use.

I'd be grateful if people could sketch compelling use cases for concurrent data
structures, ideally with examples of situations in which they have been
successfully employed. Such data structures need not be lock-free (e.g., they
might use fine-grained locking or lock striping), but they should be
substantially more scalable than a design based on locking an entire data
structure for each access.

Thanks,

Scott

--
* C++ and Beyond: Meyers, Sutter, & Alexandrescu, Oct. 24-27 near Seattle
(http://cppandbeyond.com/)
* License my training materials for commercial (http://tinyurl.com/yfzvkp9) or
personal use (http://tinyurl.com/yl5ka5p).

Scott Meyers

unread,
Sep 2, 2010, 3:43:11 PM9/2/10
to
Sigh, I meant to post this to comp.programming.threads...

Alexander Terekhov

unread,
Sep 2, 2010, 6:50:08 PM9/2/10
to

Scott Meyers wrote:
>
> Sigh, I meant to post this to comp.programming.threads...

:-)

Think of something along the lines of concurrent

http://www.cplusplus.com/reference/string/string/c_str/

I mean:

/* ... */
atomic<stuff *> stuff_ptr;
/* ... */
}; // class thing

const stuff & thing::stuff_instance() { // "lazy" one
stuff * ptr;
// hoist load barrier (with data dependencyncy "hint")
if (0 == (ptr = stuff_ptr.load(msync::ddhlb))) {
ptr = new stuff(/*...*/);
// sink store barrier
if (!stuff_ptr.attempt_update(0, ptr, msync::ssb)) {
delete ptr;
// hoist load barrier (with data dependencyncy "hint")
if (0 == (ptr = stuff_ptr.load(msync::ddhlb)))
abort();
}
}
return *ptr;
}

It really scales.

regards,
alexander.

Alexander Terekhov

unread,
Sep 7, 2010, 10:34:13 AM9/7/10
to

frege wrote:
[...]
> All BoostCon2010 talks are at http://www.boostcon.com/community/wiki/show/private/2010/.

http://www.boostcon.com/community/wiki/show/private/2010/ points to

http://www.filetolink.com/06c4fa2d
(Tuesday Presentations, C++0x Concurrency)

Michael Wong's Tuesday presentation caught my attention (just read the
pdf).

It would be nice to have it available as

> The chart I'm talking about is in my slides http://www.filetolink.com/7dd7b80e
> page 12. Some of the talks are already up at blip.tv http://blip.tv/posts/?q=boostcon.

.tv video as well, I think.

Is it possible?

regards,
alexander.

frege

unread,
Sep 7, 2010, 10:41:27 PM9/7/10
to
On Sep 7, 10:34 am, Alexander Terekhov <terek...@web.de> wrote:
> frege wrote:
>
> [...]
>
> > All BoostCon2010 talks are athttp://www.boostcon.com/community/wiki/show/private/2010/.
>
> http://www.boostcon.com/community/wiki/show/private/2010/points to

>
> http://www.filetolink.com/06c4fa2d
> (Tuesday Presentations, C++0x Concurrency)
>
> Michael Wong's Tuesday presentation caught my attention (just read the
> pdf).
>
> It would be nice to have it available as
>
> > The chart I'm talking about is in my slideshttp://www.filetolink.com/7dd7b80e
> > page 12.  Some of the talks are already up at blip.tvhttp://blip.tv/posts/?q=boostcon.

>
> .tv video as well, I think.
>
> Is it possible?
>
> regards,
> alexander.

All the talked were recorded, and will hopefully appear on blip.tv
sooner or later. But it is volunteer work, and takes time.

Tony

0 new messages