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

The ROOT-Sim scheduler main module. More...

#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <datatypes/list.h>
#include <datatypes/msgchannel.h>
#include <core/core.h>
#include <core/timer.h>
#include <arch/atomic.h>
#include <arch/ult.h>
#include <arch/thread.h>
#include <core/init.h>
#include <scheduler/binding.h>
#include <scheduler/process.h>
#include <scheduler/scheduler.h>
#include <scheduler/stf.h>
#include <mm/state.h>
#include <communication/communication.h>
#include <mm/ecs.h>
#include <mm/mm.h>
#include <statistics/statistics.h>
#include <gvt/gvt.h>
#include <arch/x86/linux/cross_state_manager/cross_state_manager.h>
#include <queues/xxhash.h>
+ Include dependency graph for scheduler.c:

Go to the source code of this file.

Functions

void scheduler_init (void)
 
void scheduler_fini (void)
 
void LP_main_loop (void *args)
 
void initialize_worker_thread (void)
 
void activate_LP (struct lp_struct *next, msg_t *evt)
 
bool check_rendevouz_request (struct lp_struct *lp)
 
void schedule (void)
 
void schedule_on_init (struct lp_struct *next)
 

Variables

__thread unsigned int n_prc_per_thread
 This is used to keep track of how many LPs were bound to the current KLT.
 
__thread struct lp_structcurrent
 This is a per-thread variable pointing to the block state of the LP currently scheduled.
 
__thread msg_tcurrent_evt
 

Detailed Description

The ROOT-Sim scheduler main module.

This module implements the schedule() function, which is the main entry point for all the schedulers implemented in ROOT-Sim, and several support functions which allow to initialize worker threads.

Also, the LP_main_loop() function, which is the function where all the User-Level Threads associated with Logical Processes live, is defined here.

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
Roberto Vitali

Definition in file scheduler.c.

Function Documentation

void activate_LP ( struct lp_struct next,
msg_t evt 
)

This function is the application-level ProcessEvent() callback entry point. It allows to specify which lp must be scheduled, specifying its lvt, its event to be executed and its simulation state. This provides a general entry point to application-level code, to be used if the LP is in forward execution, in coasting forward or in initialization.

Author
Alessandro Pellegrini
Date
November 11, 2013
Parameters
nextA pointer to the lp_struct of the LP which has to be activated
evtA pointer to the event to be processed by the LP

Definition at line 260 of file scheduler.c.

+ Here is the caller graph for this function:

void LP_main_loop ( void *  args)

This is a LP main loop. It s the embodiment of the usrespace thread implementing the logic of the LP. Whenever an event is to be scheduled, the corresponding metadata are set by the schedule() function, which in turns calls activate_LP() to execute the actual context switch. This ProcessEvent wrapper explicitly returns control to simulation kernel user thread when an event processing is finished. In case the LP tries to access state data which is not belonging to its simulation state, a SIGSEGV signal is raised and the LP might be descheduled if it is not safe to perform the remote memory access. This is the only case where control is not returned to simulation thread explicitly by this wrapper.

Parameters
argsarguments passed to the LP main loop. Currently, this is not used.

Definition at line 140 of file scheduler.c.

+ Here is the call graph for this function:

void schedule ( void  )

This function checks wihch LP must be activated (if any), and in turn activates it. This is used only to support forward execution.

Author
Alessandro Pellegrini

Definition at line 321 of file scheduler.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void scheduler_fini ( void  )

This function finalizes the scheduler

Author
Alessandro Pellegrini

Definition at line 105 of file scheduler.c.

+ Here is the caller graph for this function:

Variable Documentation

__thread msg_t* current_evt

This is a per-thread variable telling what is the event that should be executed when activating an LP. It is incorrect to rely on current->bound, as there are cases (such as the silent execution) in which we have a certain bound set, but we execute a different event.

Definition at line 83 of file scheduler.c.