SimGrid  3.14.159
Versatile Simulation of Distributed Systems
Process Management Functions

Detailed Description

Functions

smx_actor_t simcall_process_create (const char *name, xbt_main_func_t code, void *data, sg_host_t host, double kill_time, int argc, char **argv, xbt_dict_t properties, int auto_restart)
 Creates and runs a new SIMIX process. More...
 
smx_activity_t simcall_execution_start (const char *name, double flops_amount, double priority, double bound)
 Creates a synchro that executes some computation of an host. More...
 
smx_activity_t simcall_execution_parallel_start (const char *name, int host_nb, sg_host_t *host_list, double *flops_amount, double *bytes_amount, double amount, double rate, double timeout)
 Creates a synchro that may involve parallel computation on several hosts and communication between them. More...
 
void simcall_execution_cancel (smx_activity_t execution)
 Cancels an execution synchro. More...
 
void simcall_execution_set_priority (smx_activity_t execution, double priority)
 Changes the priority of an execution synchro. More...
 
void simcall_execution_set_bound (smx_activity_t execution, double bound)
 Changes the capping (the maximum CPU utilization) of an execution synchro. More...
 
void simcall_process_kill (smx_actor_t process)
 Kills a SIMIX process. More...
 
void simcall_process_killall (int reset_pid)
 Kills all SIMIX processes. More...
 
void simcall_process_cleanup (smx_actor_t process)
 Cleans up a SIMIX process. More...
 
void simcall_process_set_host (smx_actor_t process, sg_host_t dest)
 Migrates an agent to another location. More...
 
void simcall_process_suspend (smx_actor_t process)
 Suspends a process. More...
 
void simcall_process_resume (smx_actor_t process)
 Resumes a suspended process. More...
 
int simcall_process_count ()
 Returns the amount of SIMIX processes in the system. More...
 
voidsimcall_process_get_data (smx_actor_t process)
 Return the user data of a smx_actor_t. More...
 
void simcall_process_set_data (smx_actor_t process, void *data)
 Set the user data of a smx_actor_t. More...
 
void simcall_process_set_kill_time (smx_actor_t process, double kill_time)
 Set the kill time of a process. More...
 
double simcall_process_get_kill_time (smx_actor_t process)
 Get the kill time of a process (or 0 if unset). More...
 
int simcall_process_is_suspended (smx_actor_t process)
 Returns true if the process is suspended . More...
 
xbt_dict_t simcall_process_get_properties (smx_actor_t process)
 Return the properties. More...
 
void simcall_process_on_exit (smx_actor_t process, int_f_pvoid_pvoid_t fun, void *data)
 Add an on_exit function Add an on_exit function which will be executed when the process exits/is killed. More...
 
void simcall_process_auto_restart_set (smx_actor_t process, int auto_restart)
 Sets the process to be auto-restarted or not by SIMIX when its host comes back up. More...
 
smx_actor_t simcall_process_restart (smx_actor_t process)
 Restarts the process, killing it and starting it again from scratch. More...
 
e_smx_state_t simcall_process_sleep (double duration)
 Creates a new sleep SIMIX synchro. More...
 

Function Documentation

◆ simcall_process_create()

smx_actor_t simcall_process_create ( const char *  name,
xbt_main_func_t  code,
void data,
sg_host_t  host,
double  kill_time,
int  argc,
char **  argv,
xbt_dict_t  properties,
int  auto_restart 
)

Creates and runs a new SIMIX process.

The structure and the corresponding thread are created and put in the list of ready processes.

Parameters
namea name for the process. It is for user-level information and can be nullptr.
codethe main function of the process
dataa pointer to any data one may want to attach to the new object. It is for user-level information and can be nullptr. It can be retrieved with the function simcall_process_get_data.
hostwhere the new agent is executed.
kill_timetime when the process is killed
argcfirst argument passed to code
argvsecond argument passed to code
propertiesthe properties of the process
auto_restarteither it is autorestarting or not.

◆ simcall_execution_start()

smx_activity_t simcall_execution_start ( const char *  name,
double  flops_amount,
double  priority,
double  bound 
)

Creates a synchro that executes some computation of an host.

This function creates a SURF action and allocates the data necessary to create the SIMIX synchro. It can raise a host_error exception if the host crashed.

Parameters
nameName of the execution synchro to create
flops_amountamount Computation amount (in flops)
prioritycomputation priority
bound
Returns
A new SIMIX execution synchronization

◆ simcall_execution_parallel_start()

smx_activity_t simcall_execution_parallel_start ( const char *  name,
int  host_nb,
sg_host_t host_list,
double *  flops_amount,
double *  bytes_amount,
double  amount,
double  rate,
double  timeout 
)

Creates a synchro that may involve parallel computation on several hosts and communication between them.

