#fork and deterministic resumption of the resulting process

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
109 messages Options
1 ... 3456
Reply | Threaded
Open this post in threaded view
|

Re: #fork and deterministic resumption of the resulting process

Paolo Bonzini-2

> Paolo> Without the patch *and with any scheduler that executes same-priority
> Paolo> processes fairly* the program is ensured to finish.  With the patch, the
> Paolo> program might not finish.  The two producer processes might ping-pong control
> Paolo> to each other, and the delay won't even be started.
>
> A workaround that handles badly written beginner code but eventually
> ruins the semantics for properly written expert code doesn't sound
> very good.  It's like ensuring that every motorcycle sold automatically
> comes with training wheels.  Ouch.

I wasn't saying that my code is practical or well written -- it's just
that I can prove it finishes.  But indeed your motorcycle metaphor is
what I was trying to say.

Paolo

Reply | Threaded
Open this post in threaded view
|

Re: #fork and deterministic resumption of the resulting process

Yoshiki Ohshima-2
At Fri, 08 Feb 2008 17:01:50 +0100,
Paolo Bonzini wrote:

>
>
> > Paolo> Without the patch *and with any scheduler that executes same-priority
> > Paolo> processes fairly* the program is ensured to finish.  With the patch, the
> > Paolo> program might not finish.  The two producer processes might ping-pong control
> > Paolo> to each other, and the delay won't even be started.
> >
> > A workaround that handles badly written beginner code but eventually
> > ruins the semantics for properly written expert code doesn't sound
> > very good.  It's like ensuring that every motorcycle sold automatically
> > comes with training wheels.  Ouch.
>
> I wasn't saying that my code is practical or well written -- it's just
> that I can prove it finishes.  But indeed your motorcycle metaphor is
> what I was trying to say.

  If I'd use the analogy, what was suggested wasn't training wheels.
For casual, novice programmers, proposed change is basically
invisible.  Sure, you can write some bad code that may starve one
process but that may happen without the patch if you write code in
that way, though.

  The patch is useful when one trys to build a serious distributed
interactive system for example; in that case, the programmer should
know how to write good code so the system doesn't have to try to
provide "safety" as much.  One can always shoot his foot anyway.  But,
there, having real determinism would help so much to debug it and
achieve stable application.

-- Yoshiki

Reply | Threaded
Open this post in threaded view
|

Re: #fork and deterministic resumption of the resulting process

Paolo Bonzini-2

>   The patch is useful when one trys to build a serious distributed
> interactive system for example; in that case, the programmer should
> know how to write good code so the system doesn't have to try to
> provide "safety" as much.

The patch is actually *useless* if the programmer knows how to write
good parallel code.  Hence the analogy with training wheels.

Paolo

Reply | Threaded
Open this post in threaded view
|

Re: #fork and deterministic resumption of the resulting process

Yoshiki Ohshima-2
At Sat, 09 Feb 2008 14:26:06 +0100,
Paolo Bonzini wrote:
>
>
> >   The patch is useful when one trys to build a serious distributed
> > interactive system for example; in that case, the programmer should
> > know how to write good code so the system doesn't have to try to
> > provide "safety" as much.
>
> The patch is actually *useless* if the programmer knows how to write
> good parallel code.  Hence the analogy with training wheels.

  Well, Andreas said that he uses the patch in a system and seems to
find good use of it.  So, the claim that it is useless
contradicts with the reality.  (Or, he doesn't know how to write good
parallel code.)

  Or, a good programmer should be able to devise his own parallel
program idioms so that Andreas' version doesn't have to be in the
public image.  (Probably this is closer what you mean.)

  Anyway, this is already in the domain of "rhetroic"...

-- Yoshiki

Reply | Threaded
Open this post in threaded view
|

Re: #fork and deterministic resumption of the resulting process

Paolo Bonzini-2

>   Well, Andreas said that he uses the patch in a system and seems to
> find good use of it.  So, the claim that it is useless
> contradicts with the reality.  (Or, he doesn't know how to write good
> parallel code.)

