Re:Friendship ended with the garbage collector
by vbezhenar on Friday August 27, 2021 @02:36AM
(#28324942)
May be it's time to implement hardware CoW for RAM? Or can OS do it efficiently?
[ Parent
| on HN ]
Re:Friendship ended with the garbage collector
by throwaway81523 on Friday August 27, 2021 @03:11AM
(#28325155)
I don't understand what you're getting at, but you can implement CoW at the page level with MMU hardware. That's how Redis dumping works, for example (the process forks into two, with one dumping to disk and the other continuing to take updates, CoW'ing pages that get modified and sharing the rest). What would CoW even mean inside a single address space? The idea of persistent data structures (as used in functional programming and other places) is that you never visibly modify anything, but instead make new objects that share structure with the old objects, relying on the GC to clean up data that stops being reachable.
Re:Friendship ended with the garbage collector
by BenFrantzDale on Friday August 27, 2021 @08:40AM
(#28327041)
I don’t know about that, but I am using stlab::copy_on_write in production and it’s amazing. It’s like a cross among a T, a unique_ptr<T>, and a shared_ptr<const T>. https://github.com/stlab/libraries/blob/main/stlab/copy_on_w...
Re:Friendship ended with the garbage collector
by chmike on Friday August 27, 2021 @04:00AM
(#28325381)
I don't see how CoW would work with threads. It doesn't make sense to me.
Re:Friendship ended with the garbage collector
by foota on Friday August 27, 2021 @04:24AM
(#28325514)
That sounds an awful lot like the x86 cache coherency protocol.