Parameters
nameName of the execution synchro to create
host_nbNumber of hosts where the synchro will be executed
host_listArray (of size host_nb) of hosts where the synchro will be executed
flops_amountArray (of size host_nb) of computation amount of hosts (in bytes)
bytes_amountArray (of size host_nb * host_nb) representing the communication amount between each pair of hosts
amountthe SURF action amount
ratethe SURF action rate
timeouttimeout
Returns
A new SIMIX execution synchronization

◆ simcall_execution_cancel()

void simcall_execution_cancel ( smx_activity_t  execution)

Cancels an execution synchro.

This functions stops the execution. It calls a surf function.

Parameters
executionThe execution synchro to cancel

◆ simcall_execution_set_priority()

void simcall_execution_set_priority ( smx_activity_t  execution,
double  priority 
)

Changes the priority of an execution synchro.

This functions changes the priority only. It calls a surf function.

Parameters
executionThe execution synchro
priorityThe new priority

◆ simcall_execution_set_bound()

void simcall_execution_set_bound ( smx_activity_t  execution,
double  bound 
)

Changes the capping (the maximum CPU utilization) of an execution synchro.

This functions changes the capping only. It calls a surf function.

Parameters
executionThe execution synchro
boundThe new bound

◆ simcall_process_kill()

void simcall_process_kill ( smx_actor_t  process)

Kills a SIMIX process.

This function simply kills a process.

Parameters
processpoor victim

◆ simcall_process_killall()

void simcall_process_killall ( int  reset_pid)

Kills all SIMIX processes.

◆ simcall_process_cleanup()

void simcall_process_cleanup ( smx_actor_t  process)

Cleans up a SIMIX process.

Parameters
processpoor victim (must have already been killed)

◆ simcall_process_set_host()

void simcall_process_set_host ( smx_actor_t  process,
sg_host_t  dest 
)

Migrates an agent to another location.

This function changes the value of the host on which process is running.

Parameters
processthe process to migrate
destname of the new host

◆ simcall_process_suspend()

void simcall_process_suspend ( smx_actor_t  process)

Suspends a process.

This function suspends the process by suspending the synchro it was waiting for completion.

Parameters
processa SIMIX process

◆ simcall_process_resume()

void simcall_process_resume ( smx_actor_t  process)

Resumes a suspended process.

This function resumes a suspended process by resuming the synchro it was waiting for completion.

Parameters
processa SIMIX process

◆ simcall_process_count()

int simcall_process_count ( )

Returns the amount of SIMIX processes in the system.

Maestro internal process is not counted, only user code processes are

◆ simcall_process_get_data()

void* simcall_process_get_data ( smx_actor_t  process)

Return the user data of a smx_actor_t.

Parameters
processa SIMIX process
Returns
the user data of this process

◆ simcall_process_set_data()

void simcall_process_set_data ( smx_actor_t  process,
void data 
)

Set the user data of a smx_actor_t.

This functions sets the user data associated to process.

Parameters
processSIMIX process
dataUser data

◆ simcall_process_set_kill_time()

void simcall_process_set_kill_time ( smx_actor_t  process,
double  kill_time 
)

Set the kill time of a process.

◆ simcall_process_get_kill_time()

double simcall_process_get_kill_time ( smx_actor_t  process)

Get the kill time of a process (or 0 if unset).

◆ simcall_process_is_suspended()

int simcall_process_is_suspended ( smx_actor_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.

Parameters
processSIMIX process
Returns
1, if the process is suspended, else 0.

◆ simcall_process_get_properties()

xbt_dict_t simcall_process_get_properties ( smx_actor_t  process)

Return the properties.

This functions returns the properties associated with this process

◆ simcall_process_on_exit()

void simcall_process_on_exit ( smx_actor_t  process,
int_f_pvoid_pvoid_t  fun,
void data 
)

Add an on_exit function Add an on_exit function which will be executed when the process exits/is killed.

◆ simcall_process_auto_restart_set()

void simcall_process_auto_restart_set ( smx_actor_t  process,
int  auto_restart 
)

Sets the process to be auto-restarted or not by SIMIX when its host comes back up.

Will restart the process when the host comes back up if auto_restart is set to 1.

◆ simcall_process_restart()

smx_actor_t simcall_process_restart ( smx_actor_t  process)

Restarts the process, killing it and starting it again from scratch.

◆ simcall_process_sleep()

e_smx_state_t simcall_process_sleep ( double  duration)

Creates a new sleep SIMIX synchro.

This function creates a SURF action and allocates the data necessary to create the SIMIX synchro. It can raise a host_error exception if the host crashed. The default SIMIX name of the synchro is "sleep".

Parameters
durationTime duration of the sleep.
Returns
A result telling whether the sleep was successful