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

Tune the Ordering for all the atomics #1707

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

wang384670111
Copy link

@wang384670111 wang384670111 commented Jul 9, 2023

next: Arc<AtomicU64>,

static ID: AtomicU64 = AtomicU64::new(0);

Here 'next' and 'ID' are global counter between threads and doesn't synchronize with other variables. Although Ordering::SeqCst or Ordering::AcqRel ensures the correctness of the program, it affects the performance of the program. Therefore, Relaxed can be used in both single-threaded and multi-threaded environments.
While atomic operations using relaxed memory ordering do not provide any happens-before relationship, they do guarantee a total modification order of each individual atomic variable. This means that all modifications of the same atomic variable happen in an order that is the same from the perspective of every single thread.

@github-actions
Copy link

github-actions bot commented Jul 9, 2023

CLA Assistant Lite bot: Thank you for your submission! Before we can accept your contribution, we ask that you sign our Contributor License Agreement. To sign the CLA, post a comment on this Pull Request that matches the following text exactly:


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant