Re: [squeak-dev] The Trunk: Kernel-ar.238.mcz

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

Re: [squeak-dev] The Trunk: Kernel-ar.238.mcz

Michael Haupt-3
Hi,

installation hangs at ~75 % during "cleaning up". The Squeak VM is at
100 % CPU load. Ctrl-. has no effect. (Mac VM 4.2.1.)

Best,

Michael

On Fri, Sep 4, 2009 at 6:51 AM, <[hidden email]> wrote:

> Andreas Raab uploaded a new version of Kernel to project The Trunk:
> http://source.squeak.org/trunk/Kernel-ar.238.mcz
>
> ==================== Summary ====================
>
> Name: Kernel-ar.238
> Author: ar
> Time: 3 September 2009, 9:50:51 am
> UUID: 9896c3f8-760f-e942-ac84-5f6c9127150c
> Ancestors: Kernel-ar.237
>
> http://bugs.squeak.org/view.php?id=7321
>
> Change Set:             AtomicProcessSuspend
> Date:                   23 March 2009
> Author:                 Andreas Raab
>
> In-image support for atomic process suspend.
>
> =============== Diff against Kernel-ar.237 ===============
>
> Item was changed:
>  ----- Method: Process>>suspend (in category 'changing process state') -----
>  suspend
> +       "Primitive. Stop the process that the receiver represents in such a way
> -       "Stop the process that the receiver represents in such a way
>        that it can be restarted at a later time (by sending the receiver the
>        message resume). If the receiver represents the activeProcess, suspend it.
> +       Otherwise remove the receiver from the list of waiting processes.
> +       The return value of this method is the list the receiver was previously on (if any)."
> +       | oldList |
> +       <primitive: 88>
> +       "This is fallback code for VMs which only support the old primitiveSuspend which
> +       would not accept processes that are waiting to be run."
> +       myList ifNil:[^nil]. "this allows us to use suspend multiple times"
> +       oldList := myList.
> +       myList := nil.
> +       oldList remove: self ifAbsent:[].
> +       ^oldList!
> -       Otherwise remove the receiver from the list of waiting processes."
> -
> -       self isActiveProcess ifTrue: [
> -               myList := nil.
> -               self primitiveSuspend.
> -       ] ifFalse: [
> -               myList ifNotNil: [
> -                       myList remove: self ifAbsent: [].
> -                       myList := nil].
> -       ]
> - !
>
> Item was changed:
>  ----- Method: Process>>offList (in category 'accessing') -----
>  offList
> +       "OBSOLETE. Process>>suspend will atomically reset myList if the process is suspended.
> +       There should never be a need to send #offList but some older users may not be aware
> +       of the changed semantics to suspend and may try the old hickadidoo seen here:
> -       "Inform the receiver that it has been taken off a list that it was
> -       suspended on. This is to break a backpointer."
>
> +               (suspendingList := process suspendingList) == nil
> +                       ifTrue: [process == Processor activeProcess ifTrue: [process suspend]]
> +                       ifFalse: [suspendingList remove: process ifAbsent:[].
> +                                       process offList].
> +
> +       Usages like the above should be replaced by a simple 'process suspend' "
>        myList := nil!
>
> Item was changed:
>  ----- Method: Process>>terminate (in category 'changing process state') -----
>  terminate
>        "Stop the process that the receiver represents forever.  Unwind to execute pending ensure:/ifCurtailed: blocks before terminating."
>
> +       | ctxt unwindBlock oldList |
> -       | ctxt unwindBlock inSema |
>        self isActiveProcess ifTrue: [
>                ctxt := thisContext.
>                [       ctxt := ctxt findNextUnwindContextUpTo: nil.
>                        ctxt isNil
>                ] whileFalse: [
>                        unwindBlock := ctxt tempAt: 1.
>                        unwindBlock ifNotNil: [
>                                ctxt tempAt: 1 put: nil.
>                                thisContext terminateTo: ctxt.
>                                unwindBlock value].
>                ].
>                thisContext terminateTo: nil.
> +               self suspend.
> +       ] ifFalse:[
> +               myList ifNotNil:[oldList := self suspend].
> +               suspendedContext ifNotNil:[
> -               myList := nil.
> -               self primitiveSuspend.
> -       ] ifFalse: [
> -               "Since the receiver is not the active process, drop its priority to rock-bottom so that
> -               it doesn't accidentally preempt the process that is trying to terminate it."
> -               priority := 10.
> -               myList ifNotNil: [
> -                       myList remove: self ifAbsent: [].
> -                       "Figure out if the receiver was terminated while waiting on a Semaphore"
> -                       inSema := myList class == Semaphore.
> -                       myList := nil].
> -               suspendedContext ifNotNil: [
>                        "Figure out if we are terminating the process while waiting in Semaphore>>critical:
>                        In this case, pop the suspendedContext so that we leave the ensure: block inside
>                        Semaphore>>critical: without signaling the semaphore."
> +                       (oldList class == Semaphore and:[
> -                       (inSema == true and:[
>                                suspendedContext method == (Semaphore compiledMethodAt: #critical:)]) ifTrue:[
>                                        suspendedContext := suspendedContext home.
>                        ].
>                        ctxt := self popTo: suspendedContext bottomContext.
>                        ctxt == suspendedContext bottomContext ifFalse: [
>                                self debug: ctxt title: 'Unwind error during termination']].
>        ].
>  !
>
> Item was removed:
> - ----- Method: Process>>primitiveSuspend (in category 'changing process state') -----
> - primitiveSuspend
> -       "Primitive. Stop the process that self represents in such a way
> -       that it can be restarted at a later time (by sending #resume).
> -       ASSUMES self is the active process.
> -       Essential. See Object documentation whatIsAPrimitive."
> -
> -       <primitive: 88>
> -       self primitiveFailed!
>
>
>

Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Re: The Trunk: Kernel-ar.238.mcz

Andreas.Raab
Michael Haupt wrote:
> installation hangs at ~75 % during "cleaning up". The Squeak VM is at
> 100 % CPU load. Ctrl-. has no effect. (Mac VM 4.2.1.)

Yeah, our Monticello version insists in removing methods before adding
new ones. Silly, silly Monticello. That does not play very well when the
methods are in Delay. I've committed another version but
source.squeak.org hangs again.

Cheers,
   - Andreas

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] The Trunk: Kernel-ar.238.mcz

Michael van der Gulik-2
In reply to this post by Michael Haupt-3
On Fri, 4 Sep 2009 04:51:35 0000, [hidden email]
<[hidden email]> wrote:

> Andreas Raab uploaded a new version of Kernel to project The Trunk:
> http://source.squeak.org/trunk/Kernel-ar.238.mcz
>
> ==================== Summary ====================
>
> Name: Kernel-ar.238
> Author: ar
> Time: 3 September 2009, 9:50:51 am
> UUID: 9896c3f8-760f-e942-ac84-5f6c9127150c
> Ancestors: Kernel-ar.237
>
> http://bugs.squeak.org/view.php?id=7321
>
> Change Set: AtomicProcessSuspend
> Date: 23 March 2009
> Author: Andreas Raab
>
> In-image support for atomic process suspend.
>
> =============== Diff against Kernel-ar.237 ===============
>
> Item was changed:
>   ----- Method: Process>>suspend (in category 'changing process state')
> -----
>   suspend
> + "Primitive. Stop the process that the receiver represents in such a way
> - "Stop the process that the receiver represents in such a way
>   that it can be restarted at a later time (by sending the receiver the
>   message resume). If the receiver represents the activeProcess, suspend
> it.
> + Otherwise remove the receiver from the list of waiting processes.
> + The return value of this method is the list the receiver was previously
> on (if any)."
> + | oldList |
> + <primitive: 88>
> + "This is fallback code for VMs which only support the old
> primitiveSuspend which
> + would not accept processes that are waiting to be run."
> + myList ifNil:[^nil]. "this allows us to use suspend multiple times"
> + oldList := myList.
> + myList := nil.
> + oldList remove: self ifAbsent:[].
> + ^oldList!
> - Otherwise remove the receiver from the list of waiting processes."
> -
> - self isActiveProcess ifTrue: [
> - myList := nil.
> - self primitiveSuspend.
> - ] ifFalse: [
> - myList ifNotNil: [
> - myList remove: self ifAbsent: [].
> - myList := nil].
> - ]
> - !
>
> Item was changed:
>   ----- Method: Process>>offList (in category 'accessing') -----
>   offList
> + "OBSOLETE. Process>>suspend will atomically reset myList if the process
> is suspended.
> + There should never be a need to send #offList but some older users may
> not be aware
> + of the changed semantics to suspend and may try the old hickadidoo seen
> here:
> - "Inform the receiver that it has been taken off a list that it was
> - suspended on. This is to break a backpointer."
>
> + (suspendingList := process suspendingList) == nil
> + ifTrue: [process == Processor activeProcess ifTrue: [process suspend]]
> + ifFalse: [suspendingList remove: process ifAbsent:[].
> + process offList].
> +
> + Usages like the above should be replaced by a simple 'process suspend' "
>   myList := nil!
>
> Item was changed:
>   ----- Method: Process>>terminate (in category 'changing process state')
> -----
>   terminate
>   "Stop the process that the receiver represents forever.  Unwind to
> execute pending ensure:/ifCurtailed: blocks before terminating."
>
> + | ctxt unwindBlock oldList |
> - | ctxt unwindBlock inSema |
>   self isActiveProcess ifTrue: [
>   ctxt := thisContext.
>   [ ctxt := ctxt findNextUnwindContextUpTo: nil.
>   ctxt isNil
>   ] whileFalse: [
>   unwindBlock := ctxt tempAt: 1.
>   unwindBlock ifNotNil: [
>   ctxt tempAt: 1 put: nil.
>   thisContext terminateTo: ctxt.
>   unwindBlock value].
>   ].
>   thisContext terminateTo: nil.
> + self suspend.
> + ] ifFalse:[
> + myList ifNotNil:[oldList := self suspend].
> + suspendedContext ifNotNil:[
> - myList := nil.
> - self primitiveSuspend.
> - ] ifFalse: [
> - "Since the receiver is not the active process, drop its priority to
> rock-bottom so that
> - it doesn't accidentally preempt the process that is trying to terminate
> it."
> - priority := 10.

I admit not fully understanding everything here, but should you
perhaps have kept the priority drop here? Otherwise, by my
understanding, the process that is meant to be terminated might be
restarted in this line here before it gets suspended:

> + myList ifNotNil:[oldList := self suspend].



Gulik.

--
http://gulik.pbwiki.com/

Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Re: The Trunk: Kernel-ar.238.mcz

Andreas.Raab
Michael van der Gulik wrote:

>> - ] ifFalse: [
>> - "Since the receiver is not the active process, drop its priority to
>> rock-bottom so that
>> - it doesn't accidentally preempt the process that is trying to terminate
>> it."
>> - priority := 10.
>
> I admit not fully understanding everything here, but should you
> perhaps have kept the priority drop here? Otherwise, by my
> understanding, the process that is meant to be terminated might be
> restarted in this line here before it gets suspended:
>
>> + myList ifNotNil:[oldList := self suspend].

Good catch, but it isn't necessary. There is no suspension point in the
above line. And dropping the priority isn't safe to begin with. The only
safe thing is atomic suspend. In fact, now that I look at it, I doubt
that there is a need for the myList ifNotNil:[] guard - it looks like a
left-over from the previous (unsafe) version.

Cheers,
   - Andreas