![]() |
The ROme OpTimistic Simulator
2.0.0
A General-Purpose Multithreaded Parallel/Distributed Simulation Platform
|
User-Level Threads Headers. More...
Go to the source code of this file.
Macros | |
#define | context_save(context) set_jmp(context) |
Save machine context for userspace context switch. More... | |
#define | context_restore(context) long_jmp(context, 1) |
Restore machine context for userspace context switch. This is used only in inizialitaion. | |
#define | context_switch(context_old, context_new) |
Swicth machine context for userspace context switch. This is used to schedule a LP or return control to simulation kernel. More... | |
#define | context_switch_create(context_old, context_new) |
Swicth machine context for userspace context switch. This is used to schedule a LP or return control to simulation kernel. More... | |
Typedefs | |
typedef exec_context_t | LP_context_t |
Definition of an execution context for an LP. This is just syntactic sugar. | |
typedef exec_context_t | kernel_context_t |
Definition of an execution context for a worker thread. This is just syntactic sugar. | |
Functions | |
void * | get_ult_stack (size_t size) |
Variables | |
__thread kernel_context_t | kernel_context |
This is the execution context of the simulation kernel. | |
User-Level Threads Headers.
The User-Level Thread module allows the creation/scheduling of multiple co-routines which can yield the CPU to a different one, or that can be preƫmpted by some asynchronous event.
Due to the possibility of external preƫmption, ULTs store the whole CPU context in an ad-hoc buffer. This is a significant difference with respect standard facilities such as setjmp/longjmp which only store callee-save registers.
ULTs are used to implement both runtime-level routines (each worker thread has its own execution context) and model-level routines (each LP has its own execution context).
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 ult.h.
#define context_save | ( | context | ) | set_jmp(context) |
Save machine context for userspace context switch.
This macro performs a context save in the specified context (a pointer).
This is used only in initialization to setup the execution contexts. After that, the platform only relies on context_switch()
context | A pointer to the exec_context_t to save the current CPU context into. |
#define context_switch | ( | context_old, | |
context_new | |||
) |
Swicth machine context for userspace context switch. This is used to schedule a LP or return control to simulation kernel.
#define context_switch_create | ( | context_old, | |
context_new | |||
) |
Swicth machine context for userspace context switch. This is used to schedule a LP or return control to simulation kernel.
void* get_ult_stack | ( | size_t | size | ) |
When this function is called, a zeroed page-aligned stack for the ULT is created and returned. The size of the stack can be specified by using the parameter. It's suggested to give a stack size which is a multiple of the page size. Nevertheless, no check is done by this function.
size | The size of the requested stack |
Definition at line 65 of file ult.c.