libfoedus-core
FOEDUS Core Library
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
foedus::xct::McsWwLock Struct Reference

An exclusive-only (WW) MCS lock data structure. More...

Detailed Description

An exclusive-only (WW) MCS lock data structure.

This is the minimal unit of locking in our system. Unlike SILO, we employ MCS locking that scales much better on big machines. This object stores tail-waiter, which indicates the thread that is in the tail of the queue lock, which might be the owner of the lock. The MCS-lock nodes are pre-allocated for each thread and placed in shared memory.

This is the original MCSg lock implementation without cancel/RW functionality. It has the guest functionality used by background threads to take page locks.

Definition at line 324 of file xct_id.hpp.

#include <xct_id.hpp>

Collaboration diagram for foedus::xct::McsWwLock:

Public Member Functions

 McsWwLock ()
 
 McsWwLock (thread::ThreadId tail_waiter, McsBlockIndex tail_waiter_block)
 
 McsWwLock (const McsWwLock &other)=delete
 
McsWwLockoperator= (const McsWwLock &other)=delete
 
bool is_locked () const
 This is a "relaxed" check. More...
 
void ownerless_initial_lock ()
 The followings are implemented in thread_pimpl.cpp along with the above methods, but these don't use any of Thread's context information. More...
 
void ownerless_acquire_lock ()
 
void ownerless_release_lock ()
 
thread::ThreadId get_tail_waiter () const __attribute__((always_inline))
 This is a "relaxed" check. More...
 
McsBlockIndex get_tail_waiter_block () const __attribute__((always_inline))
 This is a "relaxed" check. More...
 
McsWwBlockData get_tail_relaxed () const __attribute__((always_inline))
 
McsWwBlockData get_tail_once () const __attribute__((always_inline))
 
McsWwBlockData get_tail_consume () const __attribute__((always_inline))
 
McsWwBlockData get_tail_acquire () const __attribute__((always_inline))
 
McsWwBlockData get_tail_atomic () const __attribute__((always_inline))
 
void reset () __attribute__((always_inline))
 used only while page initialization More...
 
void reset_guest_id_release ()
 
void reset (thread::ThreadId tail_waiter, McsBlockIndex tail_waiter_block) __attribute__((always_inline))
 used only for initial_lock() More...
 
void reset_atomic () __attribute__((always_inline))
 
void reset_atomic (thread::ThreadId tail_waiter, McsBlockIndex tail_waiter_block) __attribute__((always_inline))
 
void reset_release () __attribute__((always_inline))
 
void reset_release (thread::ThreadId tail_waiter, McsBlockIndex tail_waiter_block) __attribute__((always_inline))
 

Public Attributes

McsWwBlockData tail_
 

Friends

std::ostream & operator<< (std::ostream &o, const McsWwLock &v)
 Debug out operators. More...
 

Constructor & Destructor Documentation

foedus::xct::McsWwLock::McsWwLock ( )
inline

Definition at line 325 of file xct_id.hpp.

References foedus::xct::McsWwBlockData::clear(), and tail_.

325 { tail_.clear(); }
void clear() __attribute__((always_inline))
Definition: xct_id.hpp:253
McsWwBlockData tail_
Definition: xct_id.hpp:377

Here is the call graph for this function:

foedus::xct::McsWwLock::McsWwLock ( thread::ThreadId  tail_waiter,
McsBlockIndex  tail_waiter_block 
)
inline

Definition at line 326 of file xct_id.hpp.

References foedus::xct::McsWwBlockData::set_relaxed(), and tail_.

326  {
327  tail_.set_relaxed(tail_waiter, tail_waiter_block);
328  }
void set_relaxed(uint32_t thread_id, McsBlockIndex block) __attribute__((always_inline))
Definition: xct_id.hpp:256
McsWwBlockData tail_
Definition: xct_id.hpp:377

Here is the call graph for this function:

foedus::xct::McsWwLock::McsWwLock ( const McsWwLock other)
delete

Member Function Documentation

McsWwBlockData foedus::xct::McsWwLock::get_tail_acquire ( ) const
inline

Definition at line 351 of file xct_id.hpp.

References foedus::xct::McsWwBlockData::copy_acquire(), and tail_.

351 { return tail_.copy_acquire(); }
McsWwBlockData copy_acquire() const __attribute__((always_inline))
Definition: xct_id.hpp:227
McsWwBlockData tail_
Definition: xct_id.hpp:377

Here is the call graph for this function:

McsWwBlockData foedus::xct::McsWwLock::get_tail_atomic ( ) const
inline

Definition at line 352 of file xct_id.hpp.

References foedus::xct::McsWwBlockData::copy_atomic(), and tail_.

352 { return tail_.copy_atomic(); }
McsWwBlockData tail_
Definition: xct_id.hpp:377
McsWwBlockData copy_atomic() const __attribute__((always_inline))
Definition: xct_id.hpp:228

Here is the call graph for this function:

McsWwBlockData foedus::xct::McsWwLock::get_tail_consume ( ) const
inline

Definition at line 350 of file xct_id.hpp.

References foedus::xct::McsWwBlockData::copy_consume(), and tail_.

350 { return tail_.copy_consume(); }
McsWwBlockData copy_consume() const __attribute__((always_inline))
Definition: xct_id.hpp:226
McsWwBlockData tail_
Definition: xct_id.hpp:377

Here is the call graph for this function:

McsWwBlockData foedus::xct::McsWwLock::get_tail_once ( ) const
inline

Definition at line 349 of file xct_id.hpp.

References foedus::xct::McsWwBlockData::copy_once(), and tail_.

349 { return tail_.copy_once(); }
McsWwBlockData copy_once() const __attribute__((always_inline))
Definition: xct_id.hpp:225
McsWwBlockData tail_
Definition: xct_id.hpp:377

Here is the call graph for this function:

McsWwBlockData foedus::xct::McsWwLock::get_tail_relaxed ( ) const
inline

Definition at line 348 of file xct_id.hpp.

References tail_.

348 { return tail_; }
McsWwBlockData tail_
Definition: xct_id.hpp:377
thread::ThreadId foedus::xct::McsWwLock::get_tail_waiter ( ) const
inline

This is a "relaxed" check.

Use with caution.

Definition at line 344 of file xct_id.hpp.

References foedus::xct::McsWwBlockData::get_thread_id_relaxed(), and tail_.

Referenced by foedus::xct::operator<<(), and foedus::xct::McsWwImpl< ADAPTOR >::release().

344 { return tail_.get_thread_id_relaxed(); }
uint32_t get_thread_id_relaxed() const __attribute__((always_inline))
Carefully use this! In some places you must call get_word_once() then call this on the copy...
Definition: xct_id.hpp:243
McsWwBlockData tail_
Definition: xct_id.hpp:377

Here is the call graph for this function:

Here is the caller graph for this function:

McsBlockIndex foedus::xct::McsWwLock::get_tail_waiter_block ( ) const
inline

This is a "relaxed" check.

Use with caution.

Definition at line 346 of file xct_id.hpp.

References foedus::xct::McsWwBlockData::get_block_relaxed(), and tail_.

Referenced by foedus::xct::operator<<().

346 { return tail_.get_block_relaxed(); }
McsWwBlockData tail_
Definition: xct_id.hpp:377
McsBlockIndex get_block_relaxed() const __attribute__((always_inline))
Carefully use this! In some places you must call get_word_once() then call this on the copy...
Definition: xct_id.hpp:250

Here is the call graph for this function:

Here is the caller graph for this function:

McsWwLock& foedus::xct::McsWwLock::operator= ( const McsWwLock other)
delete
void foedus::xct::McsWwLock::ownerless_acquire_lock ( )

Definition at line 78 of file xct_id.cpp.

References foedus::xct::McsWwOwnerlessImpl::ownerless_acquire_unconditional().

Referenced by foedus::xct::McsOwnerlessLockScope::acquire().

78  {
80 }
static void ownerless_acquire_unconditional(McsWwLock *lock)
[WW-Guest] Unconditionally takes exclusive-only guest lock on the given MCSg lock.

Here is the call graph for this function:

Here is the caller graph for this function:

void foedus::xct::McsWwLock::ownerless_initial_lock ( )

The followings are implemented in thread_pimpl.cpp along with the above methods, but these don't use any of Thread's context information.

Definition at line 86 of file xct_id.cpp.

References foedus::xct::McsWwOwnerlessImpl::ownerless_initial().

Referenced by foedus::xct::McsOwnerlessLockScope::acquire().

86  {
88 }
static void ownerless_initial(McsWwLock *lock)

Here is the call graph for this function:

Here is the caller graph for this function:

void foedus::xct::McsWwLock::ownerless_release_lock ( )

Definition at line 82 of file xct_id.cpp.

References foedus::xct::McsWwOwnerlessImpl::ownerless_release().

Referenced by foedus::xct::McsOwnerlessLockScope::release().

82  {
84 }
static void ownerless_release(McsWwLock *lock)

Here is the call graph for this function:

Here is the caller graph for this function:

void foedus::xct::McsWwLock::reset ( )
inline

used only while page initialization

Definition at line 355 of file xct_id.hpp.

References foedus::xct::McsWwBlockData::clear(), and tail_.

Referenced by foedus::xct::McsMockDataPage::init(), foedus::storage::PageVersion::reset(), and foedus::xct::LockableXctId::reset().

355 { tail_.clear(); }
void clear() __attribute__((always_inline))
Definition: xct_id.hpp:253
McsWwBlockData tail_
Definition: xct_id.hpp:377

Here is the call graph for this function:

Here is the caller graph for this function:

void foedus::xct::McsWwLock::reset ( thread::ThreadId  tail_waiter,
McsBlockIndex  tail_waiter_block 
)
inline

used only for initial_lock()

Definition at line 362 of file xct_id.hpp.

References foedus::xct::McsWwBlockData::set_relaxed(), and tail_.

362  {
363  tail_.set_relaxed(tail_waiter, tail_waiter_block);
364  }
void set_relaxed(uint32_t thread_id, McsBlockIndex block) __attribute__((always_inline))
Definition: xct_id.hpp:256
McsWwBlockData tail_
Definition: xct_id.hpp:377

Here is the call graph for this function:

void foedus::xct::McsWwLock::reset_atomic ( )
inline

Definition at line 366 of file xct_id.hpp.

References reset_atomic().

Referenced by reset_atomic().

366 { reset_atomic(0, 0); }
void reset_atomic() __attribute__((always_inline))
Definition: xct_id.hpp:366

Here is the call graph for this function:

Here is the caller graph for this function:

void foedus::xct::McsWwLock::reset_atomic ( thread::ThreadId  tail_waiter,
McsBlockIndex  tail_waiter_block 
)
inline

Definition at line 367 of file xct_id.hpp.

References foedus::xct::McsWwBlockData::set_atomic(), and tail_.

367  {
368  tail_.set_atomic(tail_waiter, tail_waiter_block);
369  }
void set_atomic(uint32_t thread_id, McsBlockIndex block) __attribute__((always_inline))
Definition: xct_id.hpp:259
McsWwBlockData tail_
Definition: xct_id.hpp:377

Here is the call graph for this function:

void foedus::xct::McsWwLock::reset_guest_id_release ( )
inline

Definition at line 357 of file xct_id.hpp.

References foedus::xct::McsWwBlockData::set_combined_release(), and tail_.

Referenced by foedus::xct::McsWwOwnerlessImpl::ownerless_initial().

357  {
359  }
const uint64_t kMcsGuestId
A special value meaning the lock is held by a non-regular guest that doesn't have a context...
Definition: xct_id.hpp:158
void set_combined_release(uint64_t word) __attribute__((always_inline))
Definition: xct_id.hpp:268
McsWwBlockData tail_
Definition: xct_id.hpp:377

Here is the call graph for this function:

Here is the caller graph for this function:

void foedus::xct::McsWwLock::reset_release ( )
inline

Definition at line 370 of file xct_id.hpp.

References reset_release().

Referenced by foedus::xct::McsWwImpl< ADAPTOR >::initial(), and reset_release().

370 { reset_release(0, 0); }
void reset_release() __attribute__((always_inline))
Definition: xct_id.hpp:370

Here is the call graph for this function:

Here is the caller graph for this function:

void foedus::xct::McsWwLock::reset_release ( thread::ThreadId  tail_waiter,
McsBlockIndex  tail_waiter_block 
)
inline

Definition at line 371 of file xct_id.hpp.

References foedus::xct::McsWwBlockData::set_release(), and tail_.

371  {
372  tail_.set_release(tail_waiter, tail_waiter_block);
373  }
void set_release(uint32_t thread_id, McsBlockIndex block) __attribute__((always_inline))
Definition: xct_id.hpp:262
McsWwBlockData tail_
Definition: xct_id.hpp:377

Here is the call graph for this function:

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  o,
const McsWwLock v 
)
friend

Debug out operators.

Definition at line 171 of file xct_id.cpp.

171  {
172  o << "<McsWwLock><locked>" << v.is_locked() << "</locked><tail_waiter>"
173  << v.get_tail_waiter() << "</tail_waiter><tail_block>" << v.get_tail_waiter_block()
174  << "</tail_block></McsWwLock>";
175  return o;
176 }

Member Data Documentation


The documentation for this struct was generated from the following files: