[squeak-dev] [ANN] Hydra now can do mitosis

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
35 messages Options
12
Reply | Threaded
Open this post in threaded view
|

[squeak-dev] [ANN] Hydra now can do mitosis

Igor Stasenko
Hello lists,

(see http://en.wikipedia.org/wiki/Cell_division for explanation what
mitosis is ;)

i just finished another torturing session in slang land, and finally
made some of it working :)

I added a two new primitives, which aimed towards creating a new heap
by cloning a designated set of objects from existing one.
A first primitive is helps you to create a closed graph by reporting a
set of objects which is referenced by objects in provided array, but
not included in this array itself.

A second primitive is actually serves for creating a baby heap.
I takes two array arguments: objects graph, and replacements (or substitutions).

The rules is simple:
each object included in first array, should have references to objects
which included in this array as well i.e.
(objects identityIncludes: (objects at: x) someIvar ) == true

or if its not , then it can be found in a substitutions array.
A substitutions array is a flat array of pairs oop -> index, where oop
can be any oop, and index is a smallint index of item in objects
array.
Upon creation of new heap, all refs to oops in 'substitutions' array
will be replaced by refs from 'objects' array by taking corresponding
index.

Both array arguments should contain oops only (except from indexes in
substitutions array) , should not contain duplicates and their
intersection should be empty , i.e.
  (objects intersection: substitutions) isEmpty == true.

All of these rules actually serving to ensure that newly created
object memory will form a fully closed graph (hence its oops can be
cloned to a standalone object memory).

There are also, an initial example how to create a 'baby' object memory
load http://www.squeaksource.com/HydraVM/HydraVM-sig.17.mcz

and do:

HydraClone new cloneIdleProcess

Of course you will need new VM.
Sorry, i didn't published an update of sources yet. I can only give
you a prebuilt one.
Once i had a write access to ftp.squeak.org/HydraVM but i forgot
credentials/key to it. (if Box Admins help me with this, i will upload
it there).
Or, you can write me in private and i will send you binaries.

P.S. I want to give a credit to Klaus D. Witzel who helped me to
finish these new features, and inspired to do it :)


--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Re: [ANN] Hydra now can do mitosis

Igor Stasenko
Update.
you can download binaries from here
ftp://ftp.squeak.org/HydraVM/latest_builds/win32/HydraVM-bin-22.02.2009.zip

--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

[squeak-dev] n-core Smalltalk at work [Re: Hydra now can do mitosis]

Klaus D. Witzel
On Sun, 22 Feb 2009 14:36:30 +0100, Igor Stasenko wrote:

> Update.
> you can download binaries from here
> ftp://ftp.squeak.org/HydraVM/latest_builds/win32/HydraVM-bin-22.02.2009.zip
>

Let me add 2-3 bits: first we also have to thank Alexandre "Alex" Bergel  
and Guillermo "Guille" Adrián Molina for discussing with us earlier  
approaches to running Smalltalk on n-core CPUs in parallel.

2nd: what expression (HydraClone new cloneIdleProcess) does for you, is it  
runs the computational task which is described by the corresponding object  
subgraph, in a *new* native thread (with own heap and instance of  
HydraVM). Therefore, on your n-core CPU you can expect that computation is  
spread among the cores. The #cloneIdleProcess example does just what its  
name says: it runs Smalltalk's idle process ;) as proof of concept.

You Smalltalkers may have other Smalltalk processes that you want to run  
in parallel on their own native thread; let us know how we can help you  
with that.

And in case you need communication between two or more .images, Hydra  
comes with its channel facility.

/Klaus

--
"If at first, the idea is not absurd, then there is no hope for it".  
Albert Einstein


Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] n-core Smalltalk at work [Re: Hydra now can do mitosis]

Philippe Marschall
2009/2/22 Klaus D. Witzel <[hidden email]>:

> On Sun, 22 Feb 2009 14:36:30 +0100, Igor Stasenko wrote:
>
>> Update.
>> you can download binaries from here
>>
>> ftp://ftp.squeak.org/HydraVM/latest_builds/win32/HydraVM-bin-22.02.2009.zip
>>
>
> Let me add 2-3 bits: first we also have to thank Alexandre "Alex" Bergel and
> Guillermo "Guille" Adrián Molina for discussing with us earlier approaches
> to running Smalltalk on n-core CPUs in parallel.
>
> 2nd: what expression (HydraClone new cloneIdleProcess) does for you, is it
> runs the computational task which is described by the corresponding object
> subgraph, in a *new* native thread (with own heap and instance of HydraVM).
> Therefore, on your n-core CPU you can expect that computation is spread
> among the cores. The #cloneIdleProcess example does just what its name says:
> it runs Smalltalk's idle process ;) as proof of concept.
>
> You Smalltalkers may have other Smalltalk processes that you want to run in
> parallel on their own native thread; let us know how we can help you with
> that.

Well I have this web framework thingy where each http connection runs
in it's own process. Request processing is quite fast, sometimes below
a millisecond. There is potentially a lot sharing going on between
those connections for configuration, sessions, continuations and
stuff.

Cheers
Philippe

Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Re: n-core Smalltalk at work [Re: Hydra now can do mitosis]

Klaus D. Witzel
On Sun, 22 Feb 2009 16:52:58 +0100, Philippe Marschall wrote:

> 2009/2/22 Klaus D. Witzel :
>> On Sun, 22 Feb 2009 14:36:30 +0100, Igor Stasenko wrote:
>>
>>> Update.
>>> you can download binaries from here
>>>
>>> ftp://ftp.squeak.org/HydraVM/latest_builds/win32/HydraVM-bin-22.02.2009.zip
>>>
>>
>> Let me add 2-3 bits: ...
[...]

>>
>> You Smalltalkers may have other Smalltalk processes that you want to  
>> run in
>> parallel on their own native thread; let us know how we can help you  
>> with
>> that.
>
> Well I have this web framework thingy where each http connection runs
> in it's own process. Request processing is quite fast, sometimes below
> a millisecond. There is potentially a lot sharing going on between
> those connections for configuration, sessions, continuations and
> stuff.

Yeah we thought about that, after exchanging some Qs+As with Lukas (and/or  
you?) during last Camp Smalltalk, for the general case for Hydra.

Several things are competing for attention/resolution/prototypical work:

1) some [accepted] Socket (and its OS dependent bits) can "belong" only to  
one native thread (= independent .image) in Hydra. Is this compatible with  
your web framework's requirements.

2) it must be possible for one native thread to accept a Socket, for  
another one to read/write it and get rid of it (and of its OS dependent  
bits). This is not a problem for us at the Smalltalk language/heap level  
but, until now I did't find an OS guy who said "this works, with  
guarantee, on these XYZ platforms".

3) when your web framework+app depends on a database "whatsoever", how is  
this to be shared (if sharing is really needed) between multiple native  
threads.

4) put yours here

/Klaus

> Cheers
> Philippe
>

--
"If at first, the idea is not absurd, then there is no hope for it".  
Albert Einstein


Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Re: n-core Smalltalk at work [Re: Hydra now can do mitosis]

Philippe Marschall
2009/2/22 Klaus D. Witzel <[hidden email]>:

> On Sun, 22 Feb 2009 16:52:58 +0100, Philippe Marschall wrote:
>
>> 2009/2/22 Klaus D. Witzel :
>>>
>>> On Sun, 22 Feb 2009 14:36:30 +0100, Igor Stasenko wrote:
>>>
>>>> Update.
>>>> you can download binaries from here
>>>>
>>>>
>>>> ftp://ftp.squeak.org/HydraVM/latest_builds/win32/HydraVM-bin-22.02.2009.zip
>>>>
>>>
>>> Let me add 2-3 bits: ...
>
> [...]
>>>
>>> You Smalltalkers may have other Smalltalk processes that you want to run
>>> in
>>> parallel on their own native thread; let us know how we can help you with
>>> that.
>>
>> Well I have this web framework thingy where each http connection runs
>> in it's own process. Request processing is quite fast, sometimes below
>> a millisecond. There is potentially a lot sharing going on between
>> those connections for configuration, sessions, continuations and
>> stuff.
>
> Yeah we thought about that, after exchanging some Qs+As with Lukas (and/or
> you?) during last Camp Smalltalk, for the general case for Hydra.
>
> Several things are competing for attention/resolution/prototypical work:
>
> 1) some [accepted] Socket (and its OS dependent bits) can "belong" only to
> one native thread (= independent .image) in Hydra. Is this compatible with
> your web framework's requirements.
>
> 2) it must be possible for one native thread to accept a Socket, for another
> one to read/write it and get rid of it (and of its OS dependent bits). This
> is not a problem for us at the Smalltalk language/heap level but, until now
> I did't find an OS guy who said "this works, with guarantee, on these XYZ
> platforms".

