4,580 Posts served
11,094 Conversations started
- Academic

- Android

- Art, Music, & Animation

- Embedded Computing

- Events

- Game Development

- Graphics & Media

- Intel SW Partner Program

- Intel® AppUp Developer Program

- Manageability & Security

- Mobility

- Open Source

- Parallel Programming

- Performance and Optimization

- Power Efficiency

- Server

- Site News & Announcements

- Software Tools

- Ultrabook

- Association for Computing Machinery TechNews (ACM)
- Go Parallel! (Dr. Dobbs)
- HPCwire (Tabor Communications, Inc.)
- insideHPC (John West)
- Joe Duffy's Weblog (Microsoft)
- Microsoft Parallel Programming Development Center (Microsoft Germany)
- MultiCoreInfo.com
- scalability.org (Scalable Informatics)
- Software Dev Blog (Intel Germany)
- Soft Talk Blog (Intel United Kingdom)
- The Moth (Microsoft)
Concurrent queue changes in Intel(R) Threading Building Blocks 2.2
By Wooyoung Kim (Intel) (6 posts) on September 4, 2009 at 8:14 am
The concurrent queue of Intel(R) Threading Building Blocks (Intel(R) TBB) changed significantly from 2.1 to 2.2, for the better, of course :) Member functions that have blocking semantics are dropped and those with potentially thread-unsafe semantics (mostly for debugging purposes) are renamed to indicate it clearly in their names.
(The changes have been incremental, and made available through 2.1 updates, so those who have followed the developer releases must have seen all the changes.)
The changes are three-pronged. First and foremost is drop of boundedness and the blocking operations. The 2.1. concurrent queue is of a one-fits-for-all kind. It is a bounded queue but when initially constructed, it is virtually an unbounded queue and only bounded by available memory in the system. It has a blocking semantics and push()/pop() make the caller wait until an available slot/item is found.
From 2.2 and on, concurrent queue is an unbounded queue with non-blocking operations only. The semantic change greatly simplified its implementation. As a side effect, we were able to move most of the implementation into the header, eliminating most virtual member functions. It also resulted in a few API changes.
1. Being unbounded means push() always succeed; it never blocks.
2. pop_if_present() is renamed to try_pop() to make its non-blocking semantics clear; pop() which has blocking semantics is dropped in favor of try_pop().
3. Being unbounded makes push_if_not_full()/capacity()/set_capacity() obsolete; they are removed.
4. The size of a concurrent queue becomes non-negative. size_type is changed to size_t from ptrdiff_t.
The second set of changes has to do with name changes of a few member functions to make their concurrency semantics more clear. Naturally, all member functions returning an iterator are prefixed with "unsafe_" (i.e., unsafe_begin()/unsafe_end()). More importantly, size() is renamed to unsafe_size() to signify the fact that with concurrent push/pop, the value may not represent the current size of the queue by the time it returns to the caller.
Lastly, a couple of new constructors were added. One is a copy constructor which takes another concurrent queue. And the other is one that takes a couple of InputInterators.
The 2.1 concurrent queue is still supported but with a different name, namely, concurrent_bounded_queue, and with a few name changes. For example, pop_if_present()/push_if_not_full() become try_pop()/try_push() to align them with those in concurrent_queue.
We strongly encourage Intel(R) TBB users to rebuild their applications with the new headers. As always, Intel(R) TBB supports the backward compatibility -- if you don't want to rebuild your applications your existing binaries built with the 2.1 headers should work with the 2.2 binaries without any problem. For any reason if you need to recompile your application but don't want to make any source changes, you can do so by compiling your application with TBB_DEPRECATED set.
Categories: Software Tools
Tags: concurrent queue, TBB
For more complete information about compiler optimizations, see our Optimization Notice.
Comments (0)
Trackbacks (6)
- Advancing Marketing
September 4, 2009 9:56 AM PDT - Intel Software Network Blogs » Concurrent queue changes in Intel(R … · ldfdc
September 5, 2009 12:04 AM PDT - Concurrent queue changes in Intel TBB 2.2
September 7, 2009 6:16 PM PDT - Intel Software Network Blogs » tbb::concurrent_vector in TBB 2.2
September 19, 2009 5:13 AM PDT - tbb::concurrent_vector in TBB 2.2
September 19, 2009 7:00 AM PDT - tbb::concurrent_vector in TBB 2.2 – Intel Software Network Blogs
October 28, 2010 10:21 AM PDT

