[Vm-dev] Multi-core system Squeak (was Re: Sista alternate bytecodes + Java Bytecode ?)

John McIntosh johnmci at smalltalkconsulting.com
Sat Oct 21 20:37:57 UTC 2017


Somehow I'm reminded of Igor Stasenko work on the Hydra VM.
http://squeakvm.org/~sig/hydravm/devnotes.html
I did do a port for Mac OS back in 2008.

Also btw for the OSX browser Squeak plugin work I did 10 years back we
would fork the VM and setup a shared memory location which shared the
Screen bitmap between the running background only Squeak VM process and the
plugin code in the browser that would get screen draw requests via a pipe
from the Squeak VM process and with the use of a shared semaphore latch to
prevent the Squeak VM from burying the Safari plugin with draw requests.

For this shared memory worked nicely as we didn't pipe MB of memory for a
screen draw back to the Safari plugin. All the safari plugin knew was to
copy the bit rectangle to the screen as ordered and signal the semaphore to
let the VM continue running after it had done a screen sync cmd.

Morphic in this millennium  (not the last) generally issues a screen flush
at the end of a 'drawing cycle' At that point the bits should go to the
device that shows them to the user. Intermediate draws aren't particularly
important but you can modify that visual aspect by forcing an update every
50 fps. Also maybe handy for last millennium code and obviously do the draw
only if the bitmap has changed.

On Thu, Oct 19, 2017 at 6:05 PM, David T. Lewis <lewis at mail.msen.com> wrote:

>
> On Fri, Oct 20, 2017 at 06:40:47AM +0800, Ben Coman wrote:
> >
> > On Fri, Oct 20, 2017 at 12:46 AM, tim Rowledge <tim at rowledge.org> wrote:
> >
> > >
> > >
> > > > On 19-10-2017, at 7:31 AM, Todd Blanchard <tblanchard at mac.com>
> wrote:
> > > >
> > > > It works very well and this idea of mini worker images sounds like it
> > > might be a good fit for that model.
> > > >
> > >
> > > One thing I noticed with surprise was how astonishingly fast Dave???s
> > > OSProcess could spawn an entire image, even on a Pi. So it might be
> worth
> > > experimenting with spawning a child image to do some processing and
> maybe
> > > transmit results back via sockets or writing a project file or.. well,
> > > whatever. You might think that on a tiny thing like a Pi you would
> rapidly
> > > use up all memory and start disastrous paging to SD (ouch!) but a Pi
> has a
> > > Gb or ram and my 6.0alpha development image uses less than 9% of that.
> > >
> > > It???s a potentially simple way to make some use of multiple cores.
> > >
> >
> > Are talking about booting up a new image?
> > What about native-forking a running image.  Linux default copy-on-write
> > (IIUC) should help limit memory usage, with full access to existing
> objects
> > without needing to worry about multi-threaded access to objectspace.
> > The trick to work out would the join mechanism. Perhaps returned objects
> > would be limited to instance variables containing only immediate types
> and
> > plain arrays of the same.  Maybe the join mechanism would need to groom
> out
> > non-compliant objects at the VM level.  Or the join returns a STON
> > representation.
> >
> > cheers -ben
>
> Yes that is exactly what Tim is talking about. The unix fork mechanism is
> suprisingly efficient when applied to a VM process running a Smalltalk
> image.
> Fuel works nicely for returning objects to the parent image, although I'm
> sure
> STON would work fine also.
>
> The Spur image format allows object memory to be segmented such that it
> will
> support fast and efficient forking of images even for extremely large
> images.
> I don't have any real world use cases to prove the point, but would be
> quite
> interested in finding some.
>
> The join mechanism can be very simple. The child image serializes the
> result
> of whatever work it has done, and writes it to a pipe connected to the
> parent
> image. The parent deserializes the next object from the pipe, and that is
> the
> result. As long as the pipe read does not block the VM (that is an
> OSProcess
> thing), you can put any number of child readers into separate Smalltalk
> processes.
>
> Background information is at http://wiki.squeak.org/squeak/6176.
>
> Dave
>
>


-- 
===========================================================================
John M. McIntosh. Corporate Smalltalk Consulting Ltd
https://www.linkedin.com/in/smalltalk
===========================================================================
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20171021/56a06667/attachment.html>


More information about the Vm-dev mailing list