- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am looking for cheap ways to maintain a consistent state. I have realized that mutexes and rw locks will clear out the value the test and set variable from the cache of all other cores than the one currently trying to do the test and set. Afterwards, a thread will have a cache miss and will have to go to memory. I am wondering whether this is the case with __sync_bool_compare_and_swap, __sync_add_and_fetch, etc? Will a memory barrier cause the same effect?
Are there any good references out there on inexpensive primitives that scale well?
Thanks
I am looking for cheap ways to maintain a consistent state. I have realized that mutexes and rw locks will clear out the value the test and set variable from the cache of all other cores than the one currently trying to do the test and set. Afterwards, a thread will have a cache miss and will have to go to memory. I am wondering whether this is the case with __sync_bool_compare_and_swap, __sync_add_and_fetch, etc? Will a memory barrier cause the same effect?
Are there any good references out there on inexpensive primitives that scale well?
Thanks
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As far as I know, yes, these operations you mentioned are implemented as atomic memory accesses and will cause corresponding cache invalidations.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page