- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I need to clarify for myself how exactly TBB Dynamic Memory Interface Replacement (tutorial 10.2.2) works.
As I understand it replaces stock memory manager with the TBB's scalable memory manager, which doesn't guarantee allocation on cash lines. I need to use cache_aligned_allocator explicitly, if false sharing becomes an issue. Right?
Thank you,
renorm.
As I understand it replaces stock memory manager with the TBB's scalable memory manager, which doesn't guarantee allocation on cash lines. I need to use cache_aligned_allocator explicitly, if false sharing becomes an issue. Right?
Thank you,
renorm.
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Right,
Allocator replacement is for better scalability comparing to stock runtime allocator. But you can use_aligned_mallocfunction on windows for better cache hits. It is replaced also for better scalability.
--Vladimir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is there any cache aligned version of new, because _aligned_malloc isn't portable and not exactly what I need. Currently I am using my own function to emulate cache aligned new:
Another relevant question. Only frequently used variables need to be cache aligned, right?. For example, if x is cache aligned and used frequently, but y isn't cache aligned and used infrequently, it is not a problem if x and y have false sharing. No?
Thank you,
renorm.
[cpp]templateCan anyone take a look and check if it is OK?
T* cache_aligned_new(const T& t = T()) {
tbb::cache_aligned_allocatora;
T* p = a.allocate(1);
try {
a.construct(p, t);
} catch (...) {
a.deallocate(p, 1);
throw;
}
return p;
}[/cpp]
Another relevant question. Only frequently used variables need to be cache aligned, right?. For example, if x is cache aligned and used frequently, but y isn't cache aligned and used infrequently, it is not a problem if x and y have false sharing. No?
Thank you,
renorm.
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