microsoft / microsoft/STL

<atomic>: enable more atomic sizes, improve non-lock-free lock

Open
#1,151 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

performance vNext
Dominant language
C++
Stars
11.1k
Forks
1.7k
Avg merge
4d 15h
Merged PRs (30d)
22

Description

Several things should be done with atomics with new ABI

  • #843 enables atomic_ref<type_of_16_bytes_size>, but not atomic<type_of_16_bytes_size>, need to enable these as well
  • Some believe that x64 CPUs without cmpxchg16b exist. Rule them out from vNext target hardware and use the instruction unconditionally.
  • Make sure non-lock-free atomics use OS wait. This can be done by replacing inner lock with SRWLOCK or CRITICAL_SECTION, or by using of WaitOnAddress, etc. SwitchToThread or timed backoff, or pure active spinning are not good options
  • Make sure atomic<T> with odd size, such as 3 bytes are padded up to next native atomic size. Make sure it is done only for atomic, not for atomic_ref.
  • Consider eliminating pointer to SRWLOCK in atomic_ref and always locating it from pointer hash.

vNext note: Resolving this issue will require breaking binary compatibility. We won't be able to accept pull requests for this issue until the vNext branch is available. See #169 for more information.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading #843 and #169, then confirm that the vNext branch is available before beginning. Review the atomic and atomic_ref implementation and address each listed ABI, lock-free, padding, and pointer-hashing requirement; done means the vNext changes are covered without the rejected spinning approaches.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.