Threading Building Blocks (TBB) for Qt
I am building a CD ripper application in C++ and Qt. I would like to parallelize the application such that multiple tracks can be encoded concurrently. Therefore, I have structured the application in such a way that encoding a track is a "Task", and I'm working on a mechanism to run some number of these Tasks concurrently. I could, of course, accomplish this using threads and write my own Task queue or work manager, but I thought Intel's Threading Building Blocks (TBB) might be a better tool for the job. I have a couple of questions, however.
Thanks for any insights you can provide.
TBB is suppose to work well, even transparently, with other threading mechanisms so theoretically there should be nothing preventing you from using QT's thread classes in the same program. If there is something that works more naturally with QT threads, like the GUI, use them and keep the TBB stuff segregated as best you can or want.
I don't see that you are making the best use of TBB as you currently outlined your design. You parallelize at the grossest level, the file. As you suspect, since the CD is a pretty slow device, you may spend more time seeking back and forth for data from multiple files than you actually save.
The real bang for the buck with TBB should involve exploiting whatever data and/or task parallelism there is in the transformation process. Can you, for instance, pull any block of bytes out of the stream and apply whatever transform to it independently of any part of the stream before or after? Are there multiple steps to the transform that can be parallelized?
为什么不使用Qt并发?
链接地址: http://www.djcxy.com/p/64510.html上一篇: LLVM究竟是什么?
下一篇: 用于Qt的线程构建块(TBB)