The ROme OpTimistic Simulator  2.0.0
A General-Purpose Multithreaded Parallel/Distributed Simulation Platform
state.h File Reference

LP state management. More...

#include <ROOT-Sim.h>
#include <core/core.h>
#include <lib/numerical.h>
#include <lib/abm_layer.h>
#include <lib/topology.h>
+ Include dependency graph for state.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _state_t
 Structure for LP's state. More...
 

Typedefs

typedef struct _state_t state_t
 Structure for LP's state.
 

Enumerations

enum  { STATE_SAVING_INVALID = 0, STATE_SAVING_COPY, STATE_SAVING_PERIODIC }
 

Functions

bool LogState (struct lp_struct *)
 
void RestoreState (struct lp_struct *, state_t *restore_state)
 
void rollback (struct lp_struct *)
 
state_tfind_time_barrier (struct lp_struct *, simtime_t time)
 
void clean_queue_states (struct lp_struct *, simtime_t new_gvt)
 
void rebuild_state (struct lp_struct *, state_t *state_pointer, simtime_t time)
 
void set_checkpoint_period (struct lp_struct *, int period)
 
void force_LP_checkpoint (struct lp_struct *)
 
unsigned int silent_execution (struct lp_struct *, msg_t *evt, msg_t *final_evt)
 

Detailed Description

LP state management.

The state module is responsible for managing LPs' simulation states. In particular, it allows to take a snapshot, to restore a previous snapshot, and to silently re-execute a portion of simulation events to bring a LP to a partiuclar LVT value for which no simulation state is available in the log chain.

This file is part of ROOT-Sim (ROme OpTimistic Simulator).

ROOT-Sim is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; only version 3 of the License applies.

ROOT-Sim is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with ROOT-Sim; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

Author
Francesco Quaglia
Alessandro Pellegrini

Definition in file state.h.

Enumeration Type Documentation

anonymous enum
Enumerator
STATE_SAVING_INVALID 

By convention 0 is the invalid field

STATE_SAVING_COPY 

Copy State Saving checkpointing interval

STATE_SAVING_PERIODIC 

Periodic State Saving checkpointing interval

Definition at line 42 of file state.h.

Function Documentation

state_t* find_time_barrier ( struct lp_struct lp,
simtime_t  simtime 
)

This function computes a time barrier, namely the first state snapshot which is associated with a simulation time <= than the simtime value passed as an argument. The time barrier, in the runtime environment, is used to safely install a new computed GVT.

Author
Francesco Quaglia
Alessandro Pellegrini
Parameters
lpA pointer to the lp_struct of the LP for which we are looking for the current time barrier
simtimeThe simulation time to be associated with a state barrier
Returns
A pointer to the state that represents the time barrier

Definition at line 282 of file state.c.

+ Here is the caller graph for this function:

void force_LP_checkpoint ( struct lp_struct lp)

This function tells the logging subsystem to take a LP state log upon the next invocation to LogState(), independently of the current checkpointing period

Author
Alessandro Pellegrini
Parameters
lpA pointer to the lp_struct of the LP for which the checkpoint shold be forced after the next call to LogState()

Definition at line 364 of file state.c.

+ Here is the caller graph for this function:

bool LogState ( struct lp_struct lp)

This function is used to create a state log to be added to the LP's log chain

Parameters
lpA pointer to the lp_struct of the LP for which a checkpoint is to be taken.

Definition at line 55 of file state.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void rollback ( struct lp_struct lp)

This function rolls back the execution of a certain LP. The point where the execution is rolled back is identified by the event pointed by the rollback_bound entry in the LP control block. For a rollback operation to take place, that pointer must be set before calling this function.

Author
Francesco Quaglia
Alessandro Pellegrini
Parameters
lpA pointer to the lp_struct of the LP to rollback

Definition at line 220 of file state.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void set_checkpoint_period ( struct lp_struct lp,
int  period 
)

This function sets the checkpoint period

Author
Francesco Quaglia
Alessandro Pellegrini
Parameters
lpA pointer to the LP's lp_struct which should have its checkpoint period changed.
periodThe new checkpoint period

Definition at line 349 of file state.c.

unsigned int silent_execution ( struct lp_struct lp,
msg_t evt,
msg_t final_evt 
)

This function bring the state pointed by "state" to "final time" by re-executing all the events without sending any messages

Author
Francesco Quaglia
Alessandro Pellegrini
Parameters
lpA pointer to the LP's lp_struct for which we want to silently reprocess already-executed events
evtA pointer to the event from which start the re-execution
final_evtA pointer to the first event which should not be reprocessed in silent execution
Returns
The number of events re-processed during the silent execution

Definition at line 173 of file state.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function: