metzger@t500m0.ira.uka.de (Metzger Rolf) (06/10/91)
As a newcomer to Smalltalk I have to make the Smalltalk-80 system able to distribute objects among different machines or different images on the same machine. In the main points I can follow the suggestions of John Bennett (Distributed Smalltalk) and Paul McCullough (Transparent Forwarding). So I have ProxyObjects for the objects on the other machines and I did overwrite the 'does-not-understand'-message of the class ProxyObject, to forward the message to the remote machine. But I have some problems with the access of the objects on the remote machine and the management of errors occuring during the execution on the remote machine. Maybe, anyone can help me. My questions are: 1.) How can I access the objects on the remote machine ? I am working so far only with global objects, which I can access by their name in the Smalltalk-Dictionary. In the literature above they managed it with the Object-Pointer, but in Smalltalk-80 v4.0 this pointer is not unique. Is there anywhere an Object-Table, where every object is listed, or what can I do ? 2.) To save a complex object structure, I have the BOSS (Binary Object Streaming Service) of the Advanced Programming Toolkit. I have some problems to use it with an ExternalConnection and a ReadAppendStream. Does anyone have an example for me, how to communicate on Unix-Sockets and ReadAppendStreams with BOSS ? 3.) When I have ProxyObjects using the 'does-not-understand' message to forward the message to the remote machine, I have to overwrite some of the messages of class Object. But some messages as class and basicSize etc. may not be overwritten, says the documentation of the system. But e.g. to inspect a remote object, I have to overwrite such messages. But when I overwrite e.g. basicSize, I think the MemoryManagement will not work correct, because space is allocated for the size of the object on the remote machine and not for the size of the Proxy-Object.. What can I do here, and which messages must be overwritten ? This is all for now. I hope there is somebody, who can help me. Thanks so far ! Address: Rolf Metzger Mailaddress: D-7500 Karlsruhe METZGER%i70vca@iravcl.ira.uka.de Haendelstr. 25 Or: ++49/721/857351 tom@ira.uka.de West-Germany
ags@scs.carleton.ca (Alexander G. M. Smith) (06/10/91)
In article <METZGER.91Jun10144221@t500m0.ira.uka.de> metzger@t500m0.ira.uka.de (Metzger Rolf) writes: >... But I have some problems with the access of the >objects on the remote machine and the management of errors >occuring during the execution on the remote machine. Maybe, >anyone can help me. My questions are: > >1.) How can I access the objects on the remote machine ? I > am working so far only with global objects, which I can > access by their name in the Smalltalk-Dictionary. In the > literature above they managed it with the Object-Pointer, > but in Smalltalk-80 v4.0 this pointer is not unique. > Is there anywhere an Object-Table, where every object > is listed, or what can I do ? You can fake oop numbers by making a dictionary associating a locally unique integer with every exported object. Every time a value is sent out (usually as the return value of some method invocation from a remote computer, but also could be as arguments to a method call), you'll have to look up the value in the dictionary (use an IdentityDictionary) and send its fake oop + machine address. If it's not in the dictionary, add it with the next available free fake oop number. For garbage collection reasons, a structure like this dictionary probably already exists. As for errors on the remote machine, c'est la vie! There doesn't seem to be much that you can do since a debugger is opened on the object with an error, thus on the machine with that object. You could change error: or whatever to open a window on your machine, wherever you are. >2.) To save a complex object structure, I have the BOSS > (Binary Object Streaming Service) of the Advanced > Programming Toolkit. I have some problems to use it > with an ExternalConnection and a ReadAppendStream. > Does anyone have an example for me, how to communicate > on Unix-Sockets and ReadAppendStreams with BOSS ? Sorry, I can't help you there. In my implementation (on Macs using PP 2.3 and AppleTalk) only simple objects are sent over the network (the kind where object copy == object), using some C primitives to encode them. Everything else is sent as a proxy. >3.) When I have ProxyObjects using the 'does-not-understand' > message to forward the message to the remote machine, I > have to overwrite some of the messages of class Object. > But some messages as class and basicSize etc. may not be > overwritten, says the documentation of the system. But e.g. > to inspect a remote object, I have to overwrite such messages. > But when I overwrite e.g. basicSize, I think the > MemoryManagement will not work correct, because space is > allocated for the size of the object on the remote machine > and not for the size of the Proxy-Object.. > What can I do here, and which messages must be overwritten ? The trick is to set the superclass to nil (write a class method in ProxyObject to stuff the superclass variable with nil). That makes everything (except == which is compiled in-line) go to the doesnotunderstand method. I also had to copy over one primitive method so that allInstances would work when looking for all proxy objects. True, basicSize and all those methods get sent over to the real object for evaluation. But then that's what you want in a real proxy. The garbage collector doesn't use basicSize method to find the object size (probably class is hidden in the object record and used directly). - Alex
sticken@pleiades.cps.msu.edu (06/11/91)
In article <METZGER.91Jun10144221@t500m0.ira.uka.de> metzger@t500m0.ira.uka.de (Metzger Rolf) writes: > > >As a newcomer to Smalltalk I have to make the Smalltalk-80 >system able to distribute objects among different machines ... Rolf, If you get email replies (ie not posted to the net) could you copy them to me please. I am interested too in the problems you point to. ---jon---
rick@foghorn.ti.com (Rick Carlos) (06/13/91)
In article <METZGER.91Jun10144221@t500m0.ira.uka.de> metzger@t500m0.ira.uka.de (Metzger Rolf) writes: > > 2.) To save a complex object structure, I have the BOSS > (Binary Object Streaming Service) of the Advanced > Programming Toolkit. I have some problems to use it > with an ExternalConnection and a ReadAppendStream. > Does anyone have an example for me, how to communicate > on Unix-Sockets and ReadAppendStreams with BOSS ? > The following works for me: client side: ----------- START SETUP ... "connect to the transport address - socket abstraction" aClientSocket := UnixSocketAccessor newTCPclientToHost: hostName port: port. "stream abstraction on top of socket" binaryStream := (ExternalConnection new input: aClientSocket; output: aClientSocket) readAppendStream. "bos abstraction on top of stream" wbos := BinaryObjectStorage onNew: binaryStream. binaryStream commit. rbos := BinaryObjectStorage onOldNoScan: binaryStream. ... END SETUP START PROXY ... "send a message" wbos nextPut: aMessage. binaryStream commit. "synchronously wait for the answer" (rbos atEnd) ifTrue: [ "peer closed down" binaryStream close. ... ]. "receive the answer" theAnswer := rbos next. ... END PROXY server side: ----------- START SETUP ... serverSocket := UnixSocketAccessor newTCP. serverSocket listenFor: 5. ... clientSocket := serverSocket accept. ... "stream abstraction on top of socket" binaryStream := (ExternalConnection new input: clientSocket; output: clientSocket) readAppendStream. "bos abstraction on top of stream" rbos := BinaryObjectStorage onOldNoScan: binaryStream. wbos := BinaryObjectStorage onNew: binaryStream. binaryStream commit. ... END SETUP START AGENT ... [rbos atEnd] whileFalse: [ "receive a message" aMessage := rbos next. ... "send the answer" wbos nextPut: theAnswer. binaryStream commit. ]. "peer closed down" binaryStream close. ... END AGENT -- Rick Carlos Internet: rick@foghorn.pac.sc.ti.com Texas Instruments, Inc. UUCP: ti-csl!ticipa!rick P.O. Box 655012 Voice: (214)917-2220 MS 3635 TI-MSG: FSIC Dallas, Tx. 75265 TI-DECNET: ticipa::rick