<!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,&nbsp; comments below but no opportunities for snipping, yet.&nbsp;&nbsp; :)</FONT>
</P>

<P><FONT SIZE=2>&gt; -----Original Message-----</FONT>
<BR><FONT SIZE=2>&gt; From: Jecel Assumpcao Jr [<A HREF="mailto:jecel@merlintec.com">mailto:jecel@merlintec.com</A>]</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; On Thursday 23 August 2001 02:14, Rob Withers wrote:</FONT>
<BR><FONT SIZE=2>&gt; &gt; &gt; [&quot;cached smart references&quot;]</FONT>
<BR><FONT SIZE=2>&gt; &gt;</FONT>
<BR><FONT SIZE=2>&gt; &gt; It's a pointer swizzle.&nbsp; I like the idea of controlling the </FONT>
<BR><FONT SIZE=2>&gt; reference</FONT>
<BR><FONT SIZE=2>&gt; &gt; and changing it's state (perhaps by an optimizing manager </FONT>
<BR><FONT SIZE=2>&gt; and not the</FONT>
<BR><FONT SIZE=2>&gt; &gt; client of the reference), like faulting the methods or state locally</FONT>
<BR><FONT SIZE=2>&gt; &gt; or defaulting then remotely.</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; These days I would call the &quot;optimizing manager&quot; a </FONT>
<BR><FONT SIZE=2>&gt; meta-object and the </FONT>
<BR><FONT SIZE=2>&gt; reference itself would be a proxy. This seems cleaner than </FONT>
<BR><FONT SIZE=2>&gt; just a block </FONT>
<BR><FONT SIZE=2>&gt; 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.&nbsp; I almost had one working, but I didn't finish the GC, because of the additional coordination that was required.&nbsp; I need to resuscitate this code too.&nbsp; Are we both thinking that some heuristic would cache state locally, like the Gemstone Proxy model?&nbsp; More advanced optimizations as well - one that I like is usage-based relocation.&nbsp; To increase access locality, we may want to make a remote object, local, and then it would be remote in the former local space.&nbsp; :-D</FONT></P>

<P><FONT SIZE=2>&gt; It is an interesting and flexible way to do things, but I am </FONT>
<BR><FONT SIZE=2>&gt; trying to </FONT>
<BR><FONT SIZE=2>&gt; figure out what &quot;the simplest thing that could possibly work&quot; 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.&nbsp; Then the references can be configured and plugginized for the specific space properties.</FONT></P>

<P><FONT SIZE=2>&gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; myGraph := rmObj graph.</FONT>
<BR><FONT SIZE=2>&gt; &gt;</FONT>
<BR><FONT SIZE=2>&gt; &gt; SRP, that I just mentioned, does this with rules that </FONT>
<BR><FONT SIZE=2>&gt; control whether</FONT>
<BR><FONT SIZE=2>&gt; &gt; an object is pass-by-value or pass-by-reference and whether the</FONT>
<BR><FONT SIZE=2>&gt; &gt; MetaState should be serialized.&nbsp; Always make external references</FONT>
<BR><FONT SIZE=2>&gt; &gt; smart, seems like the simplest design.</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; I found SRP very interesting though it seems to be designed for &quot;off </FONT>
<BR><FONT SIZE=2>&gt; line&quot; transfer of binary objects between systems and not for </FONT>
<BR><FONT SIZE=2>&gt; performance critical operation. Its compressed encoding was the </FONT>
<BR><FONT SIZE=2>&gt; inspiration for my own variations on this idea.</FONT>
</P>

<P><FONT SIZE=2>Not true, in my experience.&nbsp; 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&nbsp; (BufferedSocketStream of some kind).&nbsp; I actually chunked each flattened graph, and read in chunks at the other side.&nbsp; Squeak sockets had the occasion to return nil and other peculiarities; Socket and the streams aren't (or weren't) positional.&nbsp; The real solution, IMHO, is to use Flow's NetStream as the underlying stream.</FONT></P>

<P><FONT SIZE=2>&gt; Can you convert internal references into smart external ones </FONT>
<BR><FONT SIZE=2>&gt; automatically? </FONT>
</P>

<P><FONT SIZE=2>This was done by the SubstitutionRule, that I wrote.&nbsp; For 'matching' (hah!) objects, it would register the object in a local table with a new local handle.&nbsp; At the remote site, I would register the handle in a table.&nbsp; Out-pointers and In-pointers.&nbsp; At the remote site, I would wrap the handle in a Proxy.&nbsp; I need to look at GemBuilder for Squeak.</FONT></P>

<P><FONT SIZE=2>&gt; Texas. They </FONT>
<BR><FONT SIZE=2>&gt; depend on human generated names for roots. If you are going to have </FONT>
<BR><FONT SIZE=2>&gt; lots of references with names like &quot;obj231234&quot; you might as well give </FONT>
<BR><FONT SIZE=2>&gt; 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>&gt; &gt; &gt; where rmObj is a carefully hand crafted &quot;root&quot; in the </FONT>
<BR><FONT SIZE=2>&gt; other segment</FONT>
<BR><FONT SIZE=2>&gt; &gt; &gt; but its graph is not.</FONT>
<BR><FONT SIZE=2>&gt; &gt;</FONT>
<BR><FONT SIZE=2>&gt; &gt; Gemstone controls the fault depth for a graph of objects.&nbsp; It says</FONT>
<BR><FONT SIZE=2>&gt; &gt; only fault in objects within 2 edges of me and stub the rest.&nbsp;&nbsp; That</FONT>
<BR><FONT SIZE=2>&gt; &gt; would lead to localization of objects accessed often and dynamically</FONT>
<BR><FONT SIZE=2>&gt; &gt; determine the clusters that get faulted.</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; This is also a great way to avoid getting stuck in circular </FONT>
<BR><FONT SIZE=2>&gt; references </FONT>
<BR><FONT SIZE=2>&gt; :-)</FONT>
</P>

<P><FONT SIZE=2>I don't follow you here.&nbsp; How does it avoid this?&nbsp; I think there is extra work to do, with the LoadRecepticles of SRP, to avoid this.&nbsp; 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>&nbsp;</FONT>
<BR><FONT SIZE=2>&gt; &gt; If the references are handles to a table, and we can restrict access</FONT>
<BR><FONT SIZE=2>&gt; &gt; to that table, then we can really hide external objects from prying</FONT>
<BR><FONT SIZE=2>&gt; &gt; hands. </FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; My tables were protected by the virtual machine hardware. Any attempt </FONT>
<BR><FONT SIZE=2>&gt; to access them trapped to the OS (boot session) which could </FONT>
<BR><FONT SIZE=2>&gt; do anything </FONT>
<BR><FONT SIZE=2>&gt; it wanted to with it.</FONT>
</P>

<P><FONT SIZE=2>Very cool! </FONT>
<BR><FONT SIZE=2>&nbsp;</FONT>
<BR><FONT SIZE=2>&gt; &gt; I also liked the idea in Newton&nbsp; of using Ports for</FONT>
<BR><FONT SIZE=2>&gt; &gt; communication.</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; 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.&nbsp; He could call into the image from external land, in a synchronized way.&nbsp; 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>&gt; -- Jecel</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; </FONT>
</P>

</BODY>
</HTML>