[Vm-dev] Lazy become for Copy On Write

btc at openinworld.com btc at openinworld.com
Thu May 1 18:29:34 UTC 2014


hi Eliot,

On you blog post [1] I wrote "Just had a random neuron fire so 
wondering… Would your lazy #become: benefit a copy-on-write system, 
where one VM could run multiple images sharing objects. Use case might 
be a cloud provider where many clients might base off the same Squeak 
4.5 or Pharo 3.0 image. I am thinking that when writing to an object, 
the original could be copied twice and replaced with a 
conditional-forwarder such that which copy is forwarded to depends on 
the image accessing the conditional-forwarder."

I've no practical experience with this and didn't have anything 
formulated to expound on at the time. It was just an intuitive hunch 
that has however kept lurking at the back of my mind while I was 
distracted with other things. Today I made a sketch of the idea (drawn 
with Inkscape) which I have attached.

There is one BASE IMAGE and two client images IMAGE 1 and IMAGE 2. 
Objects a1, b1, a2, b2 all have a reference to object zB in the base image.

When object a2 in IMAGE 2 writes to zB in the base image (1.) z2 is 
copied from zB so it can be updated (2.). The indirect table, which was 
empty, has entry-1 created pointing at z2 (3.), and zB is set to lazy 
become to entry-1 (3.). Now when object a2 or b2 access zB (4.), the 
lazy become is followed to through the indirect table and on to z2 (5.), 
to which a2 is then updated to point (6.).

When object a1 in IMAGE 1 references zB (7.), the lazy become points to 
the indirect-table, but where for IMAGE 1 there are no entries, so one 
is created pointing back to zB since that still valid for IMAGE 1. 
Whether zB might be copied into IMAGE 1 as z1 would be an optimisation 
tradeoff of space versus levels-of-indirection.

cheers -ben

[1] 
http://www.mirandabanda.org/cogblog/2013/09/13/lazy-become-and-a-partial-read-barrier/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: VM-LazyBecomeForCopyOnWrite.pdf
Type: application/pdf
Size: 32846 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20140502/46654b43/VM-LazyBecomeForCopyOnWrite-0001.pdf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: VM-LazyBecomeForCopyOnWrite.svg
Type: image/svg+xml
Size: 36306 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20140502/46654b43/VM-LazyBecomeForCopyOnWrite-0001.svg


More information about the Vm-dev mailing list