Boost logo

Boost Users :

Subject: Re: [Boost-users] Priority task queues using Boost.Asio and Boost.Thread
From: Igor R (boost.lists_at_[hidden])
Date: 2011-12-10 10:55:46


> * One idea is to make a separate task thread for each CompositeTask.  I'm under the impression that there is an absolute limit to the number of threads that I can make, which is determined by boost::thread::hardware_concurrency().  Is this true?  If so, if the main

No, the "absolute limit" depends on your OS. You can create enormous
count of threads even on a one-core CPU, but if the number of threads
is greater than hardware_concurrency, some of them will always be
sharing the same cores, so you'll hardly gain any performance
advantages.

> * If I keep to one task queue (ie. throw all the Tasks in the CompositeTask to the main Task queue), then the possiblity exists of some kind of starvation (eg. the queue is full of CompositeTasks, and they are all blocking due to dependencies on Tasks in the queue).  Is there a way to prioritize Tasks in the queue so that this doesn't happen?

Take a look at the following asio example:
http://www.boost.org/doc/libs/1_48_0/doc/html/boost_asio/example/invocation/prioritised_handlers.cpp


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net