Samchon Framework for CPP  1.0.0
samchon::protocol::master::ParallelSystemArray Class Reference

An array of parallel system drivers. More...

#include <ParallelSystemArray.hpp>

Collaboration diagram for samchon::protocol::master::ParallelSystemArray:

Public Member Functions

 ParallelSystemArray ()
 Default Constructor. More...
 
void sendSegmentData (std::shared_ptr< Invoke >, size_t)
 Send a message with segmentation size. More...
 
virtual void sendPieceData (std::shared_ptr< Invoke >, size_t, size_t)
 Send a message with piece index and size. More...
 
- Public Member Functions inherited from samchon::protocol::ExternalSystemArray
 ExternalSystemArray ()
 Default Constructor. More...
 
virtual void start ()=0
 Start interaction. More...
 
auto hasRole (const std::string &) const -> bool
 Test whether has a role. More...
 
auto getRole (const std::string &) const -> std::shared_ptr< ExternalSystemRole >
 Get a role. More...
 
virtual void sendData (std::shared_ptr< Invoke >) override
 Sends an Invoke message to related ExternalSystem(s). More...
 
virtual void replyData (std::shared_ptr< Invoke >) override
 Handle replied Invoke message. More...
 
virtual auto TAG () const -> std::string override
 A tag name when represented by XML. More...
 
virtual auto CHILD_TAG () const -> std::string override
 A tag name of children. More...
 
- Public Member Functions inherited from samchon::protocol::EntityGroup< _Container, _ETy, T >
 EntityGroup ()
 Default Constructor. More...
 
virtual void construct (std::shared_ptr< library::XML > xml)
 Construct data of the Entity from an XML object. More...
 
auto has (const std::string &key) const -> bool
 Indicates whether a container has an object having the specified identifier. More...
 
auto get (const std::string &key) -> value_type &
 Access the element by specified identifier(key). More...
 
auto get (const std::string &key) const -> const value_type &
 Access the const element by specified identifier(key). More...
 
virtual auto toXML () const -> std::shared_ptr< library::XML >
 Get an XML object represents the EntityGroup. More...
 
- Public Member Functions inherited from samchon::protocol::Entity
 Entity ()
 Default Constructor. More...
 
virtual auto key () const -> std::string
 Get a key that can identify the Entity uniquely. More...
 
- Public Member Functions inherited from samchon::protocol::IEntityGroup
 IEntityGroup ()
 Default Constructor. More...
 
- Public Member Functions inherited from samchon::protocol::IProtocol
 IProtocol ()
 Default Constructor. More...
 

Protected Member Functions

virtual void notifyEnd (PRMasterHistory *)
 Notify end of a master history. More...
 
- Protected Member Functions inherited from samchon::protocol::EntityGroup< _Container, _ETy, T >
virtual auto createChild (std::shared_ptr< library::XML >) -> entity_type *=0
 Factory method of a child Entity. More...
 

Private Attributes

std::atomic< size_t > uid
 Sequence of uid allocating for history. More...
 
PRMasterHistoryArrayhistoryArray
 An array of history have occured. More...
 
PRMasterHistoryArrayprogressArray
 An array of history on progress. More...
 

Detailed Description

An array of parallel system drivers.

ParallelSystemArray is an ExternalSystemArray and an abstract class containing. and managing parallel system drvers within framework of master. The ParallelSystemArray class allocates segmented processes (Invoke message containing segmentation size) following by each system's performance index.

Unlike DistributedSystemArray, ParallelSystemArray does not have such complicate relationships and logics. All segmentation sent by sendData(Invoke, size_t) requires uniform performance. ParallelSystemArray just calculates each system's performance index by elapsing time such easily.

Of course, DistributedSystemArray determines which size of segmentation allocation will be suitable for each system by the performance index

.

Each segmentation in requested process (Invoke message) is equivalent. Thus, role of ParallelSystem objects in a ParallelSystemArray are almost same and does not need to specify ExternalSystemRole on each ParallelSystem.

protocol_master_parallel_system.png
[Inherited]

ExternalSystemArray is an abstract class containing and managing external system drivers.

Also, ExternalSystemArray can access to ExternalSystemRole(s) directly. With the method, you can use an ExternalSystemRole as "logical proxy" of an ExternalSystem. Of course, the ExternalSystemRole is belonged to an ExternalSystem. However, if you access an ExternalSystemRole from an ExternalSystemArray directly, not passing by a belonged ExternalSystem, and send an Invoke message even you're not knowing which ExternalSystem is related in, the ExternalSystemRole acted a role of proxy.

It's called as "Proxy pattern". With the pattern, you can only concentrate on ExternalSystemRole itself, what to do with Invoke message, irrespective of the ExternalSystemRole is belonged to which ExternalSystem.

ExternalSystemArray::getRole("something")->sendData(invoke);
protocol_external_system.png
Example Sources
See also
samchon::protocol
Author
Jeongho Nam http://samchon.org

Definition at line 50 of file ParallelSystemArray.hpp.

Constructor & Destructor Documentation

ParallelSystemArray::ParallelSystemArray ( )

Default Constructor.

Definition at line 18 of file ParallelSystemArray.cpp.

Member Function Documentation

void ParallelSystemArray::sendSegmentData ( std::shared_ptr< Invoke ,
size_t   
)

Send a message with segmentation size.

Parameters
invokeAn invoke message requesting a process.
sizeSize of segmentation.

Definition at line 37 of file ParallelSystemArray.cpp.

void ParallelSystemArray::sendPieceData ( std::shared_ptr< Invoke ,
size_t  ,
size_t   
)
virtual

Send a message with piece index and size.

Parameters
invokeAn invoke message requesting a process.
indexStarting index number of segmentation.
sizeSize of segmentation.

Definition at line 42 of file ParallelSystemArray.cpp.

Referenced by samchon::example::interaction::PackerMediator::addClient(), and samchon::protocol::master::ParallelSlaveSystemMediator::replyPieceData().

Here is the caller graph for this function:

void ParallelSystemArray::notifyEnd ( PRMasterHistory masterHistory)
protectedvirtual

Notify end of a master history.

Estimates performance of each system by a master history containing their elapsed times.

The estimation is done by normalizing performances of children systems. The estimation of performance is divided by averagae elapsed time of each segmentation.

Reimplemented in samchon::protocol::master::ParallelSystemArrayMediator.

Definition at line 80 of file ParallelSystemArray.cpp.

References samchon::protocol::master::PRInvokeHistory::calcAverageElapsedTime(), samchon::protocol::master::PRMasterHistory::historyArray, samchon::protocol::master::ParallelSystem::performance, and samchon::protocol::master::PRInvokeHistory::system.

Referenced by samchon::protocol::master::ParallelSystemArrayMediator::notifyEnd().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

std::atomic<size_t> samchon::protocol::master::ParallelSystemArray::uid
private

Sequence of uid allocating for history.

Definition at line 62 of file ParallelSystemArray.hpp.

PRMasterHistoryArray* samchon::protocol::master::ParallelSystemArray::historyArray
private

An array of history have occured.

Definition at line 67 of file ParallelSystemArray.hpp.

PRMasterHistoryArray* samchon::protocol::master::ParallelSystemArray::progressArray
private

An array of history on progress.

Definition at line 72 of file ParallelSystemArray.hpp.


The documentation for this class was generated from the following files: