<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2653.12">
<TITLE>RE: [Cross-space references] NewtonOS and Sessions</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=2>Jecel, comments below but no opportunities for snipping, yet. :)</FONT>
</P>
<P><FONT SIZE=2>> -----Original Message-----</FONT>
<BR><FONT SIZE=2>> From: Jecel Assumpcao Jr [<A HREF="mailto:jecel@merlintec.com">mailto:jecel@merlintec.com</A>]</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> On Thursday 23 August 2001 02:14, Rob Withers wrote:</FONT>
<BR><FONT SIZE=2>> > > ["cached smart references"]</FONT>
<BR><FONT SIZE=2>> ></FONT>
<BR><FONT SIZE=2>> > It's a pointer swizzle. I like the idea of controlling the </FONT>
<BR><FONT SIZE=2>> reference</FONT>
<BR><FONT SIZE=2>> > and changing it's state (perhaps by an optimizing manager </FONT>
<BR><FONT SIZE=2>> and not the</FONT>
<BR><FONT SIZE=2>> > client of the reference), like faulting the methods or state locally</FONT>
<BR><FONT SIZE=2>> > or defaulting then remotely.</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> These days I would call the "optimizing manager" a </FONT>
<BR><FONT SIZE=2>> meta-object and the </FONT>
<BR><FONT SIZE=2>> reference itself would be a proxy. This seems cleaner than </FONT>
<BR><FONT SIZE=2>> just a block </FONT>
<BR><FONT SIZE=2>> and a fixed-in-the-vm optimizing hack.</FONT>
</P>
<P><FONT SIZE=2>I think this is where the GC would operate as well. I almost had one working, but I didn't finish the GC, because of the additional coordination that was required. I need to resuscitate this code too. Are we both thinking that some heuristic would cache state locally, like the Gemstone Proxy model? More advanced optimizations as well - one that I like is usage-based relocation. To increase access locality, we may want to make a remote object, local, and then it would be remote in the former local space. :-D</FONT></P>
<P><FONT SIZE=2>> It is an interesting and flexible way to do things, but I am </FONT>
<BR><FONT SIZE=2>> trying to </FONT>
<BR><FONT SIZE=2>> figure out what "the simplest thing that could possibly work" is.</FONT>
</P>
<P><FONT SIZE=2>I am really keen, as I have mentioned once or twice, on abstracting all types of cross space references, into the same pattern. Then the references can be configured and plugginized for the specific space properties.</FONT></P>
<P><FONT SIZE=2>> > > myGraph := rmObj graph.</FONT>
<BR><FONT SIZE=2>> ></FONT>
<BR><FONT SIZE=2>> > SRP, that I just mentioned, does this with rules that </FONT>
<BR><FONT SIZE=2>> control whether</FONT>
<BR><FONT SIZE=2>> > an object is pass-by-value or pass-by-reference and whether the</FONT>
<BR><FONT SIZE=2>> > MetaState should be serialized. Always make external references</FONT>
<BR><FONT SIZE=2>> > smart, seems like the simplest design.</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> I found SRP very interesting though it seems to be designed for "off </FONT>
<BR><FONT SIZE=2>> line" transfer of binary objects between systems and not for </FONT>
<BR><FONT SIZE=2>> performance critical operation. Its compressed encoding was the </FONT>
<BR><FONT SIZE=2>> inspiration for my own variations on this idea.</FONT>
</P>
<P><FONT SIZE=2>Not true, in my experience. All of the examples with the base are to and from disk, but it is an ObjectStream and as such, it can be opened on an underlying stream (BufferedSocketStream of some kind). I actually chunked each flattened graph, and read in chunks at the other side. Squeak sockets had the occasion to return nil and other peculiarities; Socket and the streams aren't (or weren't) positional. The real solution, IMHO, is to use Flow's NetStream as the underlying stream.</FONT></P>
<P><FONT SIZE=2>> Can you convert internal references into smart external ones </FONT>
<BR><FONT SIZE=2>> automatically? </FONT>
</P>
<P><FONT SIZE=2>This was done by the SubstitutionRule, that I wrote. For 'matching' (hah!) objects, it would register the object in a local table with a new local handle. At the remote site, I would register the handle in a table. Out-pointers and In-pointers. At the remote site, I would wrap the handle in a Proxy. I need to look at GemBuilder for Squeak.</FONT></P>
<P><FONT SIZE=2>> Texas. They </FONT>
<BR><FONT SIZE=2>> depend on human generated names for roots. If you are going to have </FONT>
<BR><FONT SIZE=2>> lots of references with names like "obj231234" you might as well give </FONT>
<BR><FONT SIZE=2>> up on human understandable external pointers.</FONT>
</P>
<P><FONT SIZE=2>I used locally unique handles, and the proxy had the Space reference (Segment).</FONT>
</P>
<P><FONT SIZE=2>> > > where rmObj is a carefully hand crafted "root" in the </FONT>
<BR><FONT SIZE=2>> other segment</FONT>
<BR><FONT SIZE=2>> > > but its graph is not.</FONT>
<BR><FONT SIZE=2>> ></FONT>
<BR><FONT SIZE=2>> > Gemstone controls the fault depth for a graph of objects. It says</FONT>
<BR><FONT SIZE=2>> > only fault in objects within 2 edges of me and stub the rest. That</FONT>
<BR><FONT SIZE=2>> > would lead to localization of objects accessed often and dynamically</FONT>
<BR><FONT SIZE=2>> > determine the clusters that get faulted.</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> This is also a great way to avoid getting stuck in circular </FONT>
<BR><FONT SIZE=2>> references </FONT>
<BR><FONT SIZE=2>> :-)</FONT>
</P>
<P><FONT SIZE=2>I don't follow you here. How does it avoid this? I think there is extra work to do, with the LoadRecepticles of SRP, to avoid this. For one Marshalling it does and one pass with forwarding pointers, but there is more identity issues for objects between marshallings.</FONT></P>
<P><FONT SIZE=2> </FONT>
<BR><FONT SIZE=2>> > If the references are handles to a table, and we can restrict access</FONT>
<BR><FONT SIZE=2>> > to that table, then we can really hide external objects from prying</FONT>
<BR><FONT SIZE=2>> > hands. </FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> My tables were protected by the virtual machine hardware. Any attempt </FONT>
<BR><FONT SIZE=2>> to access them trapped to the OS (boot session) which could </FONT>
<BR><FONT SIZE=2>> do anything </FONT>
<BR><FONT SIZE=2>> it wanted to with it.</FONT>
</P>
<P><FONT SIZE=2>Very cool! </FONT>
<BR><FONT SIZE=2> </FONT>
<BR><FONT SIZE=2>> > I also liked the idea in Newton of using Ports for</FONT>
<BR><FONT SIZE=2>> > communication.</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> I think other systems (iAPX432, Mach, BeOS...) have something similar.</FONT>
</P>
<P><FONT SIZE=2>I originally got this idea from David Caster, who implemented it once, in Squeak. He could call into the image from external land, in a synchronized way. This is the inspiration for the queues and futures work that I did, and he helped me considerably.</FONT></P>
<P><FONT SIZE=2>cheers,</FONT>
<BR><FONT SIZE=2>Rob</FONT>
</P>
<P><FONT SIZE=2>> -- Jecel</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> </FONT>
</P>
</BODY>
</HTML>