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

Avoid using atomic primitives in the hot path #40

Open
lpereira opened this issue Jun 26, 2020 · 1 comment
Open

Avoid using atomic primitives in the hot path #40

lpereira opened this issue Jun 26, 2020 · 1 comment

Comments

@lpereira
Copy link
Contributor

For instance, in tcpstream.c and udpstream.c, __sync_fetch_and_add() is used to update the number of bytes transferred. This can cause contention between cores if they share cache lines (i.e. false sharing). Ideally, each thread would update their own counter without any kind of locking, and these numbers would be tallied up after joining the worker threads.

@simonxiaoss
Copy link
Member

Yes, but how does the main thread to collect those counters from the child thread counters?

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

No branches or pull requests

2 participants