network_t Class Reference

Network communication support class. More...

#include <network.hh>

List of all members.

Public Member Functions

bool abort (void)
 Abort computation.
bool all_gather (char *sbuf, int ssize, char *rbuf, int rsize)
 Similar to gather(), but the collected information are received on every workstation.
bool barrier (void)
 Finalizes network, essentially closes connections and frees buffers.
bool finalize ()
 Finalizes network, frees all allocated buffers.
bool flush_all_buffers ()
 All buffers flush.
bool flush_all_buffers_timed_out_only ()
 Only timed out buffers flush.
bool flush_buffer (int dest)
 One send buffer flush.
bool flush_some_buffers ()
 Some buffers flush.
bool gather (char *sbuf, int ssize, char *rbuf, int rsize, int root)
 Similar to barrier() but allows to collect some data on selected workstation.
bool get_all_barriers_cnt (int &cnt)
 Get count of all barrier() calls.
bool get_all_buffers_flushes_cnt (int &cnt)
 Get number of flushes of all send buffers.
bool get_all_received_msgs_cnt (int &cnt)
 Get all received messages count (including urgent messages).
bool get_all_sent_msgs_cnt (int &cnt)
 Get all sent messages count (including urgent messages).
bool get_all_total_pending_size (int &size, bool test)
 Get total size of pending (blocked) send buffers for all workstations.
bool get_buf_msgs_cnt_limit (int &limit)
 Get send buffer's message count limit.
bool get_buf_size_limit (int &limit)
 Get send buffer's size limit.
bool get_buf_time_limit (int &limit_sec, int &limit_msec)
 Get send buffer's time limit.
bool get_buffer_flushes_cnt (int dest, int &cnt)
 Get number of flushes of send buffer for workstation dest.
bool get_cluster_size (int &size)
 Retrieves the number of computers in the cluster.
bool get_comm_matrix_rnm (pcomm_matrix_t &ret, int target)
 Get communication matrix of received normal messages.
bool get_comm_matrix_rum (pcomm_matrix_t &ret, int target)
 Get communication matrix of received urgent messages.
bool get_comm_matrix_snm (pcomm_matrix_t &ret, int target)
 Get communication matrix of sent normal messages.
bool get_comm_matrix_sum (pcomm_matrix_t &ret, int target)
 Get communication matrix of sent urgent messages.
bool get_id (int &id)
 Retrieves the identifier of the calling workstation.
bool get_processor_name (char *proc_name, int &length)
 Retrieves the name of the calling workstation.
int get_recv_msgs_cnt_recv_from (int from)
 Get number of messages received from given workstation.
bool get_recv_msgs_cnt_recv_from (int from, int &cnt)
 Get number of messages received from given workstation.
int get_sent_msgs_cnt_sent_to (int to)
 Get number of messages sent to a given workstation.
bool get_sent_msgs_cnt_sent_to (int to, int &cnt)
 Get number of messages sent to a given workstation.
bool get_total_pending_size (int dest, int &size, bool test)
 Get size of pending (blocked) send buffer for workstation dest.
bool get_user_received_msgs_cnt (int &cnt)
 Get normal received messages count (only normal messages, without urgent messages).
bool get_user_sent_msgs_cnt (int &cnt)
 Get normal sent messages count (only normal messages, without urgent messages).
bool initialize_buffers ()
 Completes initialization, must be called after and only after initialize_network().
bool initialize_network (int &argc, char **&argv)
bool is_new_message (int &size, int &src, int &tag, bool &flag)
 Non-blocking message probe.
bool is_new_message_from_source (int &size, int src, int &tag, bool &flag)
 Non-blocking message from specific source probe.
bool is_new_urgent_message (int &size, int &src, int &tag, bool &flag)
 Non-blocking urgent message probe.
bool is_new_urgent_message_from_source (int &size, int src, int &tag, bool &flag)
 Non-blocking urgent message probe from specific source.
 network_t (error_vector_t &arg0=gerr)
bool receive_message (message_t &message, int &src, int &tag)
 Blocking message receive.
bool receive_message (char *buf, int &size, int &src, int &tag)
 Blocking message receive.
bool receive_message_from_source (char *buf, int &size, int src, int &tag)
 Blocking message from source receive.
