4 ms·
Could you please provide a link to the implementation? I'm really interested in learning how this is done. Thanks.
by kanak 16y ago
Could you please provide a link to the implementation? I'm really interested in learning how this is done. Thanks.
- pjscott 16y agoSorry, I can't point to any code, but in both cases the approach is the same: you have some shared data structures, like an array of regions containing points, or a red-black tree, or a priority queue, and several threads all read and write these data structures. Since transactional memory lets you run concurrently unless there are actual memory conflicts, this often gives better concurrency than locks. Of course, for examples like these, the tricky part is designing data structures that don't have many inherent memory conflicts. Red-black trees, for example, are tricky because the rebalancing transformations tend to step on other threads' toes.