libfoedus-core
FOEDUS Core Library
foedus::soc Namespace Reference

System On Chip (SOC) and interprocess communication (IPC). More...

Detailed Description

System On Chip (SOC) and interprocess communication (IPC).

This module is special in many ways. SOC might be spawned as a local or remote process, so we first instantiate SOCs before everything else with a special manner (partially because linux's tricky process handling semantics).

See also
foedus::EngineType

Classes

struct  ChildEngineStatus
 Current status of a child SOC engine. More...
 
struct  GlobalMemoryAnchors
 Just a set of pointers within global_memory_ for ease of use. More...
 
struct  MasterEngineStatus
 Current status of master engine. More...
 
struct  NodeMemoryAnchors
 Same as GlobalMemoryAnchors except this is for node_memories_. More...
 
class  SharedCond
 A conditional variable that can be placed in shared memory and used from multiple processes. More...
 
class  SharedMemoryRepo
 Repository of all shared memory in one FOEDUS instance. More...
 
class  SharedMutex
 A mutex that can be placed in shared memory and used from multiple processes. More...
 
class  SharedMutexScope
 Auto-lock scope object for SharedMutex. More...
 
class  SharedPolling
 A polling-wait mechanism that can be placed in shared memory and used from multiple processes. More...
 
class  SharedRendezvous
 A one-time single-producer multiple-consumer event synchronization in shared memory for multiple processes. More...
 
class  SocManager
 SOC manager, which maintains the shared resource across SOCs and, if this engine is a master engine, manages child SOCs. More...
 
class  SocManagerPimpl
 Pimpl object of SocManager. More...
 
struct  SocOptions
 Set of options for SOC manager. More...
 
struct  ThreadMemoryAnchors
 Part of NodeMemoryAnchors for each thread. More...
 

Typedefs

typedef uint16_t SocId
 Represents an ID of an SOC, or NUMA node. More...
 
typedef uint64_t Upid
 Universal (or Unique) ID of a process. More...
 

Functions

void ugly_atomic_inc (uint32_t *address)
 
void ugly_atomic_dec (uint32_t *address)
 
std::string get_self_path (uint64_t upid, Eid eid)
 
std::string get_master_path (uint64_t master_upid, Eid master_eid)
 
uint64_t align_4kb (uint64_t value)
 
uint64_t align_2mb (uint64_t value)
 
void ugly_atomic_inc (uint64_t *address)
 
uint64_t get_now_microsec ()
 

Variables

const uint64_t kDefaultPollingSpins = (1ULL << 10)
 Default value of polling_spins. More...
 
const uint64_t kDefaultPollingMaxIntervalUs = (1ULL << 15)
 Default value of max_interval_us. More...
 
const uint64_t kInitialPollingIntervalUs = (1ULL << 8)
 Initial value of sleep interval in us. More...
 
const uint16_t kMaxSocs = 256U
 Maximum number of SOCs. More...
 

Function Documentation

uint64_t foedus::soc::align_2mb ( uint64_t  value)

Definition at line 66 of file shared_memory_repo.cpp.

Referenced by foedus::soc::SharedMemoryRepo::allocate_shared_memories().

66 { return assorted::align< uint64_t, (1U << 21) >(value); }

Here is the caller graph for this function:

uint64_t foedus::soc::align_4kb ( uint64_t  value)

Definition at line 65 of file shared_memory_repo.cpp.

Referenced by foedus::soc::SharedMemoryRepo::calculate_global_memory_size(), and foedus::soc::SharedMemoryRepo::calculate_node_memory_size().

65 { return assorted::align< uint64_t, (1U << 12) >(value); }

Here is the caller graph for this function:

std::string foedus::soc::get_master_path ( uint64_t  master_upid,
Eid  master_eid 
)

Definition at line 42 of file shared_memory_repo.cpp.

Referenced by foedus::soc::SharedMemoryRepo::attach_shared_memories().

42  {
43  std::string pid_str = std::to_string(master_upid);
44  std::string eid_str = std::to_string(master_eid);
45  return std::string("/tmp/libfoedus_shm_") + pid_str + std::string("_") + eid_str;
46 }

Here is the caller graph for this function:

uint64_t foedus::soc::get_now_microsec ( )

Definition at line 58 of file shared_polling.cpp.

Referenced by foedus::soc::SharedPolling::timedwait().

58  {
59  std::chrono::high_resolution_clock::time_point now = std::chrono::high_resolution_clock::now();
60  return std::chrono::duration_cast<std::chrono::microseconds>(now.time_since_epoch()).count();
61 }

Here is the caller graph for this function:

std::string foedus::soc::get_self_path ( uint64_t  upid,
Eid  eid 
)

Definition at line 37 of file shared_memory_repo.cpp.

Referenced by foedus::soc::SharedMemoryRepo::allocate_shared_memories().

37  {
38  std::string pid_str = std::to_string(upid);
39  std::string eid_str = std::to_string(eid);
40  return std::string("/tmp/libfoedus_shm_") + pid_str + std::string("_") + eid_str;
41 }

Here is the caller graph for this function:

void foedus::soc::ugly_atomic_dec ( uint32_t *  address)

Definition at line 86 of file shared_cond.cpp.

Referenced by foedus::soc::SharedCond::broadcast(), foedus::soc::SharedCond::broadcast_nolock(), foedus::soc::SharedCond::signal(), foedus::soc::SharedCond::timedwait(), and foedus::soc::SharedCond::wait().

86  {
87  reinterpret_cast< std::atomic<uint32_t>* >(address)->fetch_sub(1U);
88 }

Here is the caller graph for this function:

void foedus::soc::ugly_atomic_inc ( uint64_t *  address)

Definition at line 37 of file shared_polling.cpp.

37  {
38  reinterpret_cast< std::atomic<uint64_t>* >(address)->operator++();
39 }
void foedus::soc::ugly_atomic_inc ( uint32_t *  address)

Definition at line 83 of file shared_cond.cpp.

Referenced by foedus::soc::SharedCond::broadcast(), foedus::soc::SharedCond::broadcast_nolock(), foedus::soc::SharedPolling::signal(), foedus::soc::SharedCond::signal(), foedus::soc::SharedCond::timedwait(), and foedus::soc::SharedCond::wait().

83  {
84  reinterpret_cast< std::atomic<uint32_t>* >(address)->fetch_add(1U);
85 }

Here is the caller graph for this function:

Variable Documentation

const uint64_t foedus::soc::kDefaultPollingMaxIntervalUs = (1ULL << 15)

Default value of max_interval_us.

Definition at line 31 of file shared_polling.hpp.

const uint64_t foedus::soc::kDefaultPollingSpins = (1ULL << 10)

Default value of polling_spins.

Definition at line 29 of file shared_polling.hpp.

Referenced by foedus::xct::XctManagerPimpl::handle_epoch_chime().

const uint64_t foedus::soc::kInitialPollingIntervalUs = (1ULL << 8)

Initial value of sleep interval in us.

Definition at line 33 of file shared_polling.hpp.

Referenced by foedus::soc::SharedPolling::timedwait(), and foedus::soc::SharedPolling::wait().