Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Note: this is a reposting as the question has been considered non-suitable for the Stack Overflow forum and should have been posted here. The original topic is there.

I'd like to talk of multithreading, parallelism and the libraries available today to achieve that work. I'm especially wondering whether an easy-to-use library to achieve this concept (given below) already exists, or whether it would have to be written, and how hard it would be.

The purposes of the library I'm looking for:

  • accessible to most developers, not only to engineers or highly graduated persons (this should mean developers WANT to use it, not being afraid of it)
  • available to C++ developers
  • portable (start with Windows, Mac OS X and Linux, then extend to mobile devices)
  • lightweight
  • easy-to-use (related to accessibility)

The most important features I'm looking for:

  • task parallelism
  • task cancellation (in a soft and abrupt manner)
  • task dependencies

The existing related libraries:

  • Thread Building Blocks : really complicated to use, and rather restrictive licence (GPL / commercial), it's the only library that I've found and that includes all of the features I'm looking for
  • Grand Central Dispatch : currently not portable, not too complicated, no task cancellation (once started), no task dependencies, no automatic dependency support (only manual)
  • PFunc : Unix only, still a bit complicated, no task dependency, no task cancellation
  • Microsoft Task Parallel Library : MS platform and .NET only, no hard cancellation, restricted and manual task dependencies (one task cannot wake up more than one other task)
  • OpenCL : not currently available on all platforms, not much more that an GPU parallel task library (not as high level as I would wish)
  • OpenMP : widely supported except free versions of Visual Studio, no task cancellation nor automatic task dependencies

So what are your thoughts about all of these? Why do you think there are so few libraries corresponding to these needs? Or did I miss some great library? And do you think it would mean too much work to achieve one? Or not interesting enough? Note that the lacks I wrote are those I found out with some searches, I'm not a expert in any of these libraries.

The final purpose of this library, even if it's rather a dream, would be programming in a parallelized way as easily as you usually do with sequential programming.

Ceylo

share|improve this question
    
This is not a forum. –  DeadMG Aug 14 '11 at 17:47
    
although not pertinent to you question -- have you looked at Erlang –  good_computer Aug 14 '11 at 17:53
    
@DeadMG - just curious, what is the difference between this and a forum? –  Zeke Hansell Aug 15 '11 at 3:15
    
The difference is that this is only Q&A. Forums are for discussion. This place is not for discussion. –  DeadMG Aug 15 '11 at 11:03
    
@DeadMG - I guess that answers my question. And I guess by saying so I'm only letting you know that you answered my question. I wouldn't want to be accused of having a discussion on a Q&A site. ;-) –  Zeke Hansell Aug 24 '11 at 17:18

1 Answer 1

up vote 4 down vote accepted

TBB is pretty much all there is that comes close. boost::thread is much too low level. You're looking in the wrong place at the TPL, by the way- Microsoft ship a separate library called the PPL for native code. It, of course, only supports Windows.

However, if you find TBB to be complicated to use, I'd question whether or not the developers you're thinking about are actually capable of creating parallel applications. TBB has one of the friendliest interfaces around with simple things like parallel_for_each. If you can't cope with a couple of lambdas, I find it hard to see how you'll cope with concurrency.

share|improve this answer
    
Ok I've had a closer look at TBB and it indeed doesn't seem that tricky to use. I was especially puzzled about task cancellation and dependency, but the first one can be achieved but cancelling the task group and the second one by building a dependency graph. Thanks. TBB's license is still an issue but I suppose that when one needs that parallelization quality, buying a commercial license is ok. The only left developers are those developing open source AND commercial-usable software. –  Ceylo Aug 14 '11 at 19:02
    
Have to admit, the licence could be a pain. As a student I get Visual Studio for free, so I never had to shop around. –  DeadMG Aug 14 '11 at 19:04
    
What do you mean? Do you use TPL or is TBB shipped with your Visual Studio edition? –  Ceylo Aug 14 '11 at 19:11
    
@Ceylo: As I said in my answer, Microsoft ship a library called the PPL for native code. It's very similar to TBB, but not identical, very nice, but doesn't meet your requirements of portability. –  DeadMG Aug 14 '11 at 19:34
    
Ok, thank you :) –  Ceylo Aug 15 '11 at 8:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.