Recently, I was tasked with writing a multi-threaded C++ sample application as a way of highlighting Intel’s multi-core processors. I decided to write a file compression program that compresses the contents of a specified directory branch. Once the branch to compress is specified, the processing can be broken down into 3 clearly defined sub tasks: file scrub and input, block compression, and output to the compressed file. I envisioned each of these tasks running in its own thread, with thread-safe queues to pass intermediate work between them. Of the code I had to write, the trickiest, I thought, would be the 2 queues.
Before I finished coding the application, a new requirement was added to the project. Intel has released a new C++ runtime library called “Threading Building Blocks.” I was asked to use this library in the sample application. So I downloaded an evaluation version of TBB from here, and headed back to the design board.
TBB comes with great documentation, including a “Getting Started” guide, a “Tutorial” that goes into more depth, and an exhaustive reference guide. I read the tutorial first, which gave me all I needed for my purposes. TBB offers support for several threading paradigms, including loop parallelization, task pipelining, thread-safe containers, and much more. The TBB pipeline was the best choice for what I was doing. I put each task in its own C++ class, registered the classes with the pipeline, and let it run. The best part was that I didn’t need to write the queues; TBB provided for passing the intermediate data between tasks.
I must say that dealing with the Threading Building Blocks was an unexpected pleasure. My experience using software tools for the first time has been a mixed bag at best; it’s often extremely frustrating to understand and utilize these tools quickly. For instance, the public-domain compression engine I originally intended to use cost me hours of configuration and building headaches, and I never did get it to build in a way that I could use. I ended up tossing it out and using a different compression engine altogether. TBB on the other hand was well documented, easy to understand and implement, and worked right out of the box. I must say that the next time I need to write a C++ application using multiple threads, I’ll likely reach for TBB.
The sample application, along with a readme file that does into the TBB code in some depth, can be found here.
Richard Bowler
rbowler@3leaf.com
In this world, equal to others and to make them the difference between these two equal always exist. The former is the precondition of a free society, while the latter as D, tocqueville described, means "a new kind of slavery.Do you think so?
Posted by: Asics shoes | September 23, 2010 at 01:58 AM
Nice topic.thanks for this post, it helped me a lot. I like it Thanks for this nice article.
Posted by: ugg winter boots | September 29, 2010 at 12:21 AM
The TOS seems rather clear that it is not unless expressly approved by Amazon.
Posted by: Tiffany Jewelry | October 26, 2010 at 06:33 PM
This is a brilliant article
Posted by: CNA Training | October 31, 2010 at 11:59 AM
Whether coffee is thick is pale let scent infinite heart whether the distance is farther is nearly let friendship are close together no matter how is less contact is let blessing forever may flowers open happiness on your life.
Posted by: Jordan retro 6 | November 01, 2010 at 07:32 PM
i'm thinking of which of the 2 should i get?? the 15 or the 17 one.
Posted by: ugg adirondack tall boot | November 18, 2010 at 05:36 PM
As long as there is heart there is hope, there is happiness there
Posted by: air max shoes | December 16, 2010 at 11:42 PM
thanks for sharing! last day, i see some people talking about this!
Posted by: nike frees | January 02, 2011 at 10:14 PM
I cannot choose the best. The best chooses me. Do you like it?
Posted by: Jordan Kicks | January 17, 2011 at 05:12 AM
I have used both coop and free range methods. And really got very good experience from it.
Posted by: Packers jerseys | January 19, 2011 at 10:11 PM
I am asking because I have tried this and I am facing a crash which I haven't been able to debug.
Posted by: Packers jerseys | January 19, 2011 at 10:12 PM
Never knew what was in tears, because of the loss, I tasted the taste of tears.
Posted by: Nike Free Shoes | March 06, 2011 at 07:01 PM
Thank you for sharing. Very happy to see your article, I very much to like and agree with your point of view. Have a good time.
Posted by: Exterior Accessories | May 05, 2011 at 12:05 AM
The a+ Certification exam number 220-701is probably the easiest computer certification i have taken
Posted by: 220-701 | May 23, 2011 at 10:21 PM
Great post. I found it interesting...
Posted by: Cna Training | June 13, 2011 at 02:11 AM
it is ok
Posted by: Louis Vuitton Bags | July 17, 2011 at 05:37 PM
it is ok
Posted by: Coach Factory Outlet Online | July 17, 2011 at 06:36 PM
it is ok
Posted by: Coach Handbags | July 17, 2011 at 06:54 PM
thanks for seeing ... thank you for sharing with us
Posted by: tory burch reva | July 17, 2011 at 11:50 PM
Thanks for sharing this great and quality content with us. I hope you will get more info and definitely share those info with my closed friends
Posted by: Uggs Outlet | August 10, 2011 at 01:47 AM
Wise man have their mouths in their hearts, fools have their hearts in their mouths.
Posted by: burberry trench | September 12, 2011 at 07:45 PM
Start blogging by creating a new post. You can edit or delete me by clicking under the comments. You can also customize your sidebar by dragging in elements from the top bar.
Posted by: outlet moncler | September 17, 2011 at 01:59 AM
I like you on facebook and follow through google reader!
Posted by: red bottoms | October 10, 2011 at 11:31 PM
Its because of stuff like this that I love this site :D You guys rock.
Posted by: cheap handbags | October 19, 2011 at 06:55 PM
HHH Yes, the design of national policy is important, how our economic development plans for the next five years, how the implementation, how to make our economy even faster. Are designed to advance our focus to invest money in what ways it should be carefully arranged.
Posted by: justin bieber supra | November 02, 2011 at 01:58 AM