![]() |
The ROme OpTimistic Simulator
2.0.0
A General-Purpose Multithreaded Parallel/Distributed Simulation Platform
|
Memory Manager main header. More...
#include <stdlib.h>
#include <sys/mman.h>
#include <pthread.h>
#include <core/core.h>
#include <scheduler/process.h>
#include <arch/atomic.h>
Go to the source code of this file.
Data Structures | |
struct | memory_map |
Functions | |
bool | allocator_init (void) |
void | allocator_fini (void) |
void | segment_init (void) |
struct segment * | get_segment (GID_t i) |
void * | get_base_pointer (GID_t gid) |
void | initialize_memory_map (struct lp_struct *lp) |
void | finalize_memory_map (struct lp_struct *lp) |
struct slab_chain * | slab_init (const size_t itemsize) |
void * | slab_alloc (struct slab_chain *) |
void | slab_free (struct slab_chain *, const void *const addr) |
void * | log_full (struct lp_struct *) |
void * | log_state (struct lp_struct *) |
void | log_restore (struct lp_struct *, state_t *) |
void | log_delete (void *) |
void | clean_buffers_on_gvt (struct lp_struct *, simtime_t) |
void * | rsalloc (size_t) |
void * | rszalloc (size_t size) |
void | rsfree (void *) |
void * | rsrealloc (void *, size_t) |
void * | rscalloc (size_t, size_t) |
void | malloc_state_wipe (struct memory_map *) |
Memory Manager main header.
Memory Manager main header
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
Definition in file mm.h.
void log_delete | ( | void * | ckpt | ) |
This function is called directly from the simulation platform kernel to delete a certain log during the fossil collection.
ckpt | a pointer to the simulation state which must be deleted |
Definition at line 371 of file checkpoints.c.
void* log_full | ( | struct lp_struct * | lp | ) |
This function creates a full log of the current simulation states and returns a pointer to it. The algorithm behind this function is based on packing of the really allocated memory chunks into a contiguous memory area, exploiting some threshold-based approach to fasten it up even more. The contiguous copy is performed precomputing the size of the full log, and then scanning it using a pointer for storing the relevant information.
For further information, please see the paper: R. Toccaceli, F. Quaglia DyMeLoR: Dynamic Memory Logger and Restorer Library for Optimistic Simulation Objects with Generic Memory Layout Proceedings of the 22nd Workshop on Principles of Advanced and Distributed Simulation 2008
To fully understand the changes in this function to support the incremental logging as well, please point to the paper: A. Pellegrini, R. Vitali, F. Quaglia Di-DyMeLoR: Logging only Dirty Chunks for Efficient Management of Dynamic Memory Based Optimistic Simulation Objects Proceedings of the 23rd Workshop on Principles of Advanced and Distributed Simulation 2009
lp | A pointer to the lp_struct of the LP for which we are taking a full log of the buffers keeping the current simulation state. |
Definition at line 76 of file checkpoints.c.
Upon the decision of performing a rollback operation, this function is invoked by the simulation kernel to perform a restore operation. This function checks the mark in the malloc_state telling whether we're dealing with a full or partial log, and calls the proper function accordingly
lp | A pointer to the lp_struct of the LP for which we are restoring model-specific buffers keeping the simulation state |
state_queue_node | a pointer to a node in the state queue keeping the state which must be restored in the logical process live image |
Definition at line 355 of file checkpoints.c.
void* log_state | ( | struct lp_struct * | lp | ) |
This function is the only log function which should be called from the simulation platform. Actually, it is a demultiplexer which calls the correct function depending on the current configuration of the platform. Note that this function only returns a pointer to a malloc'd area which contains the state buffers. This means that this memory area cannot be used as-is, but should be wrapped into a state_t structure, which gives information about the simulation state pointer (defined via SetState() by the application-level code and the lvt associated with the log. This is done implicitly by the LogState() function, which in turn connects the newly taken snapshot with the currencly-scheduled LP. Therefore, any point of the simulator which wants to take a (real) log, shouldn't call directly this function, rather LogState() should be used, after having correctly set current and current_lvt.
lp | A pointer to the lp_struct of the LP for which we want to take a snapshot of the buffers used by the model to keep state variables. |
Definition at line 195 of file checkpoints.c.