|
Boost Users : |
Subject: Re: [Boost-users] Priority task queues using Boost.Asio and Boost.Thread
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2011-12-13 18:08:30
Le 08/12/11 17:30, Kelvin Chung a écrit :
>
> Now suppose that there is a point where I have a list of Tasks and I
> want to have them executed concurrently. To do so, I've leveraged
> Boost.Asio to create a thread pool task queue construct (via
> boost::asio::io_service). The next step beyond that is that I want to
> evaluate each of the tasks in CompositeTasks in parallel. I have a
> few questions about this:
>
> * 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 you want real parallelism the answer is yes. If you want concurrent
threads the number is limited by the memory you have.
> If so, if the main Task queue has that many threads, would making a
> second task queue fail because it can't get more?
> * 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?
Boost.Task (which is not yet in Boost) try to answer the questions you
make (http://gitorious.org/boost-dev/boost-dev/trees/task-dev/boost).
Best,
Vicente
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