SimGrid 3.7.1
Scalable simulation of distributed systems
Typedefs | Functions
Process Management Functions
MSG

This section describes the process structure of MSG (m_process_t) and the functions for managing it. More...

Typedefs

typedef struct s_smx_processm_process_t
 Process datatype.A process may be defined as a code, with some private data, executing in a location.

Functions

m_process_t MSG_process_create (const char *name, xbt_main_func_t code, void *data, m_host_t host)
 Creates and runs a new m_process_t.
m_process_t MSG_process_create_with_arguments (const char *name, xbt_main_func_t code, void *data, m_host_t host, int argc, char **argv)
 Creates and runs a new m_process_t.
m_process_t MSG_process_create_with_environment (const char *name, xbt_main_func_t code, void *data, m_host_t host, int argc, char **argv, xbt_dict_t properties)
 Creates and runs a new m_process_t.
void MSG_process_kill (m_process_t process)
MSG_error_t MSG_process_migrate (m_process_t process, m_host_t host)
 Migrates a process to another location.
void * MSG_process_get_data (m_process_t process)
 Returns the user data of a process.
MSG_error_t MSG_process_set_data (m_process_t process, void *data)
 Sets the user data of a process.
void MSG_process_set_data_cleanup (void_f_pvoid_t data_cleanup)
 Sets a cleanup function to be called to free the userdata of a process when a process is destroyed.
m_host_t MSG_process_get_host (m_process_t process)
 Return the location on which a process is running.
m_process_t MSG_process_from_PID (int PID)
 Return a m_process_t given its PID.
MSG_error_t MSG_process_set_kill_time (m_process_t process, double kill_time)
 Set the kill time of a process.
int MSG_process_get_PID (m_process_t process)
 Returns the process ID of process.
int MSG_process_get_PPID (m_process_t process)
 Returns the process ID of the parent of process.
const char * MSG_process_get_name (m_process_t process)
 Return the name of a process.
const char * MSG_process_get_property_value (m_process_t process, const char *name)
 Returns the value of a given process property.
xbt_dict_t MSG_process_get_properties (m_process_t process)
 Return the list of properties.
int MSG_process_self_PID (void)
 Return the PID of the current process.
int MSG_process_self_PPID (void)
 Return the PPID of the current process.
m_process_t MSG_process_self (void)
 Return the current process.
MSG_error_t MSG_process_suspend (m_process_t process)
 Suspend the process.
MSG_error_t MSG_process_resume (m_process_t process)
 Resume a suspended process.
int MSG_process_is_suspended (m_process_t process)
 Returns true if the process is suspended .
xbt_dict_t simcall_process_get_properties (smx_process_t process)
 Return the properties.

Detailed Description

This section describes the process structure of MSG (m_process_t) and the functions for managing it.

We need to simulate many independent scheduling decisions, so the concept of process is at the heart of the simulator. A process may be defined as a code, with some private data, executing in a location.

See also:
m_process_t

Typedef Documentation

typedef struct s_smx_process* m_process_t

Process datatype.A process may be defined as a code, with some private data, executing in a location.

You should not access directly to the fields of the pointed structure, but always use the provided API to interact with processes.


Function Documentation

m_process_t MSG_process_create ( const char *  name,
xbt_main_func_t  code,
void *  data,
m_host_t  host 
)

Creates and runs a new m_process_t.

Does exactly the same as MSG_process_create_with_arguments but without providing standard arguments (argc, argv, start_time, kill_time).

See also:
MSG_process_create_with_arguments
m_process_t MSG_process_create_with_arguments ( const char *  name,
xbt_main_func_t  code,
void *  data,
m_host_t  host,
int  argc,
char **  argv 
)

Creates and runs a new m_process_t.

A constructor for m_process_t taking four arguments and returning the corresponding object. The structure (and the corresponding thread) is created, and put in the list of ready process.

Parameters:
namea name for the object. It is for user-level information and can be NULL.
codeis a function describing the behavior of the process. It should then only use functions described in Process Management Functions (to create a new m_process_t for example), in Host Management Functions (only the read-only functions i.e. whose name contains the word get), in Task Management Functions (to create or destroy some m_task_t for example) and in Task Actions (to handle file transfers and task processing).
dataa pointer to any data one may want to attach to the new object. It is for user-level information and can be NULL. It can be retrieved with the function MSG_process_get_data.
hostthe location where the new process is executed.
argcfirst argument passed to code
argvsecond argument passed to code
See also:
m_process_t
Returns:
The new corresponding object.
m_process_t MSG_process_create_with_environment ( const char *  name,
xbt_main_func_t  code,
void *  data,
m_host_t  host,
int  argc,
char **  argv,
xbt_dict_t  properties 
)

Creates and runs a new m_process_t.

A constructor for m_process_t taking four arguments and returning the corresponding object. The structure (and the corresponding thread) is created, and put in the list of ready process.

Parameters:
namea name for the object. It is for user-level information and can be NULL.
codeis a function describing the behavior of the process. It should then only use functions described in Process Management Functions (to create a new m_process_t for example), in Host Management Functions (only the read-only functions i.e. whose name contains the word get), in Task Management Functions (to create or destroy some m_task_t for example) and in Task Actions (to handle file transfers and task processing).
dataa pointer to any data one may want to attach to the new object. It is for user-level information and can be NULL. It can be retrieved with the function MSG_process_get_data.
hostthe location where the new process is executed.
argcfirst argument passed to code
argvsecond argument passed to code
propertieslist a properties defined for this process
See also:
m_process_t
Returns:
The new corresponding object.
void MSG_process_kill ( m_process_t  process)
Parameters:
processpoor victim

This function simply kills a process... scary isn't it ? :)

MSG_error_t MSG_process_migrate ( m_process_t  process,
m_host_t  host 
)

Migrates a process to another location.

This function checks whether process and host are valid pointers and change the value of the m_host_t on which process is running.

void* MSG_process_get_data ( m_process_t  process)

Returns the user data of a process.

This function checks whether process is a valid pointer or not and returns the user data associated to this process.

MSG_error_t MSG_process_set_data ( m_process_t  process,
void *  data 
)

Sets the user data of a process.

This function checks whether process is a valid pointer or not and sets the user data associated to this process.

void MSG_process_set_data_cleanup ( void_f_pvoid_t  data_cleanup)

Sets a cleanup function to be called to free the userdata of a process when a process is destroyed.

Parameters:
data_cleanupa cleanup function for the userdata of a process, or NULL to call no function
m_host_t MSG_process_get_host ( m_process_t  process)

Return the location on which a process is running.

Parameters:
processa process (NULL means the current one)
Returns:
the m_host_t corresponding to the location on which process is running.
m_process_t MSG_process_from_PID ( int  PID)

Return a m_process_t given its PID.

This function search in the list of all the created m_process_t for a m_process_t whose PID is equal to PID. If no host is found, NULL is returned. Note that the PID are uniq in the whole simulation, not only on a given host.

MSG_error_t MSG_process_set_kill_time ( m_process_t  process,
double  kill_time 
)

Set the kill time of a process.

Parameters:
processa process
kill_timethe time when the process is killed.
int MSG_process_get_PID ( m_process_t  process)

Returns the process ID of process.

This function checks whether process is a valid pointer or not and return its PID (or 0 in case of problem).

int MSG_process_get_PPID ( m_process_t  process)

Returns the process ID of the parent of process.

This function checks whether process is a valid pointer or not and return its PID. Returns -1 if the process has not been created by any other process.

const char* MSG_process_get_name ( m_process_t  process)

Return the name of a process.

This function checks whether process is a valid pointer or not and return its name.

const char* MSG_process_get_property_value ( m_process_t  process,
const char *  name 
)

Returns the value of a given process property.

Parameters:
processa process
namea property name
Returns:
value of a property (or NULL if the property is not set)
xbt_dict_t MSG_process_get_properties ( m_process_t  process)

Return the list of properties.

This function returns all the parameters associated with a process

int MSG_process_self_PID ( void  )

Return the PID of the current process.

This function returns the PID of the currently running m_process_t.

int MSG_process_self_PPID ( void  )

Return the PPID of the current process.

This function returns the PID of the parent of the currently running m_process_t.

m_process_t MSG_process_self ( void  )

Return the current process.

This function returns the currently running m_process_t.

MSG_error_t MSG_process_suspend ( m_process_t  process)

Suspend the process.

This function suspends the process by suspending the task on which it was waiting for the completion.

MSG_error_t MSG_process_resume ( m_process_t  process)

Resume a suspended process.

This function resumes a suspended process by resuming the task on which it was waiting for the completion.

int MSG_process_is_suspended ( m_process_t  process)

Returns true if the process is suspended .

This checks whether a process is suspended or not by inspecting the task on which it was waiting for the completion.

xbt_dict_t simcall_process_get_properties ( smx_process_t  process)

Return the properties.

This functions returns the properties associated with this process


Back to the main Simgrid Documentation page The version of SimGrid documented here is v3.7.1.
Documentation of other versions can be found in their respective archive files (directory doc/html).
Generated by doxygen