#fork and deterministic resumption of the resulting process
Igor Stasenko
siguctua at gmail.com
Fri Feb 8 10:24:01 UTC 2008
On 08/02/2008, Michael van der Gulik <mikevdg at gmail.com> wrote:
>
>
> On Feb 8, 2008 10:38 PM, Michael van der Gulik <mikevdg at gmail.com> wrote:
> >
> >
> >
> >
> > go
> > | anArray numProcesses step |
> > anArray := Array new: 60000. "Assume an even larger number for
> realistic examples"
> > numProcesses := 32.
> > step := anArray size // numProcesses.
> > 1 to: anArray size by: step do: [ :i |
> > [
> > i to: (i+numProcesses-1) do: [ :j |
> > anArray at: j put: j ]
> > ] fixTemps fork.
> > ].
> > ^ anArray.
> >
> > However, it doesn't work except for small numbers. I'd be happy if
> somebody would be able to provide a fixed version; I can't work it out.
> >
> >
> >
> >
>
>
> That was a really obvious, stupid bug. Try again:
>
> anArray := Array new: 3200000.
> numProcesses := 64.
> step := anArray size // numProcesses.
> 1 to: anArray size by: step do: [ :i |
> [
> i to: i+step-1 do: [ :j |
> anArray at: j put: j ]
> ] fixTemps fork.
> ].
>
>
> Gulik.
>
2 Andreas: please note, that numerous Mike's code having many
assertions (because of different concurrency issues), but not a single
assumption about how scheduler is handling things :)
> --
> http://people.squeakfoundation.org/person/mikevdg
> http://gulik.pbwiki.com/
>
>
>
--
Best regards,
Igor Stasenko AKA sig.
More information about the Squeak-dev
mailing list
|