That and 1) do not necessarily need to happen. You could imagine one
image/native thread doing all the socket IO and handing the actual
work to other images/native threads.

> 3) when your web framework+app depends on a database "whatsoever", how is
> this to be shared (if sharing is really needed) between multiple native
> threads.

Yepp, if you interpret database in a more general sense (a bunch of
objects). There is also the question of how coordination happens
between multiple images especially on this shared data.

Cheers
Philippe

Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Re: [ANN] Hydra now can do mitosis

Andreas.Raab
In reply to this post by Igor Stasenko
Interesting. Is this conceptually different from making a snapshot using
image segments and move this over to a different Hydra instance?

Cheers,
   - Andreas

Igor Stasenko wrote:

> Hello lists,
>
> (see http://en.wikipedia.org/wiki/Cell_division for explanation what
> mitosis is ;)
>
> i just finished another torturing session in slang land, and finally
> made some of it working :)
>
> I added a two new primitives, which aimed towards creating a new heap
> by cloning a designated set of objects from existing one.
> A first primitive is helps you to create a closed graph by reporting a
> set of objects which is referenced by objects in provided array, but
> not included in this array itself.
>
> A second primitive is actually serves for creating a baby heap.
> I takes two array arguments: objects graph, and replacements (or substitutions).
>
> The rules is simple:
> each object included in first array, should have references to objects
> which included in this array as well i.e.
> (objects identityIncludes: (objects at: x) someIvar ) == true
>
> or if its not , then it can be found in a substitutions array.
> A substitutions array is a flat array of pairs oop -> index, where oop
> can be any oop, and index is a smallint index of item in objects
> array.
> Upon creation of new heap, all refs to oops in 'substitutions' array
> will be replaced by refs from 'objects' array by taking corresponding
> index.
>
> Both array arguments should contain oops only (except from indexes in
> substitutions array) , should not contain duplicates and their
> intersection should be empty , i.e.
>   (objects intersection: substitutions) isEmpty == true.
>
> All of these rules actually serving to ensure that newly created
> object memory will form a fully closed graph (hence its oops can be
> cloned to a standalone object memory).
>
> There are also, an initial example how to create a 'baby' object memory
> load http://www.squeaksource.com/HydraVM/HydraVM-sig.17.mcz
>
> and do:
>
> HydraClone new cloneIdleProcess
>
> Of course you will need new VM.
> Sorry, i didn't published an update of sources yet. I can only give
> you a prebuilt one.
> Once i had a write access to ftp.squeak.org/HydraVM but i forgot
> credentials/key to it. (if Box Admins help me with this, i will upload
> it there).
> Or, you can write me in private and i will send you binaries.
>
> P.S. I want to give a credit to Klaus D. Witzel who helped me to
> finish these new features, and inspired to do it :)
>
>


Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] n-core Smalltalk at work [Re: Hydra now can do mitosis]

Rob Rothwell
In reply to this post by Klaus D. Witzel
Perhaps naively, I simply downloaded the binaries and used them to open a 3.10 dev image, which seemed to work fine, FreeType and all...

So...from the helpful doits, it seems that you prepare a second image that carries out the native processes for you?  Or can you run several native threads within the current image?

Very interesting...and what is most impressive is that someone relatively unsophisticated like me could just open an image with the new VM, load the HydraVM package from Squeaksource and get have HydraVM isHydra return true!

A short example of creating a "lengthy process" running in it's own thread would be great...you know, something that just counts for a really long time or something.

This is very interesting!

Rob

On Sun, Feb 22, 2009 at 10:09 AM, Klaus D. Witzel <[hidden email]> wrote:
On Sun, 22 Feb 2009 14:36:30 +0100, Igor Stasenko wrote:

Update.
you can download binaries from here
ftp://ftp.squeak.org/HydraVM/latest_builds/win32/HydraVM-bin-22.02.2009.zip


Let me add 2-3 bits: first we also have to thank Alexandre "Alex" Bergel and Guillermo "Guille" Adrián Molina for discussing with us earlier approaches to running Smalltalk on n-core CPUs in parallel.

2nd: what expression (HydraClone new cloneIdleProcess) does for you, is it runs the computational task which is described by the corresponding object subgraph, in a *new* native thread (with own heap and instance of HydraVM). Therefore, on your n-core CPU you can expect that computation is spread among the cores. The #cloneIdleProcess example does just what its name says: it runs Smalltalk's idle process ;) as proof of concept.

You Smalltalkers may have other Smalltalk processes that you want to run in parallel on their own native thread; let us know how we can help you with that.

And in case you need communication between two or more .images, Hydra comes with its channel facility.

/Klaus

--
"If at first, the idea is not absurd, then there is no hope for it". Albert Einstein





Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Re: n-core Smalltalk at work [Re: Hydra now can do mitosis]

Klaus D. Witzel
In reply to this post by Philippe Marschall
On Sun, 22 Feb 2009 18:18:20 +0100, Philippe Marschall wrote:

> 2009/2/22 Klaus D. Witzel :
...

>>> Well I have this web framework thingy where each http connection runs
>>> in it's own process. Request processing is quite fast, sometimes below
>>> a millisecond. There is potentially a lot sharing going on between
>>> those connections for configuration, sessions, continuations and
>>> stuff.
>>
>> Yeah we thought about that, after exchanging some Qs+As with Lukas  
>> (and/or
>> you?) during last Camp Smalltalk, for the general case for Hydra.
>>
>> Several things are competing for attention/resolution/prototypical work:
>>
>> 1) some [accepted] Socket (and its OS dependent bits) can "belong" only  
>> to
>> one native thread (= independent .image) in Hydra. Is this compatible  
>> with
>> your web framework's requirements.
>>
>> 2) it must be possible for one native thread to accept a Socket, for  
>> another
>> one to read/write it and get rid of it (and of its OS dependent bits).  
>> This
>> is not a problem for us at the Smalltalk language/heap level but, until  
>> now
>> I did't find an OS guy who said "this works, with guarantee, on these  
>> XYZ
>> platforms".
>
> That and 1) do not necessarily need to happen. You could imagine one
> image/native thread doing all the socket IO and handing the actual
> work to other images/native threads.

Yup. And the price tag is a) transfer "task description" to worker thread  
and b) transfer "result string" back in full or in part(s). And when using  
Hydra channels for transfer, add c) c-alloc of strings-to-be-transported.

>> 3) when your web framework+app depends on a database "whatsoever", how  
>> is
>> this to be shared (if sharing is really needed) between multiple native
>> threads.
>
> Yepp, if you interpret database in a more general sense (a bunch of
> objects).

... which includes framework/app config update/change. Right.

> There is also the question of how coordination happens
> between multiple images especially on this shared data.

Right. Looks like a topic for the next Camp Smalltalk, with hands-on.

> Cheers
> Philippe
>
>



--
"If at first, the idea is not absurd, then there is no hope for it".  
Albert Einstein


Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Re: n-core Smalltalk at work [Re: Hydra now can do mitosis]

Klaus D. Witzel
In reply to this post by Rob Rothwell
On Sun, 22 Feb 2009 18:53:24 +0100, Rob Rothwell wrote:

> Perhaps naively, I simply downloaded the binaries and used them to open a
> 3.10 dev image, which seemed to work fine, FreeType and all...

:)

> So...from the helpful doits, it seems that you prepare a second image  
> that carries out the native processes for you?

Yes, "classic" Hydra loads the second .image from file and mitosis Hydra  
populates (the second) an empty .image from am arrayOfObjects passed in.

> Or can you run several native
> threads within the current image?

*run* within the current .image: No.
*clone* from within the current .image: Yes.

> Very interesting...and what is most impressive is that someone relatively
> unsophisticated like me could just open an image with the new VM, load  
> the
> HydraVM package from Squeaksource and get have HydraVM isHydra return  
> true!

A nice compliment for Igor who hacked this :)

> A short example of creating a "lengthy process" running in it's own  
> thread
> would be great...you know, something that just counts for a really long  
> time
> or something.

Like (123456 factorial) ? you want to see one of the cores running at 100%  
(instead of the idle loop); message understood :)

> This is very interesting!
>
> Rob
...

--
"If at first, the idea is not absurd, then there is no hope for it".  
Albert Einstein


Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] n-core Smalltalk at work [Re: Hydra now can do mitosis]

Michael Rueger-6
In reply to this post by Klaus D. Witzel
Klaus D. Witzel wrote:

> 2nd: what expression (HydraClone new cloneIdleProcess) does for you, is
> it runs the computational task which is described by the corresponding
> object subgraph, in a *new* native thread (with own heap and instance of

Just trying to understand this...

Does the object subgraph have to be complete (include all objects,
classes and methods) to run the task?

Or is there a way objects/code can be loaded on demand like (If I
understand this correctly) Craig's Spoon system does?

Would it be possibel to save the so created (minimal) image to reuse it
later?

Michael

Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Re: [ANN] Hydra now can do mitosis

Klaus D. Witzel
In reply to this post by Andreas.Raab
On Sun, 22 Feb 2009 18:19:33 +0100, Andreas Raab wrote:

> Interesting. Is this conceptually different from making a snapshot using  
> image segments and move this over to a different Hydra instance?

In principle: Yes.

Hydra mitosis tranfers all objects required by contractual obligation with  
the VM (special objects array, methods, context, process, scheduler,  
method dictionaries, classes, language level constants, etc).

This all has to be closed under #pointsTo: for each fixed/indexed field in  
transit.

And it populates an empty instance of ObjectMemory.

>
> Cheers,
>    - Andreas

[...]

--
"If at first, the idea is not absurd, then there is no hope for it".  
Albert Einstein


Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Re: [ANN] Hydra now can do mitosis

Michael Haupt-3
In reply to this post by Igor Stasenko
Hi Igor,

On Sun, Feb 22, 2009 at 2:36 PM, Igor Stasenko <[hidden email]> wrote:
> you can download binaries from here

hot. 8-) I can't wait to try!

Thanks,

Michael

Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Re: n-core Smalltalk at work [Re: Hydra now can do mitosis]

Klaus D. Witzel
In reply to this post by Michael Rueger-6
On Sun, 22 Feb 2009 19:57:48 +0100, Michael Rueger wrote:

> Klaus D. Witzel wrote:
>
>> 2nd: what expression (HydraClone new cloneIdleProcess) does for you, is  
>> it runs the computational task which is described by the corresponding  
>> object subgraph, in a *new* native thread (with own heap and instance of
>
> Just trying to understand this...
>
> Does the object subgraph have to be complete (include all objects,  
> classes and methods) to run the task?

Yes, except the unsent messages and unreferenced variables, they can be  
nil'ed using the substitution array. Example: many fields of Class(es) are  
for use by the IDE only, just nil'em.

> Or is there a way objects/code can be loaded on demand like (If I  
> understand this correctly) Craig's Spoon system does?

No. Spoon's dynamicity is not part of Hydra mitosis (and in order to add  
it, Spoon must be added).

> Would it be possibel to save the so created (minimal) image to reuse it  
> later?

Yes: do transfer the corresponding method then put it [the method] to  
work. "classic" Hydra can then load+run the saved .image as usual.

