libfoedus-core
FOEDUS Core Library
|
Pimpl object of SocManager. More...
Pimpl object of SocManager.
A private pimpl object for SocManager. Do not include this header from a client program unless you know what you are doing.
Definition at line 43 of file soc_manager_pimpl.hpp.
#include <soc_manager_pimpl.hpp>
Public Member Functions | |
SocManagerPimpl ()=delete | |
SocManagerPimpl (Engine *engine) | |
ErrorStack | initialize_once () override |
ErrorStack | uninitialize_once () override |
void | report_engine_fatal_error () |
ErrorStack | initialize_master () |
Called as part of initialize_once() if this is a master engine. More... | |
ErrorStack | initialize_child () |
Called as part of initialize_once() if this is a child SOC engine. More... | |
ErrorStack | launch_emulated_children () |
Launch emulated children as threads. More... | |
ErrorStack | launch_forked_children () |
Launch children via fork. More... | |
ErrorStack | launch_spawned_children () |
Launch children via spawn. More... | |
ErrorStack | wait_for_child_attach () |
Wait for child SOCs to start up and at least finish attaching shared memory. More... | |
ErrorStack | wait_for_child_terminate () |
Wait for child SOCs to terminate. More... | |
ErrorStack | wait_for_master_status (MasterEngineStatus::StatusCode target_status) |
Wait for master engine to finish upto the specified status. More... | |
ErrorStack | wait_for_master_module (bool init, ModuleType module) |
ErrorStack | wait_for_children_module (bool init, ModuleType module) |
void | emulated_child_main (SocId node) |
Main routine of emulated SOCs. More... | |
int | forked_child_main (SocId node) |
Main routine of forked SOCs. More... | |
![]() | |
DefaultInitializable () | |
virtual | ~DefaultInitializable () |
DefaultInitializable (const DefaultInitializable &)=delete | |
DefaultInitializable & | operator= (const DefaultInitializable &)=delete |
ErrorStack | initialize () override final |
Typical implementation of Initializable::initialize() that provides initialize-once semantics. More... | |
ErrorStack | uninitialize () override final |
Typical implementation of Initializable::uninitialize() that provides uninitialize-once semantics. More... | |
bool | is_initialized () const override final |
Returns whether the object has been already initialized or not. More... | |
![]() | |
virtual | ~Initializable () |
Static Public Member Functions | |
static void | spawned_child_main (const std::vector< proc::ProcAndName > &procedures) |
Main routine of spawned SOCs. More... | |
static ErrorStack | child_main_common (EngineType engine_type, Upid master_upid, Eid master_eid, SocId node, const std::vector< proc::ProcAndName > &procedures) |
Public Attributes | |
Engine *const | engine_ |
SharedMemoryRepo | memory_repo_ |
std::vector< std::thread > | child_emulated_threads_ |
Threads that emulate child SOCs. More... | |
std::vector< Engine * > | child_emulated_engines_ |
And their engines. More... | |
Upid | child_upids_ [kMaxSocs] |
Process IDs of child SOCs. More... | |
|
delete |
|
inlineexplicit |
Definition at line 46 of file soc_manager_pimpl.hpp.
|
static |
Definition at line 594 of file soc_manager_pimpl.cpp.
References foedus::soc::SharedMemoryRepo::change_child_status(), CHECK_ERROR, COERCE_ERROR, foedus::proc::ProcManager::describe_registered_procs(), foedus::Engine::get_proc_manager(), foedus::Engine::get_soc_manager(), foedus::Engine::initialize(), foedus::ErrorStack::is_error(), foedus::kChildEmulated, foedus::kRetOk, foedus::soc::MasterEngineStatus::kRunning, foedus::soc::ChildEngineStatus::kRunning, foedus::soc::ChildEngineStatus::kTerminated, foedus::soc::MasterEngineStatus::kWaitingForChildTerminate, foedus::soc::ChildEngineStatus::kWaitingForMasterInitialization, foedus::proc::ProcManager::local_register(), memory_repo_, foedus::Engine::uninitialize(), and wait_for_master_status().
Referenced by emulated_child_main(), forked_child_main(), and spawned_child_main().
void foedus::soc::SocManagerPimpl::emulated_child_main | ( | SocId | node | ) |
Main routine of emulated SOCs.
Definition at line 462 of file soc_manager_pimpl.cpp.
References child_main_common(), engine_, foedus::Engine::get_master_eid(), foedus::Engine::get_master_upid(), foedus::proc::ProcManager::get_pre_registered_procedures(), foedus::Engine::get_proc_manager(), foedus::ErrorStack::is_error(), and foedus::kChildEmulated.
Referenced by launch_emulated_children().
int foedus::soc::SocManagerPimpl::forked_child_main | ( | SocId | node | ) |
Main routine of forked SOCs.
Definition at line 503 of file soc_manager_pimpl.cpp.
References child_main_common(), engine_, foedus::Engine::get_master_eid(), foedus::Engine::get_master_upid(), foedus::proc::ProcManager::get_pre_registered_procedures(), foedus::Engine::get_proc_manager(), foedus::ErrorStack::is_error(), and foedus::kChildForked.
Referenced by launch_forked_children().
ErrorStack foedus::soc::SocManagerPimpl::initialize_child | ( | ) |
Called as part of initialize_once() if this is a child SOC engine.
Definition at line 128 of file soc_manager_pimpl.cpp.
References foedus::soc::SharedMemoryRepo::attach_shared_memories(), foedus::soc::SharedMemoryRepo::change_child_status(), COERCE_ERROR, engine_, foedus::Engine::get_master_eid(), foedus::Engine::get_master_upid(), foedus::Engine::get_nonconst_options(), foedus::Engine::get_soc_id(), foedus::ErrorStack::is_error(), foedus::kRetOk, foedus::soc::ChildEngineStatus::kSharedMemoryAttached, foedus::soc::MasterEngineStatus::kSharedMemoryReservedReclamation, memory_repo_, and wait_for_master_status().
Referenced by initialize_once().
ErrorStack foedus::soc::SocManagerPimpl::initialize_master | ( | ) |
Called as part of initialize_once() if this is a master engine.
Definition at line 86 of file soc_manager_pimpl.cpp.
References foedus::soc::SharedMemoryRepo::allocate_shared_memories(), CHECK_ERROR, child_emulated_engines_, child_emulated_threads_, foedus::soc::NodeMemoryAnchors::child_status_memory_, child_upids_, foedus::soc::SharedMemoryRepo::deallocate_shared_memories(), engine_, foedus::soc::SharedMemoryRepo::get_global_memory_anchors(), foedus::Engine::get_master_eid(), foedus::Engine::get_master_upid(), foedus::soc::SharedMemoryRepo::get_node_memory_anchors(), foedus::Engine::get_options(), foedus::thread::ThreadOptions::group_count_, foedus::soc::MasterEngineStatus::initialized_modules_, foedus::soc::ChildEngineStatus::initialized_modules_, foedus::ErrorStack::is_error(), foedus::kChildForked, foedus::kChildLocalSpawned, foedus::kChildRemoteSpawned, foedus::kDummyTail, foedus::soc::ChildEngineStatus::kInitial, foedus::kInvalid, foedus::kRetOk, foedus::soc::MasterEngineStatus::kSharedMemoryAllocated, launch_emulated_children(), launch_forked_children(), launch_spawned_children(), foedus::soc::GlobalMemoryAnchors::master_status_memory_, memory_repo_, foedus::EngineOptions::soc_, foedus::soc::SocOptions::soc_type_, foedus::fs::status(), foedus::soc::MasterEngineStatus::status_code_, foedus::soc::ChildEngineStatus::status_code_, foedus::EngineOptions::thread_, foedus::soc::MasterEngineStatus::uninitialized_modules_, and foedus::soc::ChildEngineStatus::uninitialized_modules_.
Referenced by initialize_once().
|
overridevirtual |
Implements foedus::DefaultInitializable.
Definition at line 49 of file soc_manager_pimpl.cpp.
References engine_, initialize_child(), initialize_master(), and foedus::Engine::is_master().
ErrorStack foedus::soc::SocManagerPimpl::launch_emulated_children | ( | ) |
Launch emulated children as threads.
Definition at line 445 of file soc_manager_pimpl.cpp.
References CHECK_ERROR, child_emulated_engines_, child_emulated_threads_, emulated_child_main(), engine_, foedus::Engine::get_options(), foedus::thread::ThreadOptions::group_count_, foedus::kRetOk, foedus::EngineOptions::thread_, and wait_for_child_attach().
Referenced by initialize_master().
ErrorStack foedus::soc::SocManagerPimpl::launch_forked_children | ( | ) |
Launch children via fork.
Definition at line 479 of file soc_manager_pimpl.cpp.
References foedus::soc::SharedMemoryRepo::change_master_status(), CHECK_ERROR, child_upids_, foedus::soc::SharedMemoryRepo::deallocate_shared_memories(), engine_, ERROR_STACK, forked_child_main(), foedus::Engine::get_options(), foedus::thread::ThreadOptions::group_count_, foedus::kErrorCodeSocForkFailed, foedus::soc::MasterEngineStatus::kFatalError, foedus::kRetOk, memory_repo_, foedus::assorted::os_error(), foedus::EngineOptions::thread_, and wait_for_child_attach().
Referenced by initialize_master().
ErrorStack foedus::soc::SocManagerPimpl::launch_spawned_children | ( | ) |
Launch children via spawn.
Definition at line 523 of file soc_manager_pimpl.cpp.
References foedus::soc::SharedMemoryRepo::change_master_status(), CHECK_ERROR, child_upids_, foedus::soc::SocOptions::convert_spawn_executable_pattern(), foedus::soc::SocOptions::convert_spawn_ld_library_path_pattern(), foedus::soc::SharedMemoryRepo::deallocate_shared_memories(), engine_, ERROR_STACK, foedus::Engine::get_master_eid(), foedus::Engine::get_master_upid(), foedus::Engine::get_options(), foedus::thread::ThreadOptions::group_count_, foedus::kErrorCodeSocSpawnFailed, foedus::soc::MasterEngineStatus::kFatalError, foedus::kRetOk, memory_repo_, foedus::assorted::os_error(), foedus::EngineOptions::soc_, foedus::EngineOptions::thread_, and wait_for_child_attach().
Referenced by initialize_master().
void foedus::soc::SocManagerPimpl::report_engine_fatal_error | ( | ) |
Definition at line 67 of file soc_manager_pimpl.cpp.
References foedus::soc::MasterEngineStatus::change_status_atomic(), foedus::soc::ChildEngineStatus::change_status_atomic(), engine_, foedus::soc::SharedMemoryRepo::get_global_memory_anchors(), foedus::soc::SharedMemoryRepo::get_node_memory_anchors(), foedus::Engine::get_soc_id(), foedus::DefaultInitializable::is_initialized(), foedus::Engine::is_master(), foedus::soc::MasterEngineStatus::kFatalError, foedus::soc::ChildEngineStatus::kFatalError, foedus::soc::GlobalMemoryAnchors::master_status_memory_, memory_repo_, and foedus::fs::status().
Referenced by foedus::soc::SocManager::report_engine_fatal_error().
|
static |
Main routine of spawned SOCs.
This is invoked from user's main(), so it's static.
Definition at line 568 of file soc_manager_pimpl.cpp.
References child_main_common(), foedus::ErrorStack::is_error(), and foedus::kChildLocalSpawned.
Referenced by foedus::soc::SocManager::trap_spawned_soc_main().
|
overridevirtual |
Implements foedus::DefaultInitializable.
Definition at line 57 of file soc_manager_pimpl.cpp.
References foedus::soc::SharedMemoryRepo::change_master_status(), CHECK_ERROR, foedus::soc::SharedMemoryRepo::deallocate_shared_memories(), engine_, foedus::soc::SharedMemoryRepo::get_global_memory(), foedus::Engine::is_master(), foedus::soc::MasterEngineStatus::kTerminated, memory_repo_, SUMMARIZE_ERROR_BATCH, and wait_for_child_terminate().
ErrorStack foedus::soc::SocManagerPimpl::wait_for_child_attach | ( | ) |
Wait for child SOCs to start up and at least finish attaching shared memory.
Definition at line 152 of file soc_manager_pimpl.cpp.
References foedus::soc::SharedMemoryRepo::change_master_status(), child_upids_, foedus::soc::SharedMemoryRepo::deallocate_shared_memories(), engine_, ERROR_STACK, foedus::soc::SharedMemoryRepo::get_child_status(), foedus::Engine::get_options(), foedus::thread::ThreadOptions::group_count_, foedus::kChildEmulated, foedus::kErrorCodeSocLaunchTimeout, foedus::kErrorCodeSocShmAttachFailed, foedus::soc::MasterEngineStatus::kFatalError, foedus::soc::ChildEngineStatus::kInitial, foedus::kRetOk, foedus::soc::ChildEngineStatus::kSharedMemoryAttached, foedus::soc::MasterEngineStatus::kSharedMemoryReservedReclamation, foedus::soc::SharedMemoryRepo::mark_for_release(), memory_repo_, foedus::assorted::os_error(), foedus::EngineOptions::soc_, foedus::soc::SocOptions::soc_type_, foedus::assorted::spinlock_yield(), foedus::fs::status(), and foedus::EngineOptions::thread_.
Referenced by launch_emulated_children(), launch_forked_children(), and launch_spawned_children().
ErrorStack foedus::soc::SocManagerPimpl::wait_for_child_terminate | ( | ) |
Wait for child SOCs to terminate.
Definition at line 228 of file soc_manager_pimpl.cpp.
References foedus::soc::SharedMemoryRepo::change_master_status(), child_emulated_threads_, child_upids_, engine_, ERROR_STACK, foedus::soc::SharedMemoryRepo::get_child_status(), foedus::Engine::get_options(), foedus::thread::ThreadOptions::group_count_, foedus::kChildEmulated, foedus::kErrorCodeSocTerminateFailed, foedus::kErrorCodeSocTerminateTimeout, foedus::soc::MasterEngineStatus::kFatalError, foedus::soc::ChildEngineStatus::kFatalError, foedus::kRetOk, foedus::soc::ChildEngineStatus::kRunning, foedus::soc::ChildEngineStatus::kTerminated, memory_repo_, foedus::EngineOptions::soc_, foedus::soc::SocOptions::soc_type_, foedus::assorted::spinlock_yield(), foedus::fs::status(), and foedus::EngineOptions::thread_.
Referenced by uninitialize_once().
ErrorStack foedus::soc::SocManagerPimpl::wait_for_children_module | ( | bool | init, |
ModuleType | module | ||
) |
Definition at line 360 of file soc_manager_pimpl.cpp.
References ASSERT_ND, foedus::soc::NodeMemoryAnchors::child_status_memory_, child_upids_, engine_, ERROR_STACK, foedus::soc::SharedMemoryRepo::get_node_memory_anchors(), foedus::Engine::get_options(), foedus::thread::ThreadOptions::group_count_, foedus::soc::ChildEngineStatus::initialized_modules_, foedus::kChildEmulated, foedus::kErrorCodeSocChildInitFailed, foedus::kErrorCodeSocChildUninitFailed, foedus::soc::ChildEngineStatus::kFatalError, foedus::kRetOk, foedus::kSoc, foedus::assorted::memory_fence_acq_rel(), memory_repo_, foedus::EngineOptions::soc_, foedus::soc::SocOptions::soc_type_, foedus::assorted::spinlock_yield(), foedus::fs::status(), foedus::soc::ChildEngineStatus::status_code_, foedus::EngineOptions::thread_, and foedus::soc::ChildEngineStatus::uninitialized_modules_.
Referenced by foedus::soc::SocManager::wait_for_children_module().
ErrorStack foedus::soc::SocManagerPimpl::wait_for_master_module | ( | bool | init, |
ModuleType | module | ||
) |
Definition at line 327 of file soc_manager_pimpl.cpp.
References ERROR_STACK, foedus::soc::SharedMemoryRepo::get_global_memory_anchors(), foedus::soc::MasterEngineStatus::initialized_modules_, foedus::kErrorCodeSocChildInitFailed, foedus::kErrorCodeSocChildUninitFailed, foedus::soc::MasterEngineStatus::kFatalError, foedus::kRetOk, foedus::soc::MasterEngineStatus::kTerminated, foedus::soc::GlobalMemoryAnchors::master_status_memory_, foedus::assorted::memory_fence_acq_rel(), memory_repo_, foedus::assorted::spinlock_yield(), foedus::fs::status(), foedus::soc::MasterEngineStatus::status_code_, and foedus::soc::MasterEngineStatus::uninitialized_modules_.
Referenced by foedus::soc::SocManager::wait_for_master_module().
ErrorStack foedus::soc::SocManagerPimpl::wait_for_master_status | ( | MasterEngineStatus::StatusCode | target_status | ) |
Wait for master engine to finish upto the specified status.
Definition at line 286 of file soc_manager_pimpl.cpp.
References ASSERT_ND, engine_, ERROR_STACK, foedus::soc::SharedMemoryRepo::get_master_status(), foedus::Engine::is_master(), foedus::kErrorCodeSocMasterDied, foedus::kErrorCodeSocMasterUnexpectedState, foedus::soc::MasterEngineStatus::kFatalError, foedus::kRetOk, memory_repo_, and foedus::assorted::spinlock_yield().
Referenced by child_main_common(), and initialize_child().
std::vector< Engine* > foedus::soc::SocManagerPimpl::child_emulated_engines_ |
And their engines.
These pointers become invalid when the threads quit
Definition at line 95 of file soc_manager_pimpl.hpp.
Referenced by initialize_master(), and launch_emulated_children().
std::vector<std::thread> foedus::soc::SocManagerPimpl::child_emulated_threads_ |
Threads that emulate child SOCs.
Used when this is a master engine and also children are emulated.
Definition at line 93 of file soc_manager_pimpl.hpp.
Referenced by initialize_master(), launch_emulated_children(), and wait_for_child_terminate().
Process IDs of child SOCs.
Used when this is a master engine and also children are not emulated.
Definition at line 101 of file soc_manager_pimpl.hpp.
Referenced by initialize_master(), launch_forked_children(), launch_spawned_children(), wait_for_child_attach(), wait_for_child_terminate(), and wait_for_children_module().
Engine* const foedus::soc::SocManagerPimpl::engine_ |
Definition at line 86 of file soc_manager_pimpl.hpp.
Referenced by emulated_child_main(), forked_child_main(), foedus::soc::SocManager::get_shared_user_memory_size(), initialize_child(), initialize_master(), initialize_once(), launch_emulated_children(), launch_forked_children(), launch_spawned_children(), report_engine_fatal_error(), uninitialize_once(), wait_for_child_attach(), wait_for_child_terminate(), wait_for_children_module(), and wait_for_master_status().
SharedMemoryRepo foedus::soc::SocManagerPimpl::memory_repo_ |
Definition at line 87 of file soc_manager_pimpl.hpp.
Referenced by child_main_common(), foedus::soc::SocManager::get_shared_memory_repo(), foedus::soc::SocManager::get_shared_user_memory(), initialize_child(), initialize_master(), launch_forked_children(), launch_spawned_children(), report_engine_fatal_error(), uninitialize_once(), wait_for_child_attach(), wait_for_child_terminate(), wait_for_children_module(), wait_for_master_module(), and wait_for_master_status().