SST/macro
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
sstmac::sw::operating_system Class Reference

#include <operating_system.h>

Inheritance diagram for sstmac::sw::operating_system:
Inheritance graph
Collaboration diagram for sstmac::sw::operating_system:
Collaboration graph

Classes

struct  os_thread_context
 

Public Member Functions

virtual ~operating_system ()
 
virtual void init_factory_params (sprockit::sim_parameters *params)
 
virtual void finalize_init ()
 
void execute (ami::COMP_FUNC, event *data, key::category cat=key::general)
 execute Execute a compute function. More...
 
void execute (ami::COMM_FUNC func, message *data)
 execute Execute a communication function. More...
 
void execute_kernel (ami::COMM_FUNC func, message *data)
 execute Execute a compute function. More...
 
void execute_kernel (ami::COMP_FUNC func, event *data, callback *cb)
 execute Execute a communication function. More...
 
void async_kernel (ami::SERVICE_FUNC func, event *data)
 execute Enqueue an operation to perform This function takes place in "kernel" land and will never block and context switch. More...
 
timestamp block (key *req)
 
timestamp unblock (key *req)
 
void start_thread (thread *t)
 
void join_thread (thread *t)
 
void complete_thread (bool succ)
 
void register_lib (void *owner, library *lib)
 
void unregister_all_libs (void *owner)
 
librarylib (const std::string &name) const
 
void set_ncores (int ncores, int nsocket)
 
void set_event_parent (event_scheduler *man)
 Set the eventmanager for this scheduler. More...
 
void add_application (app *a)
 
void start_app (app *a)
 
void handle_event (event *ev)
 
std::list< app * > app_ptrs (app_id aid)
 
appapp_ptr (software_id sid)
 
thread_data_t current_context () const
 
void print_libs (std::ostream &os=std::cout) const
 
long current_threadid () const
 
void set_node (sstmac::hw::node *n)
 
hw::nodenode () const
 
node_id addr () const
 
void set_addr (node_id addr)
 
void start_api_call ()
 
void schedule_timeout (timestamp delay, key *k)
 
void free_thread_stack (void *stack)
 
sprockit::sim_parameters * params () const
 
void sleep (timestamp t)
 
void compute (timestamp t)
 
void kill_node ()
 
- Public Member Functions inherited from sstmac::event_subscheduler
 event_subscheduler ()
 
timestamp now () const
 get the current time More...
 
virtual std::string to_string () const
 
virtual void handle (event *ev)
 
void schedule (timestamp t, event_handler *handler, event *ev)
 Add an event to the event queue, where msg will get delivered to handler at time t. More...
 
void schedule (timestamp t, event_queue_entry *ev)
 
void schedule_now (event_queue_entry *ev)
 
void schedule_now (event_handler *handler, event *ev)
 
void schedule_delay (timestamp delay, event_handler *handler, event *ev)
 
void schedule_delay (timestamp delay, event_queue_entry *ev)
 
void send_self_event (timestamp arrival, event *ev)
 
void send_delayed_self_event (timestamp delay, event *ev)
 
void send_now_self_event (event *ev)
 
void send_self_event_queue (timestamp arrival, event_queue_entry *ev)
 
void send_delayed_self_event_queue (timestamp delay, event_queue_entry *ev)
 
void send_now_self_event_queue (event_queue_entry *ev)
 
event_schedulerparent () const
 
- Public Member Functions inherited from sstmac::event_handler
virtual ~event_handler ()
 
event_loc_id event_location () const
 
virtual bool ipc_handler () const
 Whether an event handler is a "fake" handler that represents logical process boundary. More...
 
int thread_id () const
 
virtual void deadlock_check (event *ev)
 
virtual void deadlock_check ()
 

Static Public Member Functions

static operating_systemconstruct (sprockit::sim_parameters *params)
 
static os_thread_contextstatic_os_thread_context ()
 
static void delete_statics ()
 
static void switch_to_context (int aid, int tid)
 
static operating_systemcurrent_os ()
 
static app_id current_aid ()
 
static task_id current_tid ()
 
static librarycurrent_library (const std::string &name)
 
static node_id current_node_id ()
 
static node_id remote_node (int tid)
 
static void stack_check ()
 
static void shutdown ()
 
static size_t stacksize ()
 
static threadcurrent_thread ()
 
static void simulation_done ()
 

Private Member Functions

 operating_system ()
 
void add_thread (thread *t)
 
void switch_to_thread (thread_data_t tothread)
 
void init_threading ()
 
void init_services ()
 