And if that .image also contains sufficient GUI,etc objects, even the  
non-Hydra VM can load+run it and render it for your use.

> Michael
>

--
"If at first, the idea is not absurd, then there is no hope for it".  
Albert Einstein


Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Re: n-core Smalltalk at work [Re: Hydra now can do mitosis]

Rob Rothwell
In reply to this post by Klaus D. Witzel
On Sun, Feb 22, 2009 at 1:38 PM, Klaus D. Witzel <[hidden email]> wrote:
Yes, "classic" Hydra loads the second .image from file and mitosis Hydra populates (the second) an empty .image from am arrayOfObjects passed in.

Ok...this is just, well, fun, but I can't quite figure out how to get a second image loaded with the #doIt channel "working."  I figure it's because I don't have the image I created it from set up right?  All I did was go down the line of in the Helpful doits workspace:

"Sanity check, are we running HydraVM?"
HydraVM isHydra  [true]

"To prepare an image for running in background thread (careful, VM will quit if you run this)"
HydraVM saveAsHeadlessImage: 'test.image'  [current image shut down and created another image]

"To run previously prepared image"
HydraVM loadAndRunNewImage: 'test.image'  [seemed to work]

"How many interpreters VM currently running"
HydraVM interpreterInstanceCount [2...this is good!]

"Test to check if main image listening for #transcript channel ..."
HydraChannel send: 'Transcript test' to: (HydraInterpreter current) channel: #transcript [true after the following line]

"... if not, try doing this first: "
HydraTranscript install

"Simple test to check if second image listens #doIt channel "
HydraChannel hasChannel: #doIt at: (HydraInterpreter at: 2)  [false]

Drat!!!

" ... and has Transcript global var replaced to redirect all input to main image"
(HydraInterpreter at: 2) doIt: 'Transcript show: ''Doit Test'''

"Do you like to install something to secondary image?"
(HydraInterpreter at: 2) doIt: '(HTTPSocket httpGet: ''installer.pbwiki.com/f/Installer.st'') fileIn '

"Do you like to save it? "
(HydraInterpreter at: 2) doIt: 'Smalltalk snapshot: true andQuit: false '


Take care,

Rob



Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Re: [ANN] Hydra now can do mitosis

Igor Stasenko
In reply to this post by Klaus D. Witzel
2009/2/22 Klaus D. Witzel <[hidden email]>:

> On Sun, 22 Feb 2009 18:19:33 +0100, Andreas Raab wrote:
>
>> Interesting. Is this conceptually different from making a snapshot using
>> image segments and move this over to a different Hydra instance?
>
> In principle: Yes.
>
> Hydra mitosis tranfers all objects required by contractual obligation with
> the VM (special objects array, methods, context, process, scheduler, method
> dictionaries, classes, language level constants, etc).
>
Yes, this is why an example object memory (HydraClone new cloneIdleProcess)
having 650 objects.
I had to build a correct special objects array, which obliged to include:
256 character objects
32 special selectors
and 80 objects in quiescentProcessLists.


> This all has to be closed under #pointsTo: for each fixed/indexed field in
> transit.
>
> And it populates an empty instance of ObjectMemory.
>

>>
>> Cheers,
>>   - Andreas
>
> [...]
>
> --
> "If at first, the idea is not absurd, then there is no hope for it". Albert
> Einstein
>
>
>



--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Re: n-core Smalltalk at work [Re: Hydra now can do mitosis]

Igor Stasenko
In reply to this post by Rob Rothwell
2009/2/22 Rob Rothwell <[hidden email]>:

> On Sun, Feb 22, 2009 at 1:38 PM, Klaus D. Witzel <[hidden email]>
> wrote:
>>
>> Yes, "classic" Hydra loads the second .image from file and mitosis Hydra
>> populates (the second) an empty .image from am arrayOfObjects passed in.
>
> Ok...this is just, well, fun, but I can't quite figure out how to get a
> second image loaded with the #doIt channel "working."  I figure it's because
> I don't have the image I created it from set up right?  All I did was go
> down the line of in the Helpful doits workspace:
>
> "Sanity check, are we running HydraVM?"
> HydraVM isHydra  [true]
>
> "To prepare an image for running in background thread (careful, VM will quit
> if you run this)"
> HydraVM saveAsHeadlessImage: 'test.image'  [current image shut down and
> created another image]
>
> "To run previously prepared image"
> HydraVM loadAndRunNewImage: 'test.image'  [seemed to work]
>
> "How many interpreters VM currently running"
> HydraVM interpreterInstanceCount [2...this is good!]
>
> "Test to check if main image listening for #transcript channel ..."
> HydraChannel send: 'Transcript test' to: (HydraInterpreter current) channel:
> #transcript [true after the following line]
>
> "... if not, try doing this first: "
> HydraTranscript install
>
> "Simple test to check if second image listens #doIt channel "
> HydraChannel hasChannel: #doIt at: (HydraInterpreter at: 2)  [false]
>
> Drat!!!
>

Yep.. in 3.10 this not working..
It looks like there are some crap in image startup method.
As a workaround, you can register the #doIt channel in your base image:

HydraVM registerDoItChannel.
and only then do
HydraVM saveAsHeadlessImage: 'test.image'

should work ok.

> " ... and has Transcript global var replaced to redirect all input to main
> image"
> (HydraInterpreter at: 2) doIt: 'Transcript show: ''Doit Test'''
>
> "Do you like to install something to secondary image?"
> (HydraInterpreter at: 2) doIt: '(HTTPSocket httpGet:
> ''installer.pbwiki.com/f/Installer.st'') fileIn '
>
> "Do you like to save it? "
> (HydraInterpreter at: 2) doIt: 'Smalltalk snapshot: true andQuit: false '
>
>
> Take care,
>
> Rob
>
>
>
>
>



--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Re: n-core Smalltalk at work [Re: Hydra now can do mitosis]

Igor Stasenko
2009/2/23 Igor Stasenko <[hidden email]>:

> 2009/2/22 Rob Rothwell <[hidden email]>:
>> On Sun, Feb 22, 2009 at 1:38 PM, Klaus D. Witzel <[hidden email]>
>> wrote:
>>>
>>> Yes, "classic" Hydra loads the second .image from file and mitosis Hydra
>>> populates (the second) an empty .image from am arrayOfObjects passed in.
>>
>> Ok...this is just, well, fun, but I can't quite figure out how to get a
>> second image loaded with the #doIt channel "working."  I figure it's because
>> I don't have the image I created it from set up right?  All I did was go
>> down the line of in the Helpful doits workspace:
>>
>> "Sanity check, are we running HydraVM?"
>> HydraVM isHydra  [true]
>>
>> "To prepare an image for running in background thread (careful, VM will quit
>> if you run this)"
>> HydraVM saveAsHeadlessImage: 'test.image'  [current image shut down and
>> created another image]
>>
>> "To run previously prepared image"
>> HydraVM loadAndRunNewImage: 'test.image'  [seemed to work]
>>
>> "How many interpreters VM currently running"
>> HydraVM interpreterInstanceCount [2...this is good!]
>>
>> "Test to check if main image listening for #transcript channel ..."
>> HydraChannel send: 'Transcript test' to: (HydraInterpreter current) channel:
>> #transcript [true after the following line]
>>
>> "... if not, try doing this first: "
>> HydraTranscript install
>>
>> "Simple test to check if second image listens #doIt channel "
>> HydraChannel hasChannel: #doIt at: (HydraInterpreter at: 2)  [false]
>>
>> Drat!!!
>>
>
> Yep.. in 3.10 this not working..
> It looks like there are some crap in image startup method.
> As a workaround, you can register the #doIt channel in your base image:
>
> HydraVM registerDoItChannel.
> and only then do
> HydraVM saveAsHeadlessImage: 'test.image'
>
> should work ok.
>

oh it looks like that probles is deeper than i thought.. need to look
at it more closely.

>> " ... and has Transcript global var replaced to redirect all input to main
>> image"
>> (HydraInterpreter at: 2) doIt: 'Transcript show: ''Doit Test'''
>>
>> "Do you like to install something to secondary image?"
>> (HydraInterpreter at: 2) doIt: '(HTTPSocket httpGet:
>> ''installer.pbwiki.com/f/Installer.st'') fileIn '
>>
>> "Do you like to save it? "
>> (HydraInterpreter at: 2) doIt: 'Smalltalk snapshot: true andQuit: false '
>>
>>
>> Take care,
>>
>> Rob
>>
>>
>>
>>
>>
>
>
>
> --
> Best regards,
> Igor Stasenko AKA sig.
>



--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Re: n-core Smalltalk at work [Re: Hydra now can do mitosis]

Philippe Marschall
In reply to this post by Klaus D. Witzel
2009/2/22 Klaus D. Witzel <[hidden email]>:

> On Sun, 22 Feb 2009 18:18:20 +0100, Philippe Marschall wrote:
>
>> 2009/2/22 Klaus D. Witzel :
>
> ...
>>>>
>>>> Well I have this web framework thingy where each http connection runs
>>>> in it's own process. Request processing is quite fast, sometimes below
>>>> a millisecond. There is potentially a lot sharing going on between
>>>> those connections for configuration, sessions, continuations and
>>>> stuff.
>>>
>>> Yeah we thought about that, after exchanging some Qs+As with Lukas
>>> (and/or
>>> you?) during last Camp Smalltalk, for the general case for Hydra.
>>>
>>> Several things are competing for attention/resolution/prototypical work:
>>>
>>> 1) some [accepted] Socket (and its OS dependent bits) can "belong" only
>>> to
>>> one native thread (= independent .image) in Hydra. Is this compatible
>>> with
>>> your web framework's requirements.
>>>
>>> 2) it must be possible for one native thread to accept a Socket, for
>>> another
>>> one to read/write it and get rid of it (and of its OS dependent bits).
>>> This
>>> is not a problem for us at the Smalltalk language/heap level but, until
>>> now
>>> I did't find an OS guy who said "this works, with guarantee, on these XYZ
>>> platforms".
>>
>> That and 1) do not necessarily need to happen. You could imagine one
>> image/native thread doing all the socket IO and handing the actual
>> work to other images/native threads.
>
> Yup. And the price tag is a) transfer "task description" to worker thread
> and b) transfer "result string" back in full or in part(s). And when using
> Hydra channels for transfer, add c) c-alloc of strings-to-be-transported.
>
>>> 3) when your web framework+app depends on a database "whatsoever", how is
>>> this to be shared (if sharing is really needed) between multiple native
>>> threads.
>>
>> Yepp, if you interpret database in a more general sense (a bunch of
>> objects).
>
> ... which includes framework/app config update/change. Right.
>
>> There is also the question of how coordination happens
>> between multiple images especially on this shared data.
>
> Right. Looks like a topic for the next Camp Smalltalk, with hands-on.

We should extend Camp Smalltalk to a week or so. So much to do, so little time.

Cheers
Philippe

Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Re: n-core Smalltalk at work [Re: Hydra now can do mitosis]

Klaus D. Witzel
On Mon, 23 Feb 2009 12:38:29 +0100, Philippe Marschall wrote:

> 2009/2/22 Klaus D. Witzel :
>> On Sun, 22 Feb 2009 18:18:20 +0100, Philippe Marschall wrote:
>>
...
>>>>> Well I have this web framework thingy
...
>>> There is also the question of how coordination happens
>>> between multiple images especially on this shared data.
>>
>> Right. Looks like a topic for the next Camp Smalltalk, with hands-on.
>
> We should extend Camp Smalltalk to a week or so. So much to do, so  
> little time.

Is there something that can be prepared/worked out/dugg into 'till then.  
Naive: a block diagram, picturing classes, that separates request  
processing from the app's work and from response [put yours here].

> Cheers
> Philippe
>

--
"If at first, the idea is not absurd, then there is no hope for it".  
Albert Einstein


12