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

LP state management. More...

#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <core/core.h>
#include <core/init.h>
#include <core/timer.h>
#include <datatypes/list.h>
#include <scheduler/process.h>
#include <scheduler/scheduler.h>
#include <mm/state.h>
#include <communication/communication.h>
#include <mm/mm.h>
#include <statistics/statistics.h>
+ Include dependency graph for state.c:

Go to the source code of this file.

Functions

bool LogState (struct lp_struct *lp)
 
void RestoreState (struct lp_struct *lp, state_t *restore_state)
 
unsigned int silent_execution (struct lp_struct *lp, msg_t *evt, msg_t *final_evt)
 
void rollback (struct lp_struct *lp)
 
state_tfind_time_barrier (struct lp_struct *lp, simtime_t simtime)
 
void SetState (void *new_state)
 
void set_checkpoint_mode (int ckpt_mode)
 
void set_checkpoint_period (struct lp_struct *lp, int period)
 
void force_LP_checkpoint (struct lp_struct *lp)
 

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.c.

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_mode ( int  ckpt_mode)

This function sets the checkpoint mode

Author
Francesco Quaglia
Alessandro Pellegrini
Parameters
ckpt_modeThe new checkpoint mode

Definition at line 334 of file state.c.

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.

void SetState ( void *  new_state)

This function sets the buffer of the current LP's state

Author
Francesco Quaglia
Parameters
new_stateThe new buffer

Definition at line 321 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: