Squeak (file system & project structure) newbie questions

John M McIntosh johnmci at smalltalkconsulting.com
Mon Oct 24 04:25:11 UTC 2005


Kind of but not quite.

The image file is a memory snapshot of the virtual machine's view of  
the world, we do a full garbage collection, some housekeeping and  
tell the operating
system to write this (what 20MB) chunk of memory to disk.

Think more of when you Hibernate a windows machine and it tells you  
it's writing the contents of memory to disk.
Or perhaps a core dump if that makes more sense to you.

As Tim said when you restart we look at the image file, allocate  
(what 20MB) of memory (well perhaps virtual  memory map 512 or  
1024mb), ask the operating system
read in the 20MB, then check machine endiness issues, including  
floating point number reorder in the virtual machine, and a do a bit  
of housekeeping (maybe swizzle memory address). Once we think we have  
a rational VM address space we start processing bytecodes from the  
point we stopped, which is right after the point we told it to snapshot.

Go see
SmalltalkImage>>snapshot:andQuit:embeded:

note the snapshotPrimitive and the quitPrimitive message send.


Then once the virtual machine starts ups various classes run startup  
logic to do things like handle issues about resources that
  are not preserved across a snapshot, such as finding and re-opening  
the source and changes file.




On 23-Oct-05, at 7:29 PM, untz wrote:

> Hello again!
>
> Ok... From what everyone is telling me, I am starting to envision an
> 'image' as something which is synomynous with Java jar files and
> VC++ DLLs, and C# Assemblies... Please correct me if I am wrong.
>
> Thanks for all the great advice! This community rocks!
>
> Many, many thanks,
>
> Unnsse
>
> On Oct 23, 2005, at 7:38 PM, Jecel Assumpcao Jr wrote:
>
>
>> Unnsse wrote on Date: Sun, 23 Oct 2005 17:01:50 -0700
>>
>>
>>> What is an image, by the way? Is it the actual virtual machine or is
>>> it synonymous
>>> with Java .class files that get loaded by a ClassLoader, in a JVM?
>>>
>>>
>>
>> There really isn't anything like it on the Java side. It is like the
>> "core" files that Unix generates when a task runs into some serious
>> error or receives a certain signal. You can restart the program from
>> that point later on (in a debugger for the case of an error). Or  
>> think
>> of the "sleep mode" in most laptops. Other languages that normally  
>> work
>> this way are Forth and APL and it is a popular option for Lisp.
>>
>> The problem with images is that they are self contained and isolated
>> worlds. So if you have one and I have one it isn't easy to move stuff
>> from one to the other.
>>
>>
>>
>>> Why aren't images placed along with the .pr files (do the .pr files
>>> contain images)?
>>>
>>>
>>
>> Project files are an attempt to attack the problem I mentioned above.
>> They contain a small fraction of an image that can be saved  
>> separately
>> from the rest and then loaded into an entirely different image. The
>> great advantage is that they can include an arbitrary set of  
>> objects so
>> it is easy to send some drawing you have made or some sound you
>> recorded.
>>
>> Most people on this list don't use projects (which the eToys people
>> love) but prefer more limited alternatives that are closer to
>> traditional systems (code only).
>>
>> The oldest system was just pointing to some class or group of  
>> classes in
>> a browser and selecting "file out" from the menu to generate a .st  
>> file.
>>
>>
>>> From another image you can select this file and do "file in".
>>>
>>>
>>
>> After that the change set system was created which grouped code into
>> logical units other than classes. Normally you would start out with a
>> new, empty change set and then just work normally with all new code
>> getting recorded there. You can save it as a .cs file (with the same
>> format as a .st one) and then install it or file it in some other  
>> image.
>>
>> These are all source code formats and some experiments were done with
>> binary formats (other Smalltalks have them, like Parcels in  
>> VisualWorks
>> for example) but I suppose there is not much this would get you that
>> projects don't do better. There is also the options of combining  
>> one or
>> more change sets into a single zip file for convenience.
>>
>> Currently, the most popular option is Monticello which keeps track of
>> packages and versions.
>>
>> A better option is to skip files entirely and instead have live  
>> images
>> talking to each other and negotiating transfer of objects between  
>> them,
>> which is where Craig's Spoon project is going. So if you think images
>> are strange, you haven't seen anything yet ;-)
>>
>> -- Jecel
>>
>>
>>
>
>
>
>

--
======================================================================== 
===
John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
======================================================================== 
===




More information about the Squeak-dev mailing list