AFAIU, he has to deal with existing buggy code and this patch works
around the bugs.

Paolo

Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Re: #fork and deterministic resumption of the resulting process

Jason Johnson-5
In reply to this post by timrowledge
On Mon, Feb 4, 2008 at 10:49 PM, tim Rowledge <[hidden email]> wrote:
>
>  There are times when
>  people simply have to accept that the simple looking way to do
>  something is just plain wrong.

+1.  If you could figure out a way to get people to actually do this
then we could change the software world. :)

Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Re: #fork and deterministic resumption of the resulting process

Jason Johnson-5
In reply to this post by Michael van der Gulik-2
On Wed, Feb 6, 2008 at 9:26 PM, Michael van der Gulik <[hidden email]> wrote:
>
>  Er... I can't tell if you're joking or if you're serious.
>
>  I always write my code under the assumption that some day, in the
>  future, some bright spark will write a better VM that will run
>  separate Smalltalk Processes on separate OS processes/threads by
>  whatever means, thus better utilising multi-cored or multiple CPUs.
>
>  When that day comes, my code will run faster and your code will break.

If that pointless day ever comes both your code will break.
Share-state programming is just to complicated for mortals to do right
consistently.

Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Re: #fork and deterministic resumption of the resulting process

Jason Johnson-5
In reply to this post by Igor Stasenko
On Fri, Feb 8, 2008 at 11:58 AM, Igor Stasenko <[hidden email]> wrote:

> And some notes about priority.
>  I don't know much details how current squeak scheduler arranging things,
>  i'm just want to point out, that you using relative priority in your
>  samples and in your proposed patch, by writing  Processor
>  activePriority +/- n.
>  This, in own turn uncovers another problem with current scheduler
>  implementation: it's not designed to use relative priorities in mind.
>  As people pointed out:
>  Processor highestPriority + 1
>  or:
>  Processor lowestPriority -1
>  makes no sense, and lead to errors or unpredicted behavior.
>  So, first, i think, that if you really want to use relative priority
>  values, you should make changes to current implementation do to it
>  well and without errors.
>
>  Now, let's say if you make thing in the way, as i proposed in post
>  before (use highest/lowest priorities to depend only from current set
>  of running processes), the only thing which is left is to introduce a
>  scale.
>  I proposing a logarithmic time slicing:
>  a process with priority N doing roughly twice as much operations as
>  process with priority N-1 for a given period of time.

Or you could go with what I proposed quite some time back and haven't
had time to do anything about:  a real event driven preemptive
scheduler like found on the more advanced unix systems (i.e. don't
think Linux has this yet).

Quick summary:

A lot more priorities then now (the first Sun implementation had 160,
counting realtime).  Every priority level has a timeslice, the higher
the priority the smaller the timeslice.  If a process manages to use
it's whole timeslice then it gets demoted.  If it doesn't it gets
promoted.  This type of scheduler lets interactive processes always
get the CPU, and also gives CPU bound processes bigger time slices to
work with.

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Re: #fork and deterministic resumption of the resulting process

Michael van der Gulik-2
In reply to this post by Jason Johnson-5


On Sun, Mar 16, 2008 at 6:25 AM, Jason Johnson <[hidden email]> wrote:
On Wed, Feb 6, 2008 at 9:26 PM, Michael van der Gulik <[hidden email]> wrote:
>
>  Er... I can't tell if you're joking or if you're serious.
>
>  I always write my code under the assumption that some day, in the
>  future, some bright spark will write a better VM that will run
>  separate Smalltalk Processes on separate OS processes/threads by
>  whatever means, thus better utilising multi-cored or multiple CPUs.
>
>  When that day comes, my code will run faster and your code will break.

If that pointless day ever comes both your code will break.
Share-state programming is just to complicated for mortals to do right
consistently.



I don't seem to have much trouble with it myself.

Gulik.

--
http://people.squeakfoundation.org/person/mikevdg
http://gulik.pbwiki.com/

1 ... 3456