Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Speaking of, I'm not sure a lot of us fully appreciate the cost of synchronization, either. It's one big reason why I'm not convinced that reference counting is particularly well-suited to concurrent programming, since it turns a really commonplace operation (retaining a reference to an object) into a synchronization point in the program. There's a non-trivial cost associated with that.

This is actually a problem for both. Simple implementations of AGC have to stop the world to scan at least the roots, and probably even a bit more than that, because there are significant ABA problems. There are ways around this, but as far as I know the only environment to use any of the really good ones is the JVM, because it's hellishly complex. I don't know that there is anything that doesn't stop the world for at least a couple of ns, though.

There are also solutions to it for reference counting. They involve using thread local reference counts and briefly stopping the world to reconcile the counts. I believe [1] describes this algorithm.

And once you get there, and start dealing with cycle detection, the difference between the two approaches starts to look a lot smaller. There's a paper on this too. [2]

[1] http://www.cs.technion.ac.il/~erez/Papers/refcount.pdf

[2] http://www.cs.virginia.edu/~cs415/reading/bacon-garbage.pdf



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: