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
Hi. I've just started using TBB myself. I must say I like the approach, but I'm skeptical of the concurrent_* containers among other things.
Since you wrote this post a year ago, I'm wondering, how has your experience with TBB been lately. Is it worth persevering for bigger projects?
Posted by: Gomez | September 27, 2007 at 09:31 AM
Have you tried running multiple pipelines in parallel using parallel_for? I am asking because I have tried this and I am facing a crash which I haven't been able to debug.
Posted by: Aaron | August 18, 2009 at 11:40 PM
Blogs are so informative where we get lots of information on any topic. Nice job keep it up!!
Posted by: HR Dissertation | November 04, 2009 at 06:53 AM
Hey man,
I really like your podcast. Your into the past feature is really good, and you cover the standard stuff well also.
Boy did you get hooked up with a NICE preview card. This set's power level is blowing away all sets in recent memory. Every new card previews is like "WHAT!?!" *mind-blown*. I swear I've lost 5 minds this week alone. Nichol Bolas is absolutely crazy. A tad superfluous due to Cruel ultimatum, but man, what a limited Timmy moment would that be to slap that guy down. Your preview card it really sick. Especially in extended, where there is already a life from loam deck ready to adopt by splashing white.
Anyway, I'm a big fan, and i have a blog myself where I'm trying to "go infinite" on Magic Online by winning constructed tournaments.
keep up the great show
Posted by: buy cialis | April 27, 2010 at 01:38 PM
Rivera would have to give up a lot of the money he's already raised for his Senate bid because it's corporate -- but his donors could give it back to him. But there's also word that strategist Carlos Curbelo may throw his hat in. A little over a year ago, Curbelo lost to Rivera by a sole vote in the race to chair the Miami-Dade Republican Party.
The race could have implications for other races on the ballot: Curbelo is loyal to Senate candidate Charlie Crist; Rivera is tight with his primary challenger Marco Rubio. But they share one thing with the Diaz-Balarts: both are ardent supporters of the embargo against Cuba. Curbelo has never held elected office.
Curbelo called Diaz-Balart the "personification of honorable public service. That's his legacy. Our community is losing a strong voice in Washington but is gaining a private citizen that will continue working for the causes that unite us."
Posted by: sildenafil citrate | April 27, 2010 at 03:46 PM
I'd be interested in hearing. The TOS seems rather clear that it is not unless expressly approved by Amazon. I guess if the library got it in writing then they would be ok.
Posted by: kamagra jelly | April 27, 2010 at 03:56 PM
It wasn't long after job boards were "invented" that someone thought of the concept of job scraping. If you can't get enough vacancies posted on your site why not simply "copy" them from elsewhere, thus giving the impression of a busy job board. Some job boards do this covertly and jobseekers may not even be aware the job was originally posted elsewhere, whereas for other job boards this is their clear business model (including to a certain extent the job search engine sites like clickajob).
However, when a site scrapes your vacancies, adds additional (and untrue) information and then refuses to remove them it's got to be pretty annoying.
Posted by: sildenafil citrate | April 27, 2010 at 06:10 PM
Excellent post. It makes me realize the energy of words and pictures. I learn a lot, thank you! Wish you make a further progress in the future.
Posted by: New Jordans | May 07, 2010 at 12:51 AM
Hey man Very inspiring article. basically
I am a .Net programmer. But earlier I I wanted to be a system programmer. But I could not succeeded in that field. When I read this article It inspire me about system programming. Please provide me good site where I could read such articles.
Thanks for sharing
......Alex
Posted by: viagra pills | July 02, 2010 at 10:49 PM
New C++ lanuguage must be smarter than before.
Posted by: generic viagra uk | July 06, 2010 at 04:37 AM
Pipe Valves Are A Popular Category In Pipe Fittings. Pipe Valves Are Mechanisms Or Devices To Regulate Or Control The Flow Of Liquid Or Gas Within A Pipe.
Posted by: accounting homework help | July 08, 2010 at 02:37 AM
Pipe Valves Are A Popular Category In Pipe Fittings. Pipe Valves Are Mechanisms Or Devices To Regulate Or Control The Flow Of Liquid Or Gas Within A Pipe.
Posted by: balance sheet homework help | July 20, 2010 at 12:32 AM
Don't know what is wrong what is rite but i know that every one has there own point of view and same goes to this one
Posted by: Send flowers to Korea | July 20, 2010 at 03:03 AM
Yes... it seems that the media is very biased to their own way of thinking and hasn't improved since you wrote this article.
Posted by: free cna training | July 23, 2010 at 04:56 AM
Hey I have tried running multiple pipelines in parallel using parallel_for and I am facing a crash which I haven't been able to find a solution. Do you know the answer ? Please help me..
Posted by: comments system | July 25, 2010 at 11:54 PM
I really like this write! I enjoy it so much! thanks for give me a good reading moment!
Posted by: Nose Rings | July 26, 2010 at 03:32 AM
Thanks a great deal! I truly enjoyed reading this.Looking via these posts and also the material you've provided I can appreciate that I still have a great deal of things to learn.
6.These articles are fantastic; the specifics you show us is interesting for everybody and is really wonderful written. It’s just outstanding!!
Posted by: Puma Shoes | August 08, 2010 at 06:05 PM
Count your age with friends but not with years. Good luck to you!!
Posted by: Jordan 8 | August 08, 2010 at 11:26 PM
Does any other country manufacture the seperate vaccines, measles, mumps ect.. and if my child only got one dose of the measles how effective is it? Do all countries use MERCK?
Posted by: viagra online | August 17, 2010 at 02:43 PM
Your opinion is very unique! Very own set! Rarely see such an article! I think you would probably a lot of thought in it now! I appreciate your talent
Posted by: creative recreation | August 20, 2010 at 12:53 AM
I'd be interested in hearing. The TOS seems rather clear that it is not unless expressly approved by Amazon.
Posted by: NFL Jerseys | August 22, 2010 at 06:52 PM
I love that drawing! It reminds me of that old TV show (might still be going actually..) in North America called The Big Comfy Couch. Definitely need on of those at home!
Posted by: ugg knightsbridge | August 23, 2010 at 06:57 PM
I can’t say enough good things about this air jordan shoe, whether you are traveling or reside in a warmer climate,check them out. They are the shoe equivalent to the little black dress.
Posted by: air jordan | September 04, 2010 at 02:35 AM
Research has militantly man is happy! Through research that oneself can get rid of the spiritual delusion and rid yourself of vanity new happier.Do you think so?
Posted by: New Balance Shoes | September 15, 2010 at 07:02 PM
Your write-up is fantastic. It is essentially extraordinary to me. I like it greatly and I hope to determine you additional content articles.
Posted by: New Balance 574 | September 19, 2010 at 07:40 PM