vicente.botet | 5 Sep 06:43
Gravatar

[thread_pool] Dependencies between tasks

Hi,

the tread_pool pattern is very useful to improve parallelism. But sometimes we need to constraint this
parallelism, for example
when several task are related to the same 'instance' it could be safer to sequence them.

Is there a mechanism that allows to do thinks like that on the thread_pool library?

Best,

Vicente
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Re: [thread_pool] Dependencies between tasks

On Fri, Sep 5, 2008 at 6:44 AM, vicente.botet <vicente.botet <at> wanadoo.fr> wrote:
> Hi,
>
> the tread_pool pattern is very useful to improve parallelism. But sometimes we need to constraint this
parallelism, for example
> when several task are related to the same 'instance' it could be safer to sequence them.
>
> Is there a mechanism that allows to do thinks like that on the thread_pool library?
>

You probably need something like the Strand concept in Asio. I
wouldn't be surprised if you could reuse exactly the same
implementation.

--

-- 
gpd
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

vicente.botet | 5 Sep 07:30
Gravatar

Re: [thread_pool] Dependencies between tasks

----- Original Message ----- 
From: "Giovanni Piero Deretta" <gpderetta <at> gmail.com>
To: <boost <at> lists.boost.org>
Sent: Friday, September 05, 2008 6:53 AM
Subject: Re: [boost] [thread_pool] Dependencies between tasks

>
> On Fri, Sep 5, 2008 at 6:44 AM, vicente.botet <vicente.botet <at> wanadoo.fr> 
> wrote:
>> Hi,
>>
>> the tread_pool pattern is very useful to improve parallelism. But 
>> sometimes we need to constraint this parallelism, for example
>> when several task are related to the same 'instance' it could be safer to 
>> sequence them.
>>
>> Is there a mechanism that allows to do thinks like that on the 
>> thread_pool library?
>>
>
> You probably need something like the Strand concept in Asio. I
> wouldn't be surprised if you could reuse exactly the same
> implementation.
>
> -- 
> gpd
> _______________________________________________
> Unsubscribe & other changes: 
> http://lists.boost.org/mailman/listinfo.cgi/boost
>
(Continue reading)

Favicon

Re: [thread_pool] Dependencies between tasks

sequencing the access to the instance would be equivalent to chaining the tasks (== chained tasks are
executed after each other -> as a sequence).
take a look at thread_pool at the vault http://www.boostpro.com/vault/index.php?action=downloadfile&filename=boost-threadpool.2.tar.gz&directory=Concurrent%20Programming&.

Oliver

> -----Original Message-----
> From: boost-bounces <at> lists.boost.org
> [mailto:boost-bounces <at> lists.boost.org] On Behalf Of vicente.botet
> Sent: Friday, September 05, 2008 6:44 AM
> To: boost <at> lists.boost.org
> Subject: [boost] [thread_pool] Dependencies between tasks
>
> Hi,
>
> the tread_pool pattern is very useful to improve parallelism.
> But sometimes we need to constraint this parallelism, for
> example when several task are related to the same 'instance'
> it could be safer to sequence them.
>
> Is there a mechanism that allows to do thinks like that on
> the thread_pool library?
>
> Best,
>
> Vicente
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>
(Continue reading)

vicente.botet | 6 Sep 06:40
Gravatar

Re: [thread_pool] Dependencies between tasks

----- Original Message ----- 
From: "Kowalke Oliver (QD IT PA SI)" <Oliver.Kowalke <at> qimonda.com>
To: <boost <at> lists.boost.org>
Sent: Friday, September 05, 2008 8:46 AM
Subject: Re: [boost] [thread_pool] Dependencies between tasks

>
> sequencing the access to the instance would be equivalent to chaining the 
> tasks (== chained tasks are executed after each other -> as a sequence).
> take a look at thread_pool at the vault 
> http://www.boostpro.com/vault/index.php?action=downloadfile&filename=boost-threadpool.2.tar.gz&directory=Concurrent%20Programming&.

Do you mean that each time the user wants to sequence tasks she/he needs
* chain the task to the stored one
* store the last task

I had already recovered your compressed file as other post let know. Please 
could you point me where the chaining task is described?

Thanks,

Vicente 

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

k-oli | 6 Sep 08:39

Re: [thread_pool] Dependencies between tasks

Am Samstag, 6. September 2008 06:40:03 schrieb vicente.botet:
> ----- Original Message -----
> From: "Kowalke Oliver (QD IT PA SI)" <Oliver.Kowalke <at> qimonda.com>
> To: <boost <at> lists.boost.org>
> Sent: Friday, September 05, 2008 8:46 AM
> Subject: Re: [boost] [thread_pool] Dependencies between tasks
>
> > sequencing the access to the instance would be equivalent to chaining the
> > tasks (== chained tasks are executed after each other -> as a sequence).
> > take a look at thread_pool at the vault
> > http://www.boostpro.com/vault/index.php?action=downloadfile&filename=boos
> >t-threadpool.2.tar.gz&directory=Concurrent%20Programming&.
>
> Do you mean that each time the user wants to sequence tasks she/he needs
> * chain the task to the stored one
> * store the last task

I don't know what you mean with sore a task.

signature of chained_submit:

template<
      typename Act,
      typename T
    >
    task< typename result_of< Act() >::type > chained_submit(
      Act const& act,
      task< T > & t);

The function object act which should be passed to the thread pool is chained 
(Continue reading)

vicente.botet | 6 Sep 15:02
Gravatar

Re: [thread_pool] Dependencies between tasks

----- Original Message ----- 
From: <k-oli <at> gmx.de>
To: <boost <at> lists.boost.org>
Sent: Saturday, September 06, 2008 8:39 AM
Subject: Re: [boost] [thread_pool] Dependencies between tasks

>
> Am Samstag, 6. September 2008 06:40:03 schrieb vicente.botet:
>> ----- Original Message -----
>> From: "Kowalke Oliver (QD IT PA SI)" <Oliver.Kowalke <at> qimonda.com>
>> To: <boost <at> lists.boost.org>
>> Sent: Friday, September 05, 2008 8:46 AM
>> Subject: Re: [boost] [thread_pool] Dependencies between tasks
>>
>> > sequencing the access to the instance would be equivalent to chaining 
>> > the
>> > tasks (== chained tasks are executed after each other -> as a 
>> > sequence).
>> > take a look at thread_pool at the vault
>> > http://www.boostpro.com/vault/index.php?action=downloadfile&filename=boos
>> >t-threadpool.2.tar.gz&directory=Concurrent%20Programming&.
>>
>> Do you mean that each time the user wants to sequence tasks she/he needs
>> * chain the task to the stored one
>> * store the last task
>
> I don't know what you mean with store a task.

Well, in order to chain a task a need to have a reference to the task. This 
is what I meant by store a task.
(Continue reading)

k-oli | 6 Sep 20:42

Re: [thread_pool] Dependencies between tasks

Am Samstag, 6. September 2008 15:02:28 schrieb vicente.botet:
> Well, in order to chain a task a need to have a reference to the task. This
> is what I meant by store a task.

ok

> OK,  this allows us to chain tasks. Is this function thread_safe?

yes

> This works well as soon as we have a reference to the task t1 when we
> submit the task t2, and t2 when we submit the task t3. 

you need at least one task becuase you have to tell the pool after which 
action/task completion the new one should be executed/chained to.
Without how should the pool know to which task you refering to.

> The storage of the 
> last_task submited to the pool for a given instance is needed when the code
> is not linear but cyclic and the problem appears when these tasks have
> different types. Suppose that the function called return different types,
> std::string and std::size.

no - the retunr type doesn't matter.

> The first function is matched by void. As chained_submit do not use at all
> the value stored on the future of the task, a void task coul be enough
> also, but we need a means to copy  tp::task<T> on a tp::task<void>.
>
> I think that the future library allows already something like that, i.e. a
(Continue reading)

vicente.botet | 7 Sep 14:19
Gravatar

Re: [thread_pool] Dependencies between tasks

----- Original Message ----- 
From: <k-oli <at> gmx.de>
To: <boost <at> lists.boost.org>
Sent: Saturday, September 06, 2008 8:42 PM
Subject: Re: [boost] [thread_pool] Dependencies between tasks

>
> Am Samstag, 6. September 2008 15:02:28 schrieb vicente.botet:
>> Well, in order to chain a task a need to have a reference to the task. 
>> This
>> is what I meant by store a task.
>
> ok
>
>> OK,  this allows us to chain tasks. Is this function thread_safe?
>
> yes
>
>> This works well as soon as we have a reference to the task t1 when we
>> submit the task t2, and t2 when we submit the task t3.
>
> you need at least one task becuase you have to tell the pool after which
> action/task completion the new one should be executed/chained to.
> Without how should the pool know to which task you refering to.

I've not said at any moment that we don't need a task reference.

>> The storage of the
>> last_task submited to the pool for a given instance is needed when the 
>> code
(Continue reading)

k-oli | 10 Sep 12:20

Re: [thread_pool] Dependencies between tasks

Hello Vicente,
I've uploaded a new version of threadpool wich incorporates your suggestions 
regarding to chained_submit.

http://www.boostpro.com/vault/index.php?action=downloadfile&filename=boost-threadpool.4.tar.gz&directory=Concurrent%20Programming&

regards,
Oliver

Am Samstag, 6. September 2008 15:02:28 schrieb vicente.botet:
> ----- Original Message -----
> From: <k-oli <at> gmx.de>
> To: <boost <at> lists.boost.org>
> Sent: Saturday, September 06, 2008 8:39 AM
> Subject: Re: [boost] [thread_pool] Dependencies between tasks
>
> > Am Samstag, 6. September 2008 06:40:03 schrieb vicente.botet:
> >> ----- Original Message -----
> >> From: "Kowalke Oliver (QD IT PA SI)" <Oliver.Kowalke <at> qimonda.com>
> >> To: <boost <at> lists.boost.org>
> >> Sent: Friday, September 05, 2008 8:46 AM
> >> Subject: Re: [boost] [thread_pool] Dependencies between tasks
> >>
> >> > sequencing the access to the instance would be equivalent to chaining
> >> > the
> >> > tasks (== chained tasks are executed after each other -> as a
> >> > sequence).
> >> > take a look at thread_pool at the vault
> >> > http://www.boostpro.com/vault/index.php?action=downloadfile&filename=b
> >> >oos t-threadpool.2.tar.gz&directory=Concurrent%20Programming&.
(Continue reading)

vicente.botet | 10 Sep 13:26
Gravatar

Re: [thread_pool] Dependencies between tasks

----- Original Message ----- 
From: <k-oli <at> gmx.de>
To: <boost <at> lists.boost.org>
Sent: Wednesday, September 10, 2008 12:20 PM
Subject: Re: [boost] [thread_pool] Dependencies between tasks

>
> Hello Vicente,
> I've uploaded a new version of threadpool wich incorporates your 
> suggestions
> regarding to chained_submit.
>
> http://www.boostpro.com/vault/index.php?action=downloadfile&filename=boost-threadpool.4.tar.gz&directory=Concurrent%20Programming&
>
> regards,
> Oliver

Hello Olivier,

I've take a look. If I'm not wrong you have added the chained_submit with 
futures, isn't it?

Thanks a lot
______________________
Vicente Juan Botet Escribá 

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

(Continue reading)

k-oli | 10 Sep 14:09

Re: [thread_pool] Dependencies between tasks

Am Mittwoch, 10. September 2008 13:26:38 schrieb vicente.botet:
> ----- Original Message -----
> From: <k-oli <at> gmx.de>
> To: <boost <at> lists.boost.org>
> Sent: Wednesday, September 10, 2008 12:20 PM
> Subject: Re: [boost] [thread_pool] Dependencies between tasks
>
> > Hello Vicente,
> > I've uploaded a new version of threadpool wich incorporates your
> > suggestions
> > regarding to chained_submit.
> >
> > http://www.boostpro.com/vault/index.php?action=downloadfile&filename=boos
> >t-threadpool.4.tar.gz&directory=Concurrent%20Programming&
> >
> > regards,
> > Oliver
>
> Hello Olivier,
>
> I've take a look. If I'm not wrong you have added the chained_submit with
> futures, isn't it?

yes

> Thanks a lot
> ______________________
> Vicente Juan Botet Escribá

regards,
(Continue reading)


Gmane