Click here to Skip to main content
15,881,173 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
Hi,

We started working on Multithreaded application which will serve high TPS (transaction per second) messages. We need to write platform independent code which will work on Windows as well as on Linux. So, we are planning to use library for multithreaded programming. I searched through internet and mostly people suggests two libraries ACE and boost. We are not using sockets. Which library I should prefer. We also need to have multicore support.

Please let us know if you have any better suggestions.

Thanks in advance.
Posted

Boost, ACE and Qt all offer POSIX thread wrappers for Windows and Linux. ACE is not focused on this though, it's focused on comms and it's also aging somewhat in design terms so I wouldn't go with ACE.
Both Boost and QT offer a lot more than multithreading support and in both cases you have to take the package in terms of dependencies. If you're not interested in the Qt UI then Qt would probably be a waste and its multi threading support is a little unconventional. Some people have a bit of a struggle getting used to the idea of 'futures'.
Boost won't burden you with ties to a UI, offers reasonably straight forward threading, is quite up to date in terms of design and will continue to be supported and developed. It's also going to work on whatever platform you're likely to need so Boost looks best.
However on the down side Boost code can be mind bendingly hard to read and understand. Boost updates are pretty high frequency aswell which could be an issue for some.
From a theoretical point of view what you should be doing is moving toward C++11 standard threading and although I don't know if Boost is close to that yet it will surely be getting closer as time goes on. If the project is long term you might look at using Clang and libC++ which has C++11 threading working on Linux and OSX AFAIK but not quite on Windows yet.
The standard library (libC++ or equivalent) is lower level than Boost, much simpler and will eventually, hopefully be a portable interface.
 
Share this answer
 
Comments
[no name] 20-Mar-13 9:56am    
Thanks. It helps. 5!
Monjurul Habib 20-Mar-13 15:17pm    
5++
Solution 2 is great... but why not just use the new threading that is in C++11? It will be standardized and supported across every platform that you can think of and most new compilers already support it (new gcc and vc compilers already support it). Usually it's a lot better to use something that's part of the native language than something that is part of a library, specially if that's the only reason you are using the library (if you were using multiple components I'd say go for it).

With that said... boost is probably the most mature/refined threading library out there, so if you opt for using an existing library, I'd go for that but like I said, if you can use C++11, why not use the threading that's now part of the language?
 
Share this answer
 
Comments
[no name] 20-Mar-13 11:54am    
5! Thanks for advice.
Albert Holguin 20-Mar-13 12:52pm    
Sure, hope it helps :)
Monjurul Habib 20-Mar-13 15:18pm    
5++
Albert Holguin 20-Mar-13 15:52pm    
Thanks!
A very good readable library[^] :)

"Qt is a full development framework
with tools designed to streamline the creation of applications and user interfaces
for desktop, embedded and mobile platforms."
 
Share this answer
 
v2
Comments
[no name] 20-Mar-13 9:00am    
I think Qt is for UI. We do not want UI.
Eugen Podsypalnikov 20-Mar-13 9:04am    
Hm... I have understood that you are thinking and wanting :)
Albert Holguin 20-Mar-13 10:28am    
Don't use Qt if you don't have to... it's a pain and their documentation is not really as good as it could be.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900