Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reimplement CSemaphore using WaitOnAddress() for better performance under contention #13

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
a01bc9a
sync: Reimplement CSemaphore for better performance
evgenykotkov Mar 18, 2021
9dd322f
sync: Block stealing the semaphore from woken threads
evgenykotkov Mar 23, 2021
1add999
sync: Rewrite the semaphore wait loop
evgenykotkov Mar 23, 2021
fb08168
Fix formatting in sync.hxx
evgenykotkov Mar 23, 2021
cbb7c51
Use an appropriate type for a local variable
evgenykotkov Mar 23, 2021
a382c20
Merge branch 'main' into sync-csemaphore-waitonaddress
evgenykotkov Jun 3, 2021
73c4e62
Restore the easy-out check in CSemaphore::FWait()
evgenykotkov Jun 5, 2021
c559a0e
Fix a potential race condition in CSemaphore::_FTryAcquire()
evgenykotkov Jun 5, 2021
fc221eb
Move the CSemaphore's ctor and dtor below in sync.cxx
evgenykotkov Jun 5, 2021
2aed461
Rename the local variable in CSemaphore::_FTryAcquire()
evgenykotkov Jun 5, 2021
aafdf96
Add a missing `const` in CSemaphore::_FAcquire()
evgenykotkov Jun 5, 2021
880dab2
Rename the local variables `state` to `stateCur`
evgenykotkov Jun 5, 2021
cf8ab1e
Restore the removed (CSemaphoreState&) casts
evgenykotkov Jun 5, 2021
eac8c87
Drop the empty #else-#endif block in tdb.hxx
evgenykotkov Jun 5, 2021
54d0fad
Update the comments in sync.hxx/.cxx
evgenykotkov Jun 5, 2021
041a981
Add a comment to CSemaphoreFairnessTest's declaration
evgenykotkov Jun 5, 2021
0b75568
Fix an issue in CSemaphore::ReleaseAllWaiters()
evgenykotkov Jun 5, 2021
161b0bc
Ensure that we wait on values of the same type and size
evgenykotkov Jul 7, 2021
4e4ff2b
Fix formatting in CSemaphore::ReleaseAllWaiters()
evgenykotkov Jul 7, 2021
7979bcc
Minor code cleanup in CSemaphore::_FOSWait()
evgenykotkov Jul 7, 2021
c95ce47
Use LONG instead of DWORD for semaphore and wait counts
evgenykotkov Jul 8, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
370 changes: 163 additions & 207 deletions dev/ese/published/inc/sync.hxx

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dev/ese/src/inc/_bf.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ C_ASSERT( sizeof( BF::bfbitfield ) == sizeof( FLAG32 ) );
#ifdef _WIN64
C_ASSERT( sizeof(BF) == 192 );
#else // !_WIN64
C_ASSERT( sizeof(BF) == 160 );
C_ASSERT( sizeof(BF) == 176 );
#endif // _WIN64

// Buffer Manager Global Flags
Expand Down
2 changes: 1 addition & 1 deletion dev/ese/src/inc/pib.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ public:
#ifdef _WIN64
C_ASSERT( sizeof(PIB) == 608 );
#else // !_WIN64
C_ASSERT( sizeof(PIB) == 504 );
C_ASSERT( sizeof(PIB) == 528 );
#endif // _WIN64

INLINE SIZE_T OffsetOfTrxOldestILE() { return OffsetOf( PIB, m_ileTrxOldest ); }
Expand Down
2 changes: 0 additions & 2 deletions dev/ese/src/inc/tdb.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,6 @@ class TDB

#ifdef _AMD64_
BYTE m_bReserved2[8]; // for alignment. fileopen.cxx: C_ASSERT( sizeof(TDB) % 16 == 0 );
#else
BYTE m_bReserved2[4]; // for alignment. fileopen.cxx: C_ASSERT( sizeof(TDB) % 16 == 0 );
#endif

// 208 / 272 bytes (amd64)
Expand Down
4 changes: 4 additions & 0 deletions dev/ese/src/sync/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ add_library(sync STATIC

target_include_directories(sync PRIVATE
${INC_OUTPUT_DIRECTORY}/jet
)

target_link_libraries(sync
synchronization
)
Loading