|
Boost Users : |
Subject: Re: [Boost-users] Does anybody interested in active object pattern?
From: Dean Michael Berris (mikhailberis_at_[hidden])
Date: 2010-11-07 10:51:37
On Sun, Nov 7, 2010 at 4:28 PM, joel falcou <joel.falcou_at_[hidden]> wrote:
> On 07/11/10 05:58, Dean Michael Berris wrote:
>>
>> I'm not sure how you think active objects help for massive parallelism
>> because the active object pattern implies that you're serializing
>> operations on a single object.
>
> 1/ Put data workload in a concurrent queue
> 2/ Spawn objects eating the queue asynchrnously
> 3/ ???
> 4/ PROFIT
>
> I don't see the limitations here.
But what you're describing is not the active object pattern. ;)
An Active Object is an object that:
1. Has a synchronous interface -- meaning an API that allows you to
deal with it like a normal (C++) object. If any function returns a
value, it would have to return a handle to that future value (the
active object pattern is intimately tied to the Future and Promise
patterns).
2. It serializes operations applied to the object in a single or
multiple threads of execution. An active object is said to have its
own lifetime thread, which it manages itself (presumably through
RAII).
3. It has normal reference semantics, but does not imply value
semantics. This means an active object may be referred to through
proxies or through shared references/pointers to an instance of the
active object. There are some active objects that enforce the
non-copyable invariant, which makes the only useful handle be either a
shared pointer or a proxy of a different sort.
There's much about the Active Object pattern that is important in
allowing for consistent interfaces to allow traditionally
non-concurrent code to deal with objects that know how to deal with
concurrency.
HTH
-- Dean Michael Berris deanberris.com
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