By: nksingh (nksingh.delete@this.live.com), December 6, 2014 3:51 am
Room: Moderated Discussions
Eric Bron (eric.bron.delete@this.zvisuel.privatefortest.com) on December 6, 2014 2:42 am wrote:
> > Trust me, concurrency is hard. There's a reason all the examples of "look how easy it is to parallellize
> > things" tend to use simple arrays and don't ever have allocations or freeing of the objects.
>
> or people using DAGs to explain why reference count is a solid
> solution when complex object graphs typically have cycles
At least in the kernel space, you can avoid cycles because there's often a 'privileged' reference (usually the usermode handle/file descriptor or namespace entry or something) that is external to the object graph. When that reference goes away, you can destroy some of the links in the graph and make it acyclic as all in-flight accesses drain out.
The other thing I've seen to solve this problem is to make some back-links 'weak' references that require some extra locking to resolve to a true reference when needed. So the graph remains acyclic at the cost of extra locking when resolving some of the back-links to referenced pointers.
> > Trust me, concurrency is hard. There's a reason all the examples of "look how easy it is to parallellize
> > things" tend to use simple arrays and don't ever have allocations or freeing of the objects.
>
> or people using DAGs to explain why reference count is a solid
> solution when complex object graphs typically have cycles
At least in the kernel space, you can avoid cycles because there's often a 'privileged' reference (usually the usermode handle/file descriptor or namespace entry or something) that is external to the object graph. When that reference goes away, you can destroy some of the links in the graph and make it acyclic as all in-flight accesses drain out.
The other thing I've seen to solve this problem is to make some back-links 'weak' references that require some extra locking to resolve to a true reference when needed. So the graph remains acyclic at the cost of extra locking when resolving some of the back-links to referenced pointers.