From: Yigong Liu (yigongliu_at_[hidden])
Date: 2006-09-26 02:21:43
Last night i sent out this email as reply to some old email. I didnot see it
appearing in my gmail mbox this morning. So i am resending it and hoping to
get more comments on design. Sorry for the duplication.
Channel is a Namespace based C++ template framework for distributed message
passing and event dispatching. It is redesigned and reimplemented based on
Boost. Initial design document and major framework code is available from
Coding and testing is done in linux (Fedora Core 3 &4). Havent try it on
Windows yet. Comments and corrections on the design are highly appreciated.
Attached please find a introduction of the library.
In Unix and most OSes, file systems allow applications to identify, bind to
and operate on system resources and entities (devices, files,...) using a
"name" (path name) in a hierarchical namespace (directory system) which is
different from variables and pointers in flat address space.
In Boost.Signal and libsigc++, callbacks/slots objects can be connected
explicitly to specific signals objects to allow synchronous event
Channel is a C++ template library to provide namespaces for asynchronous,
distributed message passing and event dispatching. Message senders and
receivers bind to names in namespace; binding and matching rules decide
which senders will bind to which receivers; then message passing and event
dispatching could happen among bound senders and receivers.
typename platform_type = boost_platform,
typename synchpolicy = mt_synch<platform_type>,
typename executor_type = abstract_executor,
typename name_space =
typename dispatcher = broadcast_dispatcher<name_space,platform_type>
Various namespaces (linear/hierarchical/associative) can be used for
different applications. For example, we can use integer ids as names to send
messages in linear namespace or we can use path name ids to send messages in
hierarchical namespace; User can configure namespace easily by setting a
channel template parameter.
Channel's other major components are dispatchers; which dispatch
messages/events from senders to bounded receivers. Dispatcher is also a
channel template parameter. The design of dispatchers can vary in several
- how msgs move: push or pull;
- how callbacks executed: synchronous or asynchronous.
Sample dispatchers includes : synchronous broadcast dispatcher, buffered
Namespace and dispatchers are orthogonal; they can mix and match together
freely; just as STL algorithms can be used with any STL containers by means
of the iterator range concept, Namespace and dispatchers can be used
together because of the name binding set concept.
By combining different namespace and dispatching policies, we can achieve
- synchronous event dispatching
- associative space model similar to tuple space
- asynchronous messaging model similar to Microsoft CCR (Concurrency
Similar to distributed files systems, distributed channels can be connected
or "mounted" to allow transparent distributed message passing. Filters and
translators are used to control namespace changes.
Channel is built on top of Boost facilities:
- boost::shared_ptr for message/event data life-time management
- boost::bind, boost::function for callback
- boost::thread for synchronization
- boost::serialization for message marshaling/demarshaling
- Boost.Asio and Boost.Shmem are used to build transports among remote
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk