SimGrid
3.7
Scalable simulation of distributed systems
|
This section describes the functions that can be used by a process to execute, communicate or otherwise handle some task. More...
Typedefs | |
typedef struct s_smx_rvpoint * | msg_mailbox_t |
Mailbox datatypeObject representing a communication rendez-vous point, on which the sender finds the receiver it wants to communicate with. As a MSG user, you will only rarely manipulate any of these objects directly, since most of the public interface (such as MSG_task_send and friends) hide this object behind a string alias. That mean that you don't provide the mailbox on which you want to send your task, but only the name of this mailbox. | |
typedef struct msg_comm * | msg_comm_t |
Communication action.Object representing an ongoing communication between processes. Such beast is usually obtained by using MSG_task_isend, MSG_task_irecv or friends. | |
Functions | |
MSG_error_t | MSG_task_execute (m_task_t task) |
Executes a task and waits for its termination. | |
MSG_error_t | MSG_parallel_task_execute (m_task_t task) |
Executes a parallel task and waits for its termination. | |
MSG_error_t | MSG_process_sleep (double nb_sec) |
Sleep for the specified number of seconds. | |
MSG_error_t | MSG_task_receive_from_host (m_task_t *task, const char *alias, m_host_t host) |
Deprecated function that used to receive a task from a mailbox from a specific host. | |
MSG_error_t | MSG_task_receive (m_task_t *task, const char *alias) |
Receives a task from a mailbox. | |
MSG_error_t | MSG_task_receive_with_timeout (m_task_t *task, const char *alias, double timeout) |
Receives a task from a mailbox with a given timeout. | |
MSG_error_t | MSG_task_receive_ext (m_task_t *task, const char *alias, double timeout, m_host_t host) |
Receives a task from a mailbox from a specific host with a given timeout. | |
msg_comm_t | MSG_task_isend (m_task_t task, const char *alias) |
Sends a task on a mailbox. | |
msg_comm_t | MSG_task_isend_with_matching (m_task_t task, const char *alias, int(*match_fun)(void *, void *, smx_action_t), void *match_data) |
Sends a task on a mailbox, with support for matching requests. | |
void | MSG_task_dsend (m_task_t task, const char *alias, void_f_pvoid_t cleanup) |
Sends a task on a mailbox. | |
msg_comm_t | MSG_task_irecv (m_task_t *task, const char *name) |
Starts listening for receiving a task from an asynchronous communication. | |
int | MSG_comm_test (msg_comm_t comm) |
Checks whether a communication is done, and if yes, finalizes it. | |
int | MSG_comm_testany (xbt_dynar_t comms) |
This function checks if a communication is finished. | |
void | MSG_comm_destroy (msg_comm_t comm) |
Destroys a communication. | |
MSG_error_t | MSG_comm_wait (msg_comm_t comm, double timeout) |
Wait for the completion of a communication. | |
void | MSG_comm_waitall (msg_comm_t *comm, int nb_elem, double timeout) |
This function is called by a sender and permit to wait for each communication. | |
int | MSG_comm_waitany (xbt_dynar_t comms) |
This function waits for the first communication finished in a list. | |
MSG_error_t | MSG_comm_get_status (msg_comm_t comm) |
Returns the error (if any) that occured during a finished communication. | |
m_task_t | MSG_comm_get_task (msg_comm_t comm) |
Get a task (m_task_t) from a communication. | |
MSG_error_t | MSG_task_send (m_task_t task, const char *alias) |
Sends a task to a mailbox. | |
MSG_error_t | MSG_task_send_bounded (m_task_t task, const char *alias, double maxrate) |
Sends a task to a mailbox with a maximum rate. | |
MSG_error_t | MSG_task_send_with_timeout (m_task_t task, const char *alias, double timeout) |
Sends a task to a mailbox with a timeout. | |
int | MSG_task_listen (const char *alias) |
Check if there is a communication going on in a mailbox. | |
int | MSG_task_listen_from_host (const char *alias, m_host_t host) |
Check the number of communication actions of a given host pending in a mailbox. | |
int | MSG_task_listen_from (const char *alias) |
Look if there is a communication on a mailbox and return the PID of the sender process. | |
void | MSG_task_set_category (m_task_t task, const char *category) |
Sets the tracing category of a task. | |
const char * | MSG_task_get_category (m_task_t task) |
Gets the current tracing category of a task. |
This section describes the functions that can be used by a process to execute, communicate or otherwise handle some task.
MSG_error_t MSG_task_execute | ( | m_task_t | task | ) |
Executes a task and waits for its termination.
This function is used for describing the behavior of a process. It takes only one parameter.
task | a m_task_t to execute on the location on which the process is running. |
Executes a parallel task and waits for its termination.
task | a m_task_t to execute on the location on which the process is running. |
MSG_error_t MSG_process_sleep | ( | double | nb_sec | ) |
Sleep for the specified number of seconds.
Makes the current process sleep until time seconds have elapsed.
nb_sec | a number of second |
MSG_error_t MSG_task_receive_from_host | ( | m_task_t * | task, |
const char * | alias, | ||
m_host_t | host | ||
) |
Deprecated function that used to receive a task from a mailbox from a specific host.
Sorry, this function is not supported anymore. That wouldn't be impossible to reimplement it, but we are lacking the time to do so ourselves. If you need this functionality, you can either:
task | a memory location for storing a m_task_t. |
alias | name of the mailbox to receive the task from |
host | a m_host_t host from where the task was sent |
MSG_error_t MSG_task_receive | ( | m_task_t * | task, |
const char * | alias | ||
) |
Receives a task from a mailbox.
This is a blocking function, the execution flow will be blocked until the task is received. See MSG_task_irecv for receiving tasks asynchronously.
task | a memory location for storing a m_task_t. |
alias | name of the mailbox to receive the task from |
MSG_error_t MSG_task_receive_with_timeout | ( | m_task_t * | task, |
const char * | alias, | ||
double | timeout | ||
) |
Receives a task from a mailbox with a given timeout.
This is a blocking function with a timeout, the execution flow will be blocked until the task is received or the timeout is achieved. See MSG_task_irecv for receiving tasks asynchronously. You can provide a -1 timeout to obtain an infinite timeout.
task | a memory location for storing a m_task_t. |
alias | name of the mailbox to receive the task from |
timeout | is the maximum wait time for completion (if -1, this call is the same as MSG_task_receive) |
MSG_error_t MSG_task_receive_ext | ( | m_task_t * | task, |
const char * | alias, | ||
double | timeout, | ||
m_host_t | host | ||
) |
Receives a task from a mailbox from a specific host with a given timeout.
This is a blocking function with a timeout, the execution flow will be blocked until the task is received or the timeout is achieved. See MSG_task_irecv for receiving tasks asynchronously. You can provide a -1 timeout to obtain an infinite timeout.
task | a memory location for storing a m_task_t. |
alias | name of the mailbox to receive the task from |
timeout | is the maximum wait time for completion (provide -1 for no timeout) |
host | a m_host_t host from where the task was sent |
msg_comm_t MSG_task_isend | ( | m_task_t | task, |
const char * | alias | ||
) |
Sends a task on a mailbox.
This is a non blocking function: use MSG_comm_wait() or MSG_comm_test() to end the communication.
task | a m_task_t to send on another location. |
alias | name of the mailbox to sent the task to |
msg_comm_t MSG_task_isend_with_matching | ( | m_task_t | task, |
const char * | alias, | ||
int(*)(void *, void *, smx_action_t) | match_fun, | ||
void * | match_data | ||
) |
Sends a task on a mailbox, with support for matching requests.
This is a non blocking function: use MSG_comm_wait() or MSG_comm_test() to end the communication.
task | a m_task_t to send on another location. |
alias | name of the mailbox to sent the task to |
match_fun | boolean function which parameters are:
|
match_data | user provided data passed to match_fun |
void MSG_task_dsend | ( | m_task_t | task, |
const char * | alias, | ||
void_f_pvoid_t | cleanup | ||
) |
Sends a task on a mailbox.
This is a non blocking detached send function. Think of it as a best effort send. Keep in mind that the third parameter is only called if the communication fails. If the communication does work, it is responsibility of the receiver code to free anything related to the task, as usual. More details on this can be obtained on this thread in the SimGrid-user mailing list archive.
task | a m_task_t to send on another location. |
alias | name of the mailbox to sent the task to |
cleanup | a function to destroy the task if the communication fails, e.g. MSG_task_destroy (if NULL, no function will be called) |
msg_comm_t MSG_task_irecv | ( | m_task_t * | task, |
const char * | name | ||
) |
Starts listening for receiving a task from an asynchronous communication.
This is a non blocking function: use MSG_comm_wait() or MSG_comm_test() to end the communication.
task | a memory location for storing a m_task_t. has to be valid until the end of the communication. |
name | of the mailbox to receive the task on |
int MSG_comm_test | ( | msg_comm_t | comm | ) |
Checks whether a communication is done, and if yes, finalizes it.
comm | the communication to test |
int MSG_comm_testany | ( | xbt_dynar_t | comms | ) |
This function checks if a communication is finished.
comms | a vector of communications |
void MSG_comm_destroy | ( | msg_comm_t | comm | ) |
Destroys a communication.
comm | the communication to destroy. |
MSG_error_t MSG_comm_wait | ( | msg_comm_t | comm, |
double | timeout | ||
) |
Wait for the completion of a communication.
It takes two parameters.
comm | the communication to wait. |
timeout | Wait until the communication terminates or the timeout occurs |
void MSG_comm_waitall | ( | msg_comm_t * | comm, |
int | nb_elem, | ||
double | timeout | ||
) |
This function is called by a sender and permit to wait for each communication.
comm | a vector of communication |
nb_elem | is the size of the comm vector |
timeout | for each call of MSG_comm_wait |
int MSG_comm_waitany | ( | xbt_dynar_t | comms | ) |
This function waits for the first communication finished in a list.
comms | a vector of communications |
MSG_error_t MSG_comm_get_status | ( | msg_comm_t | comm | ) |
Returns the error (if any) that occured during a finished communication.
comm | a finished communication |
m_task_t MSG_comm_get_task | ( | msg_comm_t | comm | ) |
Get a task (m_task_t) from a communication.
comm | the communication where to get the task |
MSG_error_t MSG_task_send | ( | m_task_t | task, |
const char * | alias | ||
) |
Sends a task to a mailbox.
This is a blocking function, the execution flow will be blocked until the task is sent (and received in the other side if MSG_task_receive is used). See MSG_task_isend for sending tasks asynchronously.
task | the task to be sent |
alias | the mailbox name to where the task is sent |
MSG_error_t MSG_task_send_bounded | ( | m_task_t | task, |
const char * | alias, | ||
double | maxrate | ||
) |
Sends a task to a mailbox with a maximum rate.
This is a blocking function, the execution flow will be blocked until the task is sent. The maxrate parameter allows the application to limit the bandwidth utilization of network links when sending the task.
task | the task to be sent |
alias | the mailbox name to where the task is sent |
maxrate | the maximum communication rate for sending this task |
MSG_error_t MSG_task_send_with_timeout | ( | m_task_t | task, |
const char * | alias, | ||
double | timeout | ||
) |
Sends a task to a mailbox with a timeout.
This is a blocking function, the execution flow will be blocked until the task is sent or the timeout is achieved.
task | the task to be sent |
alias | the mailbox name to where the task is sent |
timeout | is the maximum wait time for completion (if -1, this call is the same as MSG_task_send) |
int MSG_task_listen | ( | const char * | alias | ) |
Check if there is a communication going on in a mailbox.
alias | the name of the mailbox to be considered |
int MSG_task_listen_from_host | ( | const char * | alias, |
m_host_t | host | ||
) |
Check the number of communication actions of a given host pending in a mailbox.
alias | the name of the mailbox to be considered |
host | the host to check for communication |
int MSG_task_listen_from | ( | const char * | alias | ) |
Look if there is a communication on a mailbox and return the PID of the sender process.
alias | the name of the mailbox to be considered |
void MSG_task_set_category | ( | m_task_t | task, |
const char * | category | ||
) |
Sets the tracing category of a task.
This function should be called after the creation of a MSG task, to define the category of that task. The first parameter task must contain a task that was created with the function MSG_task_create. The second parameter category must contain a category that was previously declared with the function TRACE_category (or with TRACE_category_with_color).
See Tracing Simulations for Visualization for details on how to trace the (categorized) resource utilization.
task | the task that is going to be categorized |
category | the name of the category to be associated to the task |
const char* MSG_task_get_category | ( | m_task_t | task | ) |
Gets the current tracing category of a task.
task | the task to be considered |
Back to the main Simgrid Documentation page |
The version of SimGrid documented here is v3.7. Documentation of other versions can be found in their respective archive files (directory doc/html). |
Generated by ![]() |