os_thread_contextcurrent_os_thread_context ()
 
void register_lib (library *lib)
 
void unregister_lib (library *lib)
 
void local_shutdown ()
 

Private Attributes

hw::nodenode_
 
spkt_unordered_map< std::string, library * > libs_
 
spkt_unordered_map< library *, int > lib_refcounts_
 
spkt_unordered_map< void *, std::list< library * > > libs_by_owner_
 
spkt_unordered_set< std::string > deleted_libs_
 
node_id my_addr_
 
std::list< thread * > threads_
 
std::vector< std::string > startup_libs_
 
std::list< api * > services_
 
std::stack< thread_data_tthreadstack_
 
int current_thread_id_
 
int next_msg_id_
 
spkt_unordered_map< task_id, long > task_to_thread_
 
std::queue< thread * > to_awake_
 
threading_interfacedes_context_
 The caller context (main DES thread). More...
 
sprockit::sim_parameters * params_
 
compute_schedulercompute_sched_
 
ftq_calendarftq_trace_
 
event_traceevent_trace_
 

Static Private Attributes

static graph_vizcall_graph_
 
static operating_system::os_thread_context os_thread_context_
 
static size_t stacksize_
 
static bool cxa_finalizing_
 
static os_thread_context cxa_finalize_context_
 

Friends

class service
 
class thread
 

Additional Inherited Members

- Static Public Attributes inherited from sstmac::event_handler
static const int null_lpid = -1
 
static const int null_threadid = -1
 
- Protected Member Functions inherited from sstmac::event_handler
 event_handler ()
 
void init_loc_id (event_loc_id id)
 
void init_thread_id (int id)
 
- Protected Attributes inherited from sstmac::event_subscheduler
event_schedulerparent_
 

Detailed Description

Definition at line 48 of file operating_system.h.

Constructor & Destructor Documentation

virtual sstmac::sw::operating_system::~operating_system ( )
virtual
sstmac::sw::operating_system::operating_system ( )
private

Referenced by params().

Member Function Documentation

void sstmac::sw::operating_system::add_application ( app a)

Referenced by execute().

void sstmac::sw::operating_system::add_thread ( thread t)
private

Referenced by params().

node_id sstmac::sw::operating_system::addr ( ) const
inline

Definition at line 255 of file operating_system.h.

References my_addr_.

Referenced by set_addr().

app* sstmac::sw::operating_system::app_ptr ( software_id  sid)

Referenced by execute().

std::list<app*> sstmac::sw::operating_system::app_ptrs ( app_id  aid)

Referenced by execute().

void sstmac::sw::operating_system::async_kernel ( ami::SERVICE_FUNC  func,
event data 
)

execute Enqueue an operation to perform This function takes place in "kernel" land and will never block and context switch.

This function can therefore run on the main DES thread. The function must run asynchronously and immediately return with no virtual time advancing.

Parameters
funcThe function to perform
dataEvent carrying all the data describing the compute

Referenced by execute().

timestamp sstmac::sw::operating_system::block ( key req)

Referenced by execute().

void sstmac::sw::operating_system::complete_thread ( bool  succ)

Referenced by execute().

void sstmac::sw::operating_system::compute ( timestamp  t)

Referenced by params().

static operating_system* sstmac::sw::operating_system::construct ( sprockit::sim_parameters *  params)
static
static app_id sstmac::sw::operating_system::current_aid ( )
static
thread_data_t sstmac::sw::operating_system::current_context ( ) const
inline

Definition at line 229 of file operating_system.h.

References threadstack_.

static library* sstmac::sw::operating_system::current_library ( const std::string &  name)
static
static node_id sstmac::sw::operating_system::current_node_id ( )
static
static operating_system* sstmac::sw::operating_system::current_os ( )
static
os_thread_context& sstmac::sw::operating_system::current_os_thread_context ( )
private

Referenced by params().

static thread* sstmac::sw::operating_system::current_thread ( )
static
long sstmac::sw::operating_system::current_threadid ( ) const

Referenced by shutdown().

static task_id sstmac::sw::operating_system::current_tid ( )
static
static void sstmac::sw::operating_system::delete_statics ( )
static
void sstmac::sw::operating_system::execute ( ami::COMP_FUNC  ,
event data,
key::category  cat = key::general 
)

execute Execute a compute function.

This function MUST begin on a user-space thread since it may block and context switch until completion. To invoke compute operations for the main DES thread, use execute_kernel

Parameters
funcThe function to perform
dataEvent carrying all the data describing the compute
catAn optional category labeling the type of operation

Referenced by static_os_thread_context().

void sstmac::sw::operating_system::execute ( ami::COMM_FUNC  func,
message data 
)
inline

execute Execute a communication function.

This function MUST begin on a user-space thread since it may block and context switch until completion. To invoke compute operations for the main DES thread, use execute_kernel

Parameters
dataEvent carrying all the data describing the compute

Definition at line 136 of file operating_system.h.

References add_application(), app_ptr(), app_ptrs(), async_kernel(), block(), complete_thread(), execute_kernel(), handle_event(), join_thread(), lib(), register_lib(), set_event_parent(), set_ncores(), stack_check(), start_app(), start_thread(), unblock(), and unregister_all_libs().

Here is the call graph for this function:

void sstmac::sw::operating_system::execute_kernel ( ami::COMM_FUNC  func,
message data 
)

execute Execute a compute function.

This function takes place in "kernel" land and will never block and context switch. This function can therefore run on the main DES thread

Parameters
funcThe function to perform
dataEvent carrying all the data describing the compute

Referenced by execute().

void sstmac::sw::operating_system::execute_kernel ( ami::COMP_FUNC  func,
event data,
callback cb 
)

execute Execute a communication function.

This function takes place in "kernel" land and will never block and context switch. This function can therefore run on the main DES thread

Parameters
funcThe function to perform
dataEvent carrying all the data describing the compute
cbThe callback to invoke when the kernel is complete
virtual void sstmac::sw::operating_system::finalize_init ( )
virtual
void sstmac::sw::operating_system::free_thread_stack ( void *  stack)

Referenced by set_addr().

void sstmac::sw::operating_system::handle_event ( event ev)

Referenced by execute().

virtual void sstmac::sw::operating_system::init_factory_params ( sprockit::sim_parameters *  params)
virtual
void sstmac::sw::operating_system::init_services ( )
private

Referenced by params().

void sstmac::sw::operating_system::init_threading ( )
private

Referenced by params().

void sstmac::sw::operating_system::join_thread ( thread t)

Referenced by execute().

void sstmac::sw::operating_system::kill_node ( )

Referenced by params().

library* sstmac::sw::operating_system::lib ( const std::string &  name) const

Referenced by execute().

void sstmac::sw::operating_system::local_shutdown ( )
private

Referenced by params(), and shutdown().

hw::node* sstmac::sw::operating_system::node ( ) const
inline

Definition at line 250 of file operating_system.h.

References node_.

sprockit::sim_parameters* sstmac::sw::operating_system::params ( ) const
inline
void sstmac::sw::operating_system::print_libs ( std::ostream &  os = std::cout) const

Referenced by shutdown().

void sstmac::sw::operating_system::register_lib ( void *  owner,
library lib 
)

Referenced by execute(), and params().

void sstmac::sw::operating_system::register_lib ( library lib)
private
static node_id sstmac::sw::operating_system::remote_node ( int  tid)
static
void sstmac::sw::operating_system::schedule_timeout ( timestamp  delay,
key k 
)

Referenced by set_addr().

void sstmac::sw::operating_system::set_addr ( node_id  addr)
inline

Definition at line 260 of file operating_system.h.

References addr(), free_thread_stack(), sstmac::event_handler::init_loc_id(), my_addr_, schedule_timeout(), and start_api_call().

Here is the call graph for this function:

void sstmac::sw::operating_system::set_event_parent ( event_scheduler m)
virtual

Set the eventmanager for this scheduler.

Unfortunately, this always has to be called after an event_scheduler is constructed.

Parameters
mthe simulation eventmanager

Reimplemented from sstmac::event_subscheduler.

Referenced by execute().

void sstmac::sw::operating_system::set_ncores ( int  ncores,
int  nsocket 
)

Referenced by execute().

void sstmac::sw::operating_system::set_node ( sstmac::hw::node n)
inline

Definition at line 245 of file operating_system.h.

References node_.

static void sstmac::sw::operating_system::shutdown ( )
inlinestatic

Definition at line 234 of file operating_system.h.

References sstmac::sw::operating_system::os_thread_context::current_os, current_threadid(), local_shutdown(), and print_libs().

Here is the call graph for this function:

static void sstmac::sw::operating_system::simulation_done ( )
static

Referenced by stacksize().

void sstmac::sw::operating_system::sleep ( timestamp  t)

Referenced by params().

static void sstmac::sw::operating_system::stack_check ( )
static

Referenced by execute().

static size_t sstmac::sw::operating_system::stacksize ( )
inlinestatic

Definition at line 275 of file operating_system.h.

References sstmac::sw::operating_system::os_thread_context::current_thread, simulation_done(), and stacksize_.

Here is the call graph for this function:

void sstmac::sw::operating_system::start_api_call ( )

Referenced by set_addr().

void sstmac::sw::operating_system::start_app ( app a)

Referenced by execute().

void sstmac::sw::operating_system::start_thread ( thread t)

Referenced by execute().

static os_thread_context& sstmac::sw::operating_system::static_os_thread_context ( )
inlinestatic
static void sstmac::sw::operating_system::switch_to_context ( int  aid,
int  tid 
)
static
void sstmac::sw::operating_system::switch_to_thread ( thread_data_t  tothread)
private

Referenced by params().

timestamp sstmac::sw::operating_system::unblock ( key req)

Referenced by execute().

void sstmac::sw::operating_system::unregister_all_libs ( void *  owner)

Referenced by execute().

void sstmac::sw::operating_system::unregister_lib ( library lib)
private

Referenced by params().

Friends And Related Function Documentation

friend class service
friend

Definition at line 51 of file operating_system.h.

friend class thread
friend

Definition at line 52 of file operating_system.h.

Member Data Documentation

graph_viz* sstmac::sw::operating_system::call_graph_
staticprivate

Definition at line 358 of file operating_system.h.

compute_scheduler* sstmac::sw::operating_system::compute_sched_
private

Definition at line 356 of file operating_system.h.

int sstmac::sw::operating_system::current_thread_id_
private

Definition at line 342 of file operating_system.h.

os_thread_context sstmac::sw::operating_system::cxa_finalize_context_
staticprivate

Definition at line 378 of file operating_system.h.

bool sstmac::sw::operating_system::cxa_finalizing_
staticprivate

Definition at line 377 of file operating_system.h.

Referenced by static_os_thread_context().

spkt_unordered_set<std::string> sstmac::sw::operating_system::deleted_libs_
private

Definition at line 330 of file operating_system.h.

threading_interface* sstmac::sw::operating_system::des_context_
private

The caller context (main DES thread).

We go back to this context on every context switch.

Definition at line 352 of file operating_system.h.

event_trace* sstmac::sw::operating_system::event_trace_
private

Definition at line 362 of file operating_system.h.

ftq_calendar* sstmac::sw::operating_system::ftq_trace_
private

Definition at line 360 of file operating_system.h.

spkt_unordered_map<library*, int> sstmac::sw::operating_system::lib_refcounts_
private

Definition at line 328 of file operating_system.h.

spkt_unordered_map<std::string, library*> sstmac::sw::operating_system::libs_
private

Definition at line 327 of file operating_system.h.

spkt_unordered_map<void*, std::list<library*> > sstmac::sw::operating_system::libs_by_owner_
private

Definition at line 329 of file operating_system.h.

node_id sstmac::sw::operating_system::my_addr_
private

Definition at line 332 of file operating_system.h.

Referenced by addr(), and set_addr().

int sstmac::sw::operating_system::next_msg_id_
private

Definition at line 344 of file operating_system.h.

hw::node* sstmac::sw::operating_system::node_
private

Definition at line 326 of file operating_system.h.

Referenced by node(), and set_node().

operating_system::os_thread_context sstmac::sw::operating_system::os_thread_context_
staticprivate

Definition at line 367 of file operating_system.h.

Referenced by static_os_thread_context().

sprockit::sim_parameters* sstmac::sw::operating_system::params_
private

Definition at line 354 of file operating_system.h.

Referenced by params().

std::list<api*> sstmac::sw::operating_system::services_
private

Definition at line 338 of file operating_system.h.

size_t sstmac::sw::operating_system::stacksize_
staticprivate

Definition at line 376 of file operating_system.h.

Referenced by stacksize().

std::vector<std::string> sstmac::sw::operating_system::startup_libs_
private

Definition at line 336 of file operating_system.h.

spkt_unordered_map<task_id, long> sstmac::sw::operating_system::task_to_thread_
private

Definition at line 346 of file operating_system.h.

std::list<thread*> sstmac::sw::operating_system::threads_
private

Definition at line 334 of file operating_system.h.

std::stack<thread_data_t> sstmac::sw::operating_system::threadstack_
private

Definition at line 340 of file operating_system.h.

Referenced by current_context().

std::queue<thread*> sstmac::sw::operating_system::to_awake_
private

Definition at line 348 of file operating_system.h.


The documentation for this class was generated from the following file: