Replacing ACE with BOOST - c++

I am new to BOOST
We are planning to move from ACE to BOOST. We are not using complete ACE but just part of the ACE library and some are mentioned below
ACE_THREAD
ACE_OS
ACE_Condition
ACE_Timer
ACE_Hash
ACE_Semaphore
ACE_Time_Value
Is this or similar functionality/api available in BOOST . Most Important is there ACE_Task_Base kind of functionality in BOOST
I want to know is this possible using BOOST and any problem of using BOOST. My Product is pure C++, heavy Network and Threads on Windows and Unices

ACE_Semaphore & ACE_THREAD & ACE_Condition
The above are all part of boost::threads
http://www.boost.org/doc/libs/1_52_0/doc/html/thread.html
C++11
http://en.cppreference.com/w/cpp/thread
ACE_OS
Some common things are done in boost w.r.t. OS but it depends on what parts of this you are using. There is boost::system and boost::filesystem, threading above and many more. Some of the lower level calls you'll need to handle I suspect.
http://www.boost.org/doc/libs/1_52_0/libs/system/doc/index.html
http://www.boost.org/doc/libs/1_52_0/libs/filesystem/doc/index.htm
ACE_Timer
boost::asio can be used to create timers which are similar to this and this lib may provide more of the function of ACE (or the mechanisms to create it)
http://www.boost.org/doc/libs/1_52_0/doc/html/boost_asio.html
ACE_Hash
ACE_Hash - again there is a lot of function here, but it could be replaced/implemented with boost or C++11
Boost:
http://www.boost.org/doc/libs/1_52_0/doc/html/hash.html
http://www.boost.org/doc/libs/1_52_0/doc/html/unordered.html
c++11:
http://en.cppreference.com/w/cpp/container/unordered_map
ACE_Task_Base
I would suspect you'll need to create your own replacement for the functionality here. The messages and message parsing mechanisms are quite involved in ACE. Threading is covered above, but a manager for created threads again is likely to need implementing.

Related

For what purpose may synchronization primitives and containers from Boost library be needed?

For what purpose may synchronization primitives and containers from Boost library be needed if the project uses C++ 11/14/17 in which there are already containers and synchronization primitives?
I know that Boost.asio is usually used in work with the network, Boost.spirit - usually for parsing of text. Do you know about the usual purpose of the other parts of Boost?
This question is from the C++ interview.
Boost is older than C++ 11 so many synchronization priminitives were there before they made it to the standard. This was feasible because the OSes already contained thread and synchronization functions so boost could wrap around them.
That said, at this point the C++ standard allows for trivial threading/synchronization. It's adequate for the average C++ developer. In complex sync scenarios you might need some boost-enhanced libraries, or even OS-dependant APIs, for example in Windows, WaitForMultipleObjects().

c++11 multi threading vs boost_thread

I am a beginner of c++ parallel computing. However, my project requires that I would need to use c++98 (stdlibc++) for it. I search online and it seems most of the tutorials is based on c++11 thread. I noted that boost_thread is an implementation for c++98 but there seems to be much less available tutorial. So I would like to ask what is the best way for me to learn and implement parallel computing for my project.
Eventually, my project would require calculations based on hundreds of cores and computing nodes. Would multi-threading be sufficient or do I have to use Boost_MPI? Thank you.
If you are limited to c++98 that means that you won't have all the thread managing and locking mechanisms as part of the language.
Therefore you will have to implement them by yourself based on available OS APIs.
There are different APIs for Windows and Linux.
Here is an example of C++ wrapper for Linux pthread library.
And this is an example of C++ wrapper for Windows Threads.
So your project won't be portable unless you create (or find somewhere) a class which hides these libraries behind a common interface under which it implements the same logic for Windows and Linux differed by #ifdef WINDOWS / #ifdef LINUX.
Regarding
what is the best way for me to learn and implement parallel computing
for my project.
There is no a correct answer for this. Look for some basic Multi Threading tutorials. Try to implement few simple programs (before you move to a big project) and come back when you face difficulties with more specific questions.
I have heard about boost but never used it so I can't provide any feedback on that. But again, you need to ask specific question. You can provide some specific requirements from your project and ask question based on them.
Anyway dive into boost documentation, you can find there threads related libraries (also pay attention for boost usage license).

How does the standard threading library compare to Boost’s?

I am re-writing a bit of legacy code in C++ 11 and wanted to make the processing more concurrent. I have read about C++11 threading library but wanted to see if anyone has used this and if you'd able to share you thoughts on how easy it is to implement?
Between Boost threading and this library, which one is more preferable and why?
Boost threading library is the same than the standard one (if you activate the new interface) but it adds features which are currently proposed as extension for C++14/17. It also propose more synchronization tools than the current standard or even C++14 draft.
What you need to know is that the standard and boost libraries are actually low-level concurrent constructs, they don't provide yet higher-level constructs, but there is work by both the standard commitee and Boost developers to add such constructs.
I recommand reading the book "C++ concurrency in action" which describe in depths how the C++11 threading library work and what it don't provide too (like thread pools implementations).

Adapt Boost Thread / Process for non supported platform

Background
this documentation says that it is possible to adapt the library to new (unsupported) operation system. Because the OS (a real time OS) I would like to support is close to Win32, I would expect little code changes. I have no experience with Boost Thread and Boost Interprocess .
Questions
Would you recommend to use Boost's Thread and Boost's Interprocess, if the
plattform is not supported?
What are the benefits and drawbacks?
Which alternatives would you consider?
All this depend on your needs. Using a portable library has the obvious advantages. Stabilizing a new platform could take some time.
I would suggest you to create tickets for each one of the features that doesn't work for the specific platform and work closely with the Boost authors.

A ThreadPool library in C++

I am looking for a good and stable threadpool library for C++ that's fairly well documented. I know about the Native Windows thread pool API and the newer Vista Thread Pool API, however my program requires some backward compatibility, so perhaps an outside library I can provide with the program is better.
I have looked into Boost's threadpool and it doesn't look bad at all, unfortunatly it is not very well documented.
Does anyone know any other libraries that have a ThreadPool in C++? (for Windows)
A portable threadpool library that claims to be 'production ready'. You may want to check that out.
Intel TBB is another threading library that has some neat stuff. I find the framework for evaluating a tree of expressions in parallell especially nice.
Qt has a threading library with some nice high-level operations like map/reduce etc, as well as low-level threading stuff and thread-pool support.
Qt might be a bit big for you though, but you can use a part of it pretty easily.
Have a look at the ThreadPool and TaskManager classes from the Poco C++ libraries.
With respect to the boost thread pool: this link might be useful: http://think-async.com/Asio/Recipes
There's also ACE which does thread-pooling over networks, so it's a fair bit more complex. (but deserves mentioning here, IMO)