bool receive_message_non_exc (char *&buf, int &size, int &src, int &tag)
 Blocking message receive, which sets buf to point to internal buffer.
bool receive_urgent_message (char *buf, int &size, int &src, int &tag)
 Blocking message receive.
bool receive_urgent_message_from_source (char *buf, int &size, int src, int &tag)
 Blocking urgent message from source receive.
bool receive_urgent_message_non_exc (char *&buf, int &size, int &src, int &tag)
 Blocking urgent message receive, which sets buf to point to internal buffer.
bool send_message (const message_t &message, int dest, int tag)
 Blocking message send.
bool send_message (char *buf, int size, int dest, int tag)
 Blocking message send.
bool send_urgent_message (const message_t &message, int dest, int tag)
 Blocking urgent message send.
bool send_urgent_message (char *buf, int size, int dest, int tag)
 Blocking urgent message send.
bool set_buf_msgs_cnt_limit (int limit)
 Set send buffer's message count limit, see get_buf_msgs_cnt_limit() doc for more info.
bool set_buf_size_limit (int limit)
 Set send buffer's size limit, see get_buf_size_limit() doc for more info.
bool set_buf_time_limit (int limit_sec, int limit_msec)
 Set send buffer's time limit, see get_buf_time_limit() doc for more info.
void stats_init (statistics *stats)
double stats_max (statistics *stats)
double stats_mean (statistics *stats)
double stats_min (statistics *stats)
unsigned stats_num (statistics *stats)
double stats_sqrt_var (statistics *stats)
void stats_update (statistics *stats, double val)
double stats_var (statistics *stats)
 ~network_t ()
 A destructor, frees allocated memory.

Public Attributes

statistics stats_Recv_bytes
statistics stats_Sent_bytes_local
double stats_slice_begin
double stats_slice_end
double stats_time_begin

Protected Attributes

error_vector_terrvec


Detailed Description

Network communication support class.

This class mainly provides methods for buffered transmission of messages. Additionally barrier and gather methods are included. Methods for detailed statistics are a matter of course.


Constructor & Destructor Documentation

network_t ( error_vector_t arg0 = gerr  ) 

A constructor, does't initialize network!,
non-default error handling vector can be specified


Member Function Documentation

bool abort ( void   ) 

Abort computation.

Returns:
true if the function succeeds, false otherwise Use this function to terminate all processes participating in the distributed computation

References ERR_triplet_t::message, NET_ERR_ABORT_FAILED, net_err_msgs, and NET_ERR_NOT_INITIALIZED.

bool all_gather ( char *  sbuf,
int  ssize,
char *  rbuf,
int  rsize 
)

Similar to gather(), but the collected information are received on every workstation.

Differs from gather() in that all workstations must have rbuf and rsize valid, not only one workstation.

References ERR_triplet_t::message, NET_ERR_ALLGATHER_FAILED, net_err_msgs, and NET_ERR_NOT_INITIALIZED.

bool barrier ( void   ) 

Finalizes network, essentially closes connections and frees buffers.

Returns:
true if initialization was successful, false otherwise
Use this function ti finalize network, this works only if the network was previously initialized, otherwise error occurs. The current implementation does not allow to initialize the network more than once, so subsequent calls to initialize_network() will cause error. Stops the computation until all workstation call barrier()

Returns:
true if barrier was successful, false otherwise
Use this function to "synchronize" all workstation. The function blocks until all workstations call it.

References ERR_triplet_t::message, NET_ERR_BARRIER_FAILED, net_err_msgs, and NET_ERR_NOT_INITIALIZED.

Referenced by distributed_t::synchronized().

bool flush_all_buffers (  ) 

All buffers flush.

Returns:
true if the function succeeds, false otherwise
Use this function to flush all buffers (Technically, the function calls flush_buffer() function for all workstations in the cluster.

References flush_buffer(), ERR_triplet_t::message, net_err_msgs, and NET_ERR_NOT_INITIALIZED.

Referenced by distributed_t::set_idle().

bool flush_all_buffers_timed_out_only (  ) 

Only timed out buffers flush.

Returns:
true if the fuction succeeds, false otherwise
Use this fuction to flush all buffers that have the time limit exceeded (the time limit can bee adjusted by the set_buf_time_limit() function).

References flush_buffer(), ERR_triplet_t::message, net_err_msgs, and NET_ERR_NOT_INITIALIZED.

Referenced by distributed_t::process_messages().

bool flush_buffer ( int  dest  ) 

One send buffer flush.

Parameters:
dest - identifcation of the buffer (id of the workstation the buffer is designated for) to be flushed
Returns:
true if the function succeeds, false otherwise
Use this function to send data in the buffer determined by the dest parameter.

References ERR_triplet_t::message, NET_ERR_INVALID_DESTINATION, net_err_msgs, NET_ERR_NOT_INITIALIZED, NET_ERR_SEND_MSG_FAILED, and NET_TAG_NORMAL.

Referenced by flush_all_buffers(), flush_all_buffers_timed_out_only(), and flush_some_buffers().

bool flush_some_buffers (  ) 

Some buffers flush.

Returns:
true if the function succeeds, false otherwise
Use this function to flush "some" of the largest buffers (currently, the function only calls flush_buffer() for the single workstation with the largest amount of work buffered, since this already appears to give good performance in practice).

References flush_buffer(), ERR_triplet_t::message, net_err_msgs, and NET_ERR_NOT_INITIALIZED.

Referenced by distributed_t::set_idle().

bool gather ( char *  sbuf,
int  ssize,
char *  rbuf,
int  rsize,
int  root 
)

Similar to barrier() but allows to collect some data on selected workstation.

Parameters:
sbuf - pointer to buffer that contains the data to be collected
ssize - size of the data sbuf points to (in sizeof(char))
rbuf - pointer to buffer that receives the collected data (relevant only on selected workstation)
rsize - size of the collected data corresponding to one workstation, therefore rsize should be equal to ssize (relevant only on selected workstation)
root - id of the selected workstation that receives the collected data
Returns:
true if the function succeeds, false otherwise
Use this function to "synchronize" workstations (in the sense explained for barrier() function) and collect some information at the same time. Each workstation must call gather with the same ssize, all workstations except for the selected one can pass NULL and 0 as rbuf and rsize parameters, respectively. Root parameter must be the same on all workstations. The selected workstation should pass the same value as ssize as rsize. The buffer to which rbuf points must be of size rsize * [number of computers in the cluster].

The collected data are in order imposed by workstation ids.

References ERR_triplet_t::message, NET_ERR_GATHER_FAILED, net_err_msgs, and NET_ERR_NOT_INITIALIZED.

bool get_all_barriers_cnt ( int &  cnt  ) 

Get count of all barrier() calls.

Parameters:
cnt - output parameter that receives the count of all barrier() function calls on the calling workstation
Returns:
true if the function succeeds, false otherwise

References ERR_triplet_t::message, net_err_msgs, and NET_ERR_NOT_INITIALIZED.

Referenced by logger_t::log_now().

bool get_all_buffers_flushes_cnt ( int &  cnt  ) 

Get number of flushes of all send buffers.

Parameters:
cnt - output parameter that receives the count of all send buffer flushes on the calling workstation
Returns:
true if the function succeeds, false otherwise

References get_buffer_flushes_cnt(), ERR_triplet_t::message, net_err_msgs, and NET_ERR_NOT_INITIALIZED.

Referenced by logger_t::log_now().

bool get_all_received_msgs_cnt ( int &  cnt  ) 

Get all received messages count (including urgent messages).

Parameters:
cnt - output parameter that receives the count of all messages received on the calling workstation
Returns:
true if the function succeeds, false otherwise

References ERR_triplet_t::message, net_err_msgs, and NET_ERR_NOT_INITIALIZED.

Referenced by logger_t::log_now(), and distributed_t::process_messages().

bool get_all_sent_msgs_cnt ( int &  cnt  ) 

Get all sent messages count (including urgent messages).

Parameters:
cnt - output parameter that receives the count of all messages sent by the calling workstation
Returns:
true if the function succeeds, false otherwise.

References ERR_triplet_t::message, net_err_msgs, and NET_ERR_NOT_INITIALIZED.

Referenced by logger_t::log_now(), and distributed_t::process_messages().

bool get_all_total_pending_size ( int &  size,
bool  test 
)

Get total size of pending (blocked) send buffers for all workstations.

Parameters:
size - output parameter that receives total size of memory occupied by all pending send buffers
test - if test = true, tests are performed and exact value is retrieved, if test = false, upper estimate is returned
Returns:
true if the function succeeds, false otherwise

References get_total_pending_size(), ERR_triplet_t::message, net_err_msgs, and NET_ERR_NOT_INITIALIZED.

bool get_buf_msgs_cnt_limit ( int &  limit  ) 

Get send buffer's message count limit.

Parameters:
limit - the maximal count of messages send buffer can hold
Returns:
true if the function succeeds, false otherwise
Use this function to get the send buffer's message count limit. If the number of messages in any send buffer (on each workstation there is one send buffer for every workstation) is equal to this limit, the whole contents of the buffer is sent to the workstation the buffer is designated for.

100 messages is default.

This limit can be set by set_buf_msgs_cnt_limit() function, but only before initialize_buffers() function is called.

bool get_buf_size_limit ( int &  limit  ) 

Get send buffer's size limit.

Parameters:
limit - the maximal size of the send buffer
Returns:
true if the function succeeds, false otherwise
Use this function to get the send buffer's size limit. If the size of any send buffer (on each workstation there is one send buffer for every workstation) is about to exceed or equal this limit, the whole contents of the buffer is sent to the workstation the buffer is designated for.

8192 chars is default.

This limit can be set by set_buf_size_limit() function, but only before initialize_buffers function is called.

bool get_buf_time_limit ( int &  limit_sec,
int &  limit_msec 
)

Get send buffer's time limit.

Parameters:
limit_sec - together with limit_msec the "maximal" amount of time send buffer can hold data without flush (in seconds)
limit_msec - together with limit_sec the "maximal" amount of time send buffer can hold data without flush (in miliseconds)
Returns:
true if the function succeeds, false otherwise
Use this function to get the send buffer's time limit. If the time of any send buffer (on each workstation there is one send buffer for every workstation) is about to exceed or equal this limit, the whole contents of the buffer is sent to the workstation the buffer is designated for. The previous sentence is not completely true, because if nobody calls some function that checks the limit, the data can stay in the buffer for more that the limit. There is no "timer" that check the limit.

300 miliseconds is default.

This limit can be set by set_buf_time_limit() function, but only before initialize buffers function is called.

Setting the limit to 0 seconds and 0 miliseconds turns timed flushing off.

bool get_buffer_flushes_cnt ( int  dest,
int &  cnt 
)

Get number of flushes of send buffer for workstation dest.

Parameters:
dest - identification of the send buffer
cnt - output parameter that receives the count of all times the send buffer designated for workstation with id dest has been flushed
Returns:
true if the function succeeds, false otherwise

References ERR_triplet_t::message, NET_ERR_INVALID_DESTINATION, net_err_msgs, and NET_ERR_NOT_INITIALIZED.

Referenced by get_all_buffers_flushes_cnt().

bool get_cluster_size ( int &  size  ) 

Retrieves the number of computers in the cluster.

Parameters:
size - output parameter that receives the retrieved value
Returns:
true if the function succeeds, false otherwise
Use this function to get the number of computers in the cluster. The variable that receives the actual size of the cluster is passed as the first parameter.

You must call initialize_network() function before this function.

References ERR_triplet_t::message, net_err_msgs, and NET_ERR_NOT_INITIALIZED.

Referenced by distributed_t::network_initialize().

bool get_comm_matrix_rnm ( pcomm_matrix_t ret,
int  target 
)

Get communication matrix of received normal messages.

Similar to get_comm_matrix_snm(), but the position (i, j) of the matrix contains the count of normal messages (sent by send_message() function) received on workstation with id i from workstation with id j.

bool get_comm_matrix_rum ( pcomm_matrix_t ret,
int  target 
)

Get communication matrix of received urgent messages.

Similar to get_comm_matrix_snm(), but the position (i, j) of the matrix contains the count of urgent messages (sent by send_urgent_message() function) received on workstation with id i from workstation with id j.

bool get_comm_matrix_snm ( pcomm_matrix_t ret,
int  target 
)

Get communication matrix of sent normal messages.

Parameters:
ret - output parameter, pointer to communication matrix (of type comm_matrix_t) that contains at position (i, j) the count of normal messages (sent by function send_message()) sent by workstation with id i to workstation with id j
target - only one workstation gets valid pointer ret, this workstation is specified by target parameter, which must be the same on all workstations
Returns:
true if the function suceeds, false otherwise
Use this function to get the counts of messages sent by each workstation to each workstation. The function must be called in a way explained for the barrier() function.

bool get_comm_matrix_sum ( pcomm_matrix_t ret,
int  target 
)

Get communication matrix of sent urgent messages.

Similar to get_comm_matrix_snm(), but the position (i, j) of the matrix contains the count of urgent messages (sent by send_urgent_message() function) sent by workstation with id i to workstation with id j.

bool get_id ( int &  id  ) 

Retrieves the identifier of the calling workstation.

Parameters:
id - output parameter that receives the workstation id
Returns:
true if the function succeeds, false otherwise
Use this function to get the unique identifier of the calling workstation. The identifier is in the range [0..cluster_size - 1], where cluster_size is the number of computers in the cluster and can be obtained by calling the get_cluster_size() function.

You must call initialize_network() function before this function.

References ERR_triplet_t::message, net_err_msgs, and NET_ERR_NOT_INITIALIZED.

Referenced by distributed_t::network_initialize().

bool get_processor_name ( char *  proc_name,
int &  length 
)

Retrieves the name of the calling workstation.

Parameters:
proc_name - output parameter that receives the workstation name
length - output parameter that receives the number of characters in the name
Returns:
true if the function succeeds, false otherwise
Use this function to get the name of the calling workstation.

You must call initialize_network() function before this function.

References ERR_triplet_t::message, net_err_msgs, and NET_ERR_NOT_INITIALIZED.

Referenced by distributed_t::network_initialize().

int get_recv_msgs_cnt_recv_from ( int  from  ) 

Get number of messages received from given workstation.

Parameters:
from - specifies the workstation we are interested in
Returns:
the count of all message received on the calling workstation from the workstation specified by from parameter

References ERR_triplet_t::message, NET_ERR_INVALID_WORKSTATION_NUMBER, net_err_msgs, and NET_ERR_NOT_INITIALIZED.

bool get_recv_msgs_cnt_recv_from ( int  from,
int &  cnt 
)

Get number of messages received from given workstation.

Parameters:
from - specifies the workstation we are interested in
cnt - output parameter that receives the count of all message received on the calling workstation from the workstation specified by from parameter.
Returns:
true if the function succeeds, false otherwise

References ERR_triplet_t::message, NET_ERR_INVALID_WORKSTATION_NUMBER, net_err_msgs, and NET_ERR_NOT_INITIALIZED.

int get_sent_msgs_cnt_sent_to ( int  to  ) 

Get number of messages sent to a given workstation.

Parameters:
to - specifies the workstation we are interested in
Returns:
the count of all messages sent by calling workstation to a workstation specified by to parameter

References ERR_triplet_t::message, NET_ERR_INVALID_WORKSTATION_NUMBER, net_err_msgs, and NET_ERR_NOT_INITIALIZED.

bool get_sent_msgs_cnt_sent_to ( int  to,
int &  cnt 
)

Get number of messages sent to a given workstation.

Parameters:
to - specifies the workstation we are interested in
cnt - output parameter that receives the count of all messages sent by calling workstation to a workstation specified by to parameter.
Returns:
true if the function succeeds, false otherwise

References ERR_triplet_t::message, NET_ERR_INVALID_WORKSTATION_NUMBER, net_err_msgs, and NET_ERR_NOT_INITIALIZED.

Referenced by logger_t::log_now().

bool get_total_pending_size ( int  dest,
int &  size,
bool  test 
)

Get size of pending (blocked) send buffer for workstation dest.

Parameters:
dest - identification of the send buffer
size - output parameter that receives total size of memory occupied by pending send buffer designated for workstation with id dest
test - if test = true, tests are performed and exact value is retrieved, if test = false, upper estimate is returned
Returns:
true if the function succeeds, false otherwise

References ERR_triplet_t::message, NET_ERR_INVALID_DESTINATION, net_err_msgs, and NET_ERR_NOT_INITIALIZED.

Referenced by get_all_total_pending_size().

bool get_user_received_msgs_cnt ( int &  cnt  ) 

Get normal received messages count (only normal messages, without urgent messages).

Parameters:
cnt - output parameter that receives the count of all normal messages received on the calling workstation
Returns:
true if the function succeeds, false otherwise

References ERR_triplet_t::message, net_err_msgs, and NET_ERR_NOT_INITIALIZED.

bool get_user_sent_msgs_cnt ( int &  cnt  ) 

Get normal sent messages count (only normal messages, without urgent messages).

Parameters:
cnt - output parameter that receives the count of all normal messages sent by the calling workstation
Returns:
true if the function succeeds, false otherwise.

References ERR_triplet_t::message, net_err_msgs, and NET_ERR_NOT_INITIALIZED.

bool initialize_buffers (  ) 

Completes initialization, must be called after and only after initialize_network().

Returns:
true if initialization was successful, false otherwise
Use this function to complete initialization process. It initializes buffers, thus enabling the send/receive functions, which use buffering.

References ERR_triplet_t::message, net_err_msgs, and NET_ERR_NOT_INITIALIZED.

Referenced by distributed_t::initialize().

bool initialize_network ( int &  argc,
char **&  argv 
)

Initializes network, essentially establishes connections and gives all workstations
the command line parameters

Parameters:
argc - number of command line parameters, passing the first parameter of main() is recommended
argv - command line parameters, passing the second parameter of main() is recommended
Returns:
true if initialization was successful, false otherwise
Use this function to initialize network. After successful initialization you can obtain workstation identification by calling get_id() function, number of computers in cluster by calling get_cluster_size() function and workstation name using get_processor_name() function. You can also set some properties of build-in buffering scheme using set-functions.

References ERR_triplet_t::message, NET_ERR_ALREADY_INITIALIZED, NET_ERR_INITIALIZATION_FAILED, and net_err_msgs.

Referenced by distributed_t::network_initialize().

bool is_new_message ( int &  size,
int &  src,
int &  tag,
bool &  flag 
)

Non-blocking message probe.

Parameters:
size - output parameter that receives the size of the message, if there is one
src - output parameter that receives the source workstation of the message, if there is one
tag - output parameter that receives the tag of the message, if there is one
flag - output parameter that determines if there is a message waiting to be received
Returns:
true if the function succeeds, false otherwise
Use this function to find out whether there is some unreceived message waiting. The function is non-blocking in the sense that it does not wait for messages to arrive, it only finds out whether there are some.

This function only looks for messages sent by send_message() function.

Referenced by distributed_t::process_messages().

bool is_new_message_from_source ( int &  size,
int  src,
int &  tag,
bool &  flag 
)

Non-blocking message from specific source probe.

Similar to is_new_message(), but the src parameter is input. It means that the function only looks for messages from speceified source workstation.

bool is_new_urgent_message ( int &  size,
int &  src,
int &  tag,
bool &  flag 
)

Non-blocking urgent message probe.

Similar to is_new_message(), but it looks only for messages sent by send_urgent_message() function.

Referenced by distributed_t::process_messages().

bool is_new_urgent_message_from_source ( int &  size,
int  src,
int &  tag,
bool &  flag 
)

Non-blocking urgent message probe from specific source.

Similar to is_new_message(), but it looks only for messages sent by send_urgent_message() function and only for those of them that are from source workstation specified by the input parameter src.

bool receive_message ( message_t message,
int &  src,
int &  tag 
)

Blocking message receive.

Parameters:
message - instance of message_t, where the data will be stored
src - output parameter that gets id of the source workstation of the received message
tag - output parameter that gets the tag of the received message
Returns:
true if the function suceeds, false otherwise
Use this function to receive a message from network. The receiving process is blocking in the sense that the function does not terminate until the message is completely received. Apart from the other things, It means that if there is no message to be received, the function will block the computation until one arrives.

This function only concerns messages sent by the send_message() function.

References message_t::get_allocated_size(), message_t::get_data(), receive_message(), message_t::set_data(), and message_t::set_written_size().

bool receive_message ( char *  buf,
int &  size,
int &  src,
int &  tag 
)

Blocking message receive.

Parameters:
buf - pointer to memory used to store the received data
size - output parameter that receives the size of the received message
src - output parameter that gets id of the source workstation of the received message
tag - output parameter that gets the tag of the received message
Returns:
true if the function suceeds, false otherwise
Use this function to receive a message from network. The receiving process is blocking in the sense that the function does not terminate until the message is completely received. Apart from the other things, It means that if there is no message to be received, the function will block the computation until one arrives.

This function only concerns messages sent by the send_message() function.

Referenced by distributed_t::process_messages(), and receive_message().

bool receive_message_from_source ( char *  buf,
int &  size,
int  src,
int &  tag 
)

Blocking message from source receive.

Similar to receive_message(), but it receives only messages sent by send_urgent_message function.

bool receive_message_non_exc ( char *&  buf,
int &  size,
int &  src,
int &  tag 
)

Blocking message receive, which sets buf to point to internal buffer.

Similar to receive_message(), but the buf parameter is output and need not be initialized, because the function sets it to point to internal buffer containing the received data, which saves both memory and time. It is obvious that the memory buf points to must neither be freed nor rewritten.

Referenced by distributed_t::process_messages().

bool receive_urgent_message ( char *  buf,
int &  size,
int &  src,
int &  tag 
)

Blocking message receive.

Similar to receive_message(), but it receives only messages sent by send_urgent_message function.

Referenced by distributed_t::process_messages().

bool receive_urgent_message_from_source ( char *  buf,
int &  size,
int  src,
int &  tag 
)

Blocking urgent message from source receive.

Similar to receive_message_from source(), but it receives only messages sent by send_urgent_message() function.

bool receive_urgent_message_non_exc ( char *&  buf,
int &  size,
int &  src,
int &  tag 
)

Blocking urgent message receive, which sets buf to point to internal buffer.

Similar to receive_message_non_exc(), but it receives only messages sent by send_urgent_message() function.

Referenced by distributed_t::process_messages().

bool send_message ( const message_t message,
int  dest,
int  tag 
)

Blocking message send.

Parameters:
message - a message to send
dest - id of the workstation that receives the data
tag - additional information attached to the message, which is typically used to identify the type of the message
Returns:
true if the function succeeds, false otherwise
Use this function to send data to a workstation, the sending process is blocking in the sense that as soon as the function finishes the data which buf points to has already been copied to "lower level" and the original memory can be safely rewritten.

The function is connected to a buffering mechnism, it means that the messages are not sent instantly, but they are accumulated in a special buffer. There is one such buffer for each workstation. The data from a buffer are sent to the destination workstation as soon as one of the limits (set by functions set_buf_msgs_cnt_limit(), set_buf_size_limit(), set_buf_time_limit()) is exceeded or flush_buffer() function is called.

References message_t::get_data(), message_t::get_written_size(), and send_message().

bool send_message ( char *  buf,
int  size,
int  dest,
int  tag 
)

Blocking message send.

Parameters:
buf - pointer to data that are to be sent
size - size of the data to be sent (in sizeof(char))
dest - id of the workstation that receives the data
tag - additional information attached to the message, which is typically used to identify the type of the message
Returns:
true if the function succeeds, false otherwise
Use this function to send data to a workstation, the sending process is blocking in the sense that as soon as the function finishes the data which buf points to has already been copied to "lower level" and the original memory can be safely rewritten.

The function is connected to a buffering mechnism, it means that the messages are not sent instantly, but they are accumulated in a special buffer. There is one such buffer for each workstation. The data from a buffer are sent to the destination workstation as soon as one of the limits (set by functions set_buf_msgs_cnt_limit(), set_buf_size_limit(), set_buf_time_limit()) is exceeded or flush_buffer() function is called.

Referenced by send_message().

bool send_urgent_message ( const message_t message,
int  dest,
int  tag 
)

Blocking urgent message send.

Similar to send_message() function but of course there are differences. The function is not connected to buffering mechanism, so the messages are sent immediately. Different functions are used to receive messages sent by this function.

References message_t::get_data(), message_t::get_written_size(), and send_urgent_message().

bool send_urgent_message ( char *  buf,
int  size,
int  dest,
int  tag 
)

Blocking urgent message send.

Similar to send_message() function but of course there are differences. The function is not connected to buffering mechanism, so the messages are sent immediately. Different functions are used to receive messages sent by this function.

Referenced by distributed_t::process_messages(), and send_urgent_message().


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

Reference Manual for Library, 2006 developed in ParaDiSe laboratory, Faculty of Informatics, Masaryk University