[vwnc] Deadlock Detection and how to see if a process is REALLY terminated

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

[vwnc] Deadlock Detection and how to see if a process is REALLY terminated

Wouter Gazendam
Hi,

Two questions:
 - I'm working on some crude form of deadlock detection for smalltalk
processes. Mainly to see whether two processes lock each other in a
'semaphore critical: [foo bar]' piece of code. Has anyone already done
something like this already for visualworks?
 - For this deadlock detector I ran into a problem of how to detect
whether a process is terminated. Process>>isTerminated doesn't always
respond the right answer here.

waitingProcess := [Semaphore new wait] fork.
waitingProcess isTerminated --> false.
waitingProcess terminateUnsafelyNow.
waitingProcess isTerminated --> false, I would expect true here.

Is there a way to see whether a process is REALLY terminated?

Thanks,

Wouter




--
Wouter Gazendam
AG5 B.V.
Timorplein 37
1094 CC Amsterdam
www.ag5.nl
tel. 020-4630942

Tel: 020-4630942
Fax: 020-4630946
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Deadlock Detection and how to see if a process is REALLY terminated

Terry Raymond
Wouter

#isTerminated was the correct implementation up through
VW 7.5. It appears that in 7.6 a change was made in the
VM so if the process was waiting on a semaphore the suspendedContext
was not set to nil when the process was terminated.

The quick fix for this would be to patch #finalTerminate
to nil out suspendedContext.

However, this is a bug and needs to be addressed by Cincom.

Terry
 
===========================================================
Terry Raymond
Crafted Smalltalk
80 Lazywood Ln.
Tiverton, RI  02878
(401) 624-4517      [hidden email]
<http://www.craftedsmalltalk.com>
===========================================================

> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf Of Wouter Gazendam
> Sent: Thursday, November 05, 2009 8:26 AM
> To: VWNC
> Subject: [vwnc] Deadlock Detection and how to see if a process is REALLY terminated
>
> Hi,
>
> Two questions:
>  - I'm working on some crude form of deadlock detection for smalltalk
> processes. Mainly to see whether two processes lock each other in a
> 'semaphore critical: [foo bar]' piece of code. Has anyone already done
> something like this already for visualworks?
>  - For this deadlock detector I ran into a problem of how to detect
> whether a process is terminated. Process>>isTerminated doesn't always
> respond the right answer here.
>
> waitingProcess := [Semaphore new wait] fork.
> waitingProcess isTerminated --> false.
> waitingProcess terminateUnsafelyNow.
> waitingProcess isTerminated --> false, I would expect true here.
>
> Is there a way to see whether a process is REALLY terminated?
>
> Thanks,
>
> Wouter
>
>
>
>
> --
> Wouter Gazendam
> AG5 B.V.
> Timorplein 37
> 1094 CC Amsterdam
> www.ag5.nl
> tel. 020-4630942
>
> Tel: 020-4630942
> Fax: 020-4630946
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Deadlock Detection and how to see if a process is REALLY terminated

Terry Raymond
Wouter

The following provides a better comparison of the effects of the
various terminate methods. The #yield is required because terminate
runs within the process being terminated.

| proc |
proc := [Transcript show: 'Ahh nuts' ; cr] fork.
proc terminate.
Processor yield.
Transcript show: '#terminate - ' , proc isTerminated printString;cr.
proc := [Transcript show: 'Ahh nuts' ; cr] fork.
proc terminateUnsafelyNow.
Processor yield.
Transcript show: '#terminateUnsafelyNow - ' , proc isTerminated printString;cr.
proc := [Transcript show: 'Ahh nuts' ; cr] fork.
proc terminateUnsafely.
Processor yield.
Transcript show: '#terminateUnsafely - ' , proc isTerminated printString;cr.
proc := [Transcript show: 'Ahh nuts' ; cr] fork.
proc terminateWithExtremePrejudice.
Processor yield.
Transcript show: '#terminateWithExtremePrejudice - ' , proc isTerminated printString;cr.

Terry
 
===========================================================
Terry Raymond
Crafted Smalltalk
80 Lazywood Ln.
Tiverton, RI  02878
(401) 624-4517      [hidden email]
<http://www.craftedsmalltalk.com>
===========================================================

> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf Of Terry Raymond
> Sent: Thursday, November 05, 2009 9:06 AM
> To: 'Wouter Gazendam'; 'VWNC'
> Subject: Re: [vwnc] Deadlock Detection and how to see if a process is REALLY terminated
>
> Wouter
>
> #isTerminated was the correct implementation up through
> VW 7.5. It appears that in 7.6 a change was made in the
> VM so if the process was waiting on a semaphore the suspendedContext
> was not set to nil when the process was terminated.
>
> The quick fix for this would be to patch #finalTerminate
> to nil out suspendedContext.
>
> However, this is a bug and needs to be addressed by Cincom.
>
> Terry
>
> ===========================================================
> Terry Raymond
> Crafted Smalltalk
> 80 Lazywood Ln.
> Tiverton, RI  02878
> (401) 624-4517      [hidden email]
> <http://www.craftedsmalltalk.com>
> ===========================================================
> > -----Original Message-----
> > From: [hidden email] [mailto:[hidden email]] On Behalf Of Wouter Gazendam
> > Sent: Thursday, November 05, 2009 8:26 AM
> > To: VWNC
> > Subject: [vwnc] Deadlock Detection and how to see if a process is REALLY terminated
> >
> > Hi,
> >
> > Two questions:
> >  - I'm working on some crude form of deadlock detection for smalltalk
> > processes. Mainly to see whether two processes lock each other in a
> > 'semaphore critical: [foo bar]' piece of code. Has anyone already done
> > something like this already for visualworks?
> >  - For this deadlock detector I ran into a problem of how to detect
> > whether a process is terminated. Process>>isTerminated doesn't always
> > respond the right answer here.
> >
> > waitingProcess := [Semaphore new wait] fork.
> > waitingProcess isTerminated --> false.
> > waitingProcess terminateUnsafelyNow.
> > waitingProcess isTerminated --> false, I would expect true here.
> >
> > Is there a way to see whether a process is REALLY terminated?
> >
> > Thanks,
> >
> > Wouter
> >
> >
> >
> >
> > --
> > Wouter Gazendam
> > AG5 B.V.
> > Timorplein 37
> > 1094 CC Amsterdam
> > www.ag5.nl
> > tel. 020-4630942
> >
> > Tel: 020-4630942
> > Fax: 020-4630946
> > _______________________________________________
> > vwnc mailing list
> > [hidden email]
> > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Deadlock Detection and how to see if a process is REALLY terminated

Terry Raymond
It appears that my initial analysis that a vm change in 7.6 caused the
problem was incorrect. However, changing #finalTerminate as follows seems
to produce the desired result for the doit.

finalTerminate
        "This is the place to put in final processing before a process ends"

        self primTerminate.
        suspendedContext := nil.
        ^self

Keep in mind that this really requires further investigation to
determine if there are any other negative side effects.

Terry
 
===========================================================
Terry Raymond
Crafted Smalltalk
80 Lazywood Ln.
Tiverton, RI  02878
(401) 624-4517      [hidden email]
<http://www.craftedsmalltalk.com>
===========================================================

> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf Of Terry Raymond
> Sent: Thursday, November 05, 2009 9:58 AM
> To: 'Wouter Gazendam'; 'VWNC'
> Subject: Re: [vwnc] Deadlock Detection and how to see if a process is REALLY terminated
>
> Wouter
>
> The following provides a better comparison of the effects of the
> various terminate methods. The #yield is required because terminate
> runs within the process being terminated.
>
> | proc |
> proc := [Transcript show: 'Ahh nuts' ; cr] fork.
> proc terminate.
> Processor yield.
> Transcript show: '#terminate - ' , proc isTerminated printString;cr.
> proc := [Transcript show: 'Ahh nuts' ; cr] fork.
> proc terminateUnsafelyNow.
> Processor yield.
> Transcript show: '#terminateUnsafelyNow - ' , proc isTerminated printString;cr.
> proc := [Transcript show: 'Ahh nuts' ; cr] fork.
> proc terminateUnsafely.
> Processor yield.
> Transcript show: '#terminateUnsafely - ' , proc isTerminated printString;cr.
> proc := [Transcript show: 'Ahh nuts' ; cr] fork.
> proc terminateWithExtremePrejudice.
> Processor yield.
> Transcript show: '#terminateWithExtremePrejudice - ' , proc isTerminated printString;cr.
>
> Terry
>
> ===========================================================
> Terry Raymond
> Crafted Smalltalk
> 80 Lazywood Ln.
> Tiverton, RI  02878
> (401) 624-4517      [hidden email]
> <http://www.craftedsmalltalk.com>
> ===========================================================
>
> > -----Original Message-----
> > From: [hidden email] [mailto:[hidden email]] On Behalf Of Terry Raymond
> > Sent: Thursday, November 05, 2009 9:06 AM
> > To: 'Wouter Gazendam'; 'VWNC'
> > Subject: Re: [vwnc] Deadlock Detection and how to see if a process is REALLY terminated
> >
> > Wouter
> >
> > #isTerminated was the correct implementation up through
> > VW 7.5. It appears that in 7.6 a change was made in the
> > VM so if the process was waiting on a semaphore the suspendedContext
> > was not set to nil when the process was terminated.
> >
> > The quick fix for this would be to patch #finalTerminate
> > to nil out suspendedContext.
> >
> > However, this is a bug and needs to be addressed by Cincom.
> >
> > Terry
> >
> > ===========================================================
> > Terry Raymond
> > Crafted Smalltalk
> > 80 Lazywood Ln.
> > Tiverton, RI  02878
> > (401) 624-4517      [hidden email]
> > <http://www.craftedsmalltalk.com>
> > ===========================================================
> > > -----Original Message-----
> > > From: [hidden email] [mailto:[hidden email]] On Behalf Of Wouter Gazendam
> > > Sent: Thursday, November 05, 2009 8:26 AM
> > > To: VWNC
> > > Subject: [vwnc] Deadlock Detection and how to see if a process is REALLY terminated
> > >
> > > Hi,
> > >
> > > Two questions:
> > >  - I'm working on some crude form of deadlock detection for smalltalk
> > > processes. Mainly to see whether two processes lock each other in a
> > > 'semaphore critical: [foo bar]' piece of code. Has anyone already done
> > > something like this already for visualworks?
> > >  - For this deadlock detector I ran into a problem of how to detect
> > > whether a process is terminated. Process>>isTerminated doesn't always
> > > respond the right answer here.
> > >
> > > waitingProcess := [Semaphore new wait] fork.
> > > waitingProcess isTerminated --> false.
> > > waitingProcess terminateUnsafelyNow.
> > > waitingProcess isTerminated --> false, I would expect true here.
> > >
> > > Is there a way to see whether a process is REALLY terminated?
> > >
> > > Thanks,
> > >
> > > Wouter
> > >
> > >
> > >
> > >
> > > --
> > > Wouter Gazendam
> > > AG5 B.V.
> > > Timorplein 37
> > > 1094 CC Amsterdam
> > > www.ag5.nl
> > > tel. 020-4630942
> > >
> > > Tel: 020-4630942
> > > Fax: 020-4630946
> > > _______________________________________________
> > > vwnc mailing list
> > > [hidden email]
> > > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
> >
> > _______________________________________________
> > vwnc mailing list
> > [hidden email]
> > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Deadlock Detection and how to see if a process is REALLY terminated

Wouter Gazendam
Terry,

Thanks for the temporary fix.
However, I'd imagine that it would be the responsibility of the VM to
respond whether a Process is terminated, because the VM seems to be
the only one to really know. Isn't there a way to ask the scheduler in
the VM somehow? (Is there such a thing?)

Thx,

Wouter

On Thu, Nov 5, 2009 at 4:39 PM, Terry Raymond
<[hidden email]> wrote:

> It appears that my initial analysis that a vm change in 7.6 caused the
> problem was incorrect. However, changing #finalTerminate as follows seems
> to produce the desired result for the doit.
>
> finalTerminate
>        "This is the place to put in final processing before a process ends"
>
>        self primTerminate.
>        suspendedContext := nil.
>        ^self
>
> Keep in mind that this really requires further investigation to
> determine if there are any other negative side effects.
>
> Terry
>
> ===========================================================
> Terry Raymond
> Crafted Smalltalk
> 80 Lazywood Ln.
> Tiverton, RI  02878
> (401) 624-4517      [hidden email]
> <http://www.craftedsmalltalk.com>
> ===========================================================
>
>> -----Original Message-----
>> From: [hidden email] [mailto:[hidden email]] On Behalf Of Terry Raymond
>> Sent: Thursday, November 05, 2009 9:58 AM
>> To: 'Wouter Gazendam'; 'VWNC'
>> Subject: Re: [vwnc] Deadlock Detection and how to see if a process is REALLY terminated
>>
>> Wouter
>>
>> The following provides a better comparison of the effects of the
>> various terminate methods. The #yield is required because terminate
>> runs within the process being terminated.
>>
>> | proc |
>> proc := [Transcript show: 'Ahh nuts' ; cr] fork.
>> proc terminate.
>> Processor yield.
>> Transcript show: '#terminate - ' , proc isTerminated printString;cr.
>> proc := [Transcript show: 'Ahh nuts' ; cr] fork.
>> proc terminateUnsafelyNow.
>> Processor yield.
>> Transcript show: '#terminateUnsafelyNow - ' , proc isTerminated printString;cr.
>> proc := [Transcript show: 'Ahh nuts' ; cr] fork.
>> proc terminateUnsafely.
>> Processor yield.
>> Transcript show: '#terminateUnsafely - ' , proc isTerminated printString;cr.
>> proc := [Transcript show: 'Ahh nuts' ; cr] fork.
>> proc terminateWithExtremePrejudice.
>> Processor yield.
>> Transcript show: '#terminateWithExtremePrejudice - ' , proc isTerminated printString;cr.
>>
>> Terry
>>
>> ===========================================================
>> Terry Raymond
>> Crafted Smalltalk
>> 80 Lazywood Ln.
>> Tiverton, RI  02878
>> (401) 624-4517      [hidden email]
>> <http://www.craftedsmalltalk.com>
>> ===========================================================
>>
>> > -----Original Message-----
>> > From: [hidden email] [mailto:[hidden email]] On Behalf Of Terry Raymond
>> > Sent: Thursday, November 05, 2009 9:06 AM
>> > To: 'Wouter Gazendam'; 'VWNC'
>> > Subject: Re: [vwnc] Deadlock Detection and how to see if a process is REALLY terminated
>> >
>> > Wouter
>> >
>> > #isTerminated was the correct implementation up through
>> > VW 7.5. It appears that in 7.6 a change was made in the
>> > VM so if the process was waiting on a semaphore the suspendedContext
>> > was not set to nil when the process was terminated.
>> >
>> > The quick fix for this would be to patch #finalTerminate
>> > to nil out suspendedContext.
>> >
>> > However, this is a bug and needs to be addressed by Cincom.
>> >
>> > Terry
>> >
>> > ===========================================================
>> > Terry Raymond
>> > Crafted Smalltalk
>> > 80 Lazywood Ln.
>> > Tiverton, RI  02878
>> > (401) 624-4517      [hidden email]
>> > <http://www.craftedsmalltalk.com>
>> > ===========================================================
>> > > -----Original Message-----
>> > > From: [hidden email] [mailto:[hidden email]] On Behalf Of Wouter Gazendam
>> > > Sent: Thursday, November 05, 2009 8:26 AM
>> > > To: VWNC
>> > > Subject: [vwnc] Deadlock Detection and how to see if a process is REALLY terminated
>> > >
>> > > Hi,
>> > >
>> > > Two questions:
>> > >  - I'm working on some crude form of deadlock detection for smalltalk
>> > > processes. Mainly to see whether two processes lock each other in a
>> > > 'semaphore critical: [foo bar]' piece of code. Has anyone already done
>> > > something like this already for visualworks?
>> > >  - For this deadlock detector I ran into a problem of how to detect
>> > > whether a process is terminated. Process>>isTerminated doesn't always
>> > > respond the right answer here.
>> > >
>> > > waitingProcess := [Semaphore new wait] fork.
>> > > waitingProcess isTerminated --> false.
>> > > waitingProcess terminateUnsafelyNow.
>> > > waitingProcess isTerminated --> false, I would expect true here.
>> > >
>> > > Is there a way to see whether a process is REALLY terminated?
>> > >
>> > > Thanks,
>> > >
>> > > Wouter
>> > >
>> > >
>> > >
>> > >
>> > > --
>> > > Wouter Gazendam
>> > > AG5 B.V.
>> > > Timorplein 37
>> > > 1094 CC Amsterdam
>> > > www.ag5.nl
>> > > tel. 020-4630942
>> > >
>> > > Tel: 020-4630942
>> > > Fax: 020-4630946
>> > > _______________________________________________
>> > > vwnc mailing list
>> > > [hidden email]
>> > > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>> >
>> > _______________________________________________
>> > vwnc mailing list
>> > [hidden email]
>> > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>>
>> _______________________________________________
>> vwnc mailing list
>> [hidden email]
>> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>
>



--
Wouter Gazendam
AG5 B.V.
Timorplein 37
1094 CC Amsterdam
www.ag5.nl
tel. 020-4630942

Tel: 020-4630942
Fax: 020-4630946

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Deadlock Detection and how to see if a process is REALLY terminated

Eliot Miranda-2
Hi Wouter,

On Thu, Nov 5, 2009 at 9:02 AM, Wouter Gazendam <[hidden email]> wrote:
Terry,

Thanks for the temporary fix.
However, I'd imagine that it would be the responsibility of the VM to
respond whether a Process is terminated, because the VM seems to be
the only one to really know. Isn't there a way to ask the scheduler in
the VM somehow? (Is there such a thing?)


A process is terminated when it has been removed from the run queues and al its unwinds have been run.  Removing it from the run queue can be done e.g. by getting to to wait on a semaprore, not just using the suspend primitive.  Whether all its unwinds have been run is not something the VM can know about.  That's a (excuse the pun) process issue.

So, no, the VM cannot know that a process has been correctly terminated.  It can to some extent determine if a process is runnable, but that's not at all the converse of a process having been terminated.

HTH
Eliot

Thx,

Wouter

On Thu, Nov 5, 2009 at 4:39 PM, Terry Raymond
<[hidden email]> wrote:
> It appears that my initial analysis that a vm change in 7.6 caused the
> problem was incorrect. However, changing #finalTerminate as follows seems
> to produce the desired result for the doit.
>
> finalTerminate
>        "This is the place to put in final processing before a process ends"
>
>        self primTerminate.
>        suspendedContext := nil.
>        ^self
>
> Keep in mind that this really requires further investigation to
> determine if there are any other negative side effects.
>
> Terry
>
> ===========================================================
> Terry Raymond
> Crafted Smalltalk
> 80 Lazywood Ln.
> Tiverton, RI  02878
> (401) 624-4517      [hidden email]
> <http://www.craftedsmalltalk.com>
> ===========================================================
>
>> -----Original Message-----
>> From: [hidden email] [mailto:[hidden email]] On Behalf Of Terry Raymond
>> Sent: Thursday, November 05, 2009 9:58 AM
>> To: 'Wouter Gazendam'; 'VWNC'
>> Subject: Re: [vwnc] Deadlock Detection and how to see if a process is REALLY terminated
>>
>> Wouter
>>
>> The following provides a better comparison of the effects of the
>> various terminate methods. The #yield is required because terminate
>> runs within the process being terminated.
>>
>> | proc |
>> proc := [Transcript show: 'Ahh nuts' ; cr] fork.
>> proc terminate.
>> Processor yield.
>> Transcript show: '#terminate - ' , proc isTerminated printString;cr.
>> proc := [Transcript show: 'Ahh nuts' ; cr] fork.
>> proc terminateUnsafelyNow.
>> Processor yield.
>> Transcript show: '#terminateUnsafelyNow - ' , proc isTerminated printString;cr.
>> proc := [Transcript show: 'Ahh nuts' ; cr] fork.
>> proc terminateUnsafely.
>> Processor yield.
>> Transcript show: '#terminateUnsafely - ' , proc isTerminated printString;cr.
>> proc := [Transcript show: 'Ahh nuts' ; cr] fork.
>> proc terminateWithExtremePrejudice.
>> Processor yield.
>> Transcript show: '#terminateWithExtremePrejudice - ' , proc isTerminated printString;cr.
>>
>> Terry
>>
>> ===========================================================
>> Terry Raymond
>> Crafted Smalltalk
>> 80 Lazywood Ln.
>> Tiverton, RI  02878
>> (401) 624-4517      [hidden email]
>> <http://www.craftedsmalltalk.com>
>> ===========================================================
>>
>> > -----Original Message-----
>> > From: [hidden email] [mailto:[hidden email]] On Behalf Of Terry Raymond
>> > Sent: Thursday, November 05, 2009 9:06 AM
>> > To: 'Wouter Gazendam'; 'VWNC'
>> > Subject: Re: [vwnc] Deadlock Detection and how to see if a process is REALLY terminated
>> >
>> > Wouter
>> >
>> > #isTerminated was the correct implementation up through
>> > VW 7.5. It appears that in 7.6 a change was made in the
>> > VM so if the process was waiting on a semaphore the suspendedContext
>> > was not set to nil when the process was terminated.
>> >
>> > The quick fix for this would be to patch #finalTerminate
>> > to nil out suspendedContext.
>> >
>> > However, this is a bug and needs to be addressed by Cincom.
>> >
>> > Terry
>> >
>> > ===========================================================
>> > Terry Raymond
>> > Crafted Smalltalk
>> > 80 Lazywood Ln.
>> > Tiverton, RI  02878
>> > (401) 624-4517      [hidden email]
>> > <http://www.craftedsmalltalk.com>
>> > ===========================================================
>> > > -----Original Message-----
>> > > From: [hidden email] [mailto:[hidden email]] On Behalf Of Wouter Gazendam
>> > > Sent: Thursday, November 05, 2009 8:26 AM
>> > > To: VWNC
>> > > Subject: [vwnc] Deadlock Detection and how to see if a process is REALLY terminated
>> > >
>> > > Hi,
>> > >
>> > > Two questions:
>> > >  - I'm working on some crude form of deadlock detection for smalltalk
>> > > processes. Mainly to see whether two processes lock each other in a
>> > > 'semaphore critical: [foo bar]' piece of code. Has anyone already done
>> > > something like this already for visualworks?
>> > >  - For this deadlock detector I ran into a problem of how to detect
>> > > whether a process is terminated. Process>>isTerminated doesn't always
>> > > respond the right answer here.
>> > >
>> > > waitingProcess := [Semaphore new wait] fork.
>> > > waitingProcess isTerminated --> false.
>> > > waitingProcess terminateUnsafelyNow.
>> > > waitingProcess isTerminated --> false, I would expect true here.
>> > >
>> > > Is there a way to see whether a process is REALLY terminated?
>> > >
>> > > Thanks,
>> > >
>> > > Wouter
>> > >
>> > >
>> > >
>> > >
>> > > --
>> > > Wouter Gazendam
>> > > AG5 B.V.
>> > > Timorplein 37
>> > > 1094 CC Amsterdam
>> > > www.ag5.nl
>> > > tel. 020-4630942
>> > >
>> > > Tel: 020-4630942
>> > > Fax: 020-4630946
>> > > _______________________________________________
>> > > vwnc mailing list
>> > > [hidden email]
>> > > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>> >
>> > _______________________________________________
>> > vwnc mailing list
>> > [hidden email]
>> > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>>
>> _______________________________________________
>> vwnc mailing list
>> [hidden email]
>> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>
>



--
Wouter Gazendam
AG5 B.V.
Timorplein 37
1094 CC Amsterdam
www.ag5.nl
tel. 020-4630942

Tel: 020-4630942
Fax: 020-4630946

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Deadlock Detection and how to see if a process is REALLY terminated

Alan Knight-2
In reply to this post by Terry Raymond
Thanks. That does seem reasonable. I've created AR 58641 for that.

At 10:39 AM 2009-11-05, Terry Raymond wrote:
It appears that my initial analysis that a vm change in 7.6 caused the
problem was incorrect. However, changing #finalTerminate as follows seems
to produce the desired result for the doit.

finalTerminate
        "This is the place to put in final processing before a process ends"

        self primTerminate.
         suspendedContext := nil.
        ^self

Keep in mind that this really requires further investigation to
determine if there are any other negative side effects.

Terry
 
===========================================================
Terry Raymond
Crafted Smalltalk
80 Lazywood Ln.
Tiverton, RI  02878
(401) 624-4517      [hidden email]
< http://www.craftedsmalltalk.com>
===========================================================

> -----Original Message-----
> From: [hidden email] [[hidden email]] On Behalf Of Terry Raymond
> Sent: Thursday, November 05, 2009 9:58 AM
> To: 'Wouter Gazendam'; 'VWNC'
> Subject: Re: [vwnc] Deadlock Detection and how to see if a process is REALLY terminated
>
> Wouter
>
> The following provides a better comparison of the effects of the
> various terminate methods. The #yield is required because terminate
> runs within the process being terminated.
>
> | proc |
> proc := [Transcript show: 'Ahh nuts' ; cr] fork.
> proc terminate.
> Processor yield.
> Transcript show: '#terminate - ' , proc isTerminated printString;cr.
> proc := [Transcript show: 'Ahh nuts' ; cr] fork.
> proc terminateUnsafelyNow.
> Processor yield.
> Transcript show: '#terminateUnsafelyNow - ' , proc isTerminated printString;cr.
> proc := [Transcript show: 'Ahh nuts' ; cr] fork.
> proc terminateUnsafely.
> Processor yield.
> Transcript show: '#terminateUnsafely - ' , proc isTerminated printString;cr.
> proc := [Transcript show: 'Ahh nuts' ; cr] fork.
> proc terminateWithExtremePrejudice.
> Processor yield.
> Transcript show: '#terminateWithExtremePrejudice - ' , proc isTerminated printString;cr.
>
> Terry
>
> ===========================================================
> Terry Raymond
> Crafted Smalltalk
> 80 Lazywood Ln.
> Tiverton, RI  02878
> (401) 624-4517      [hidden email]
> < http://www.craftedsmalltalk.com>
> ===========================================================
>
> > -----Original Message-----
> > From: [hidden email] [[hidden email]] On Behalf Of Terry Raymond
> > Sent: Thursday, November 05, 2009 9:06 AM
> > To: 'Wouter Gazendam'; 'VWNC'
> > Subject: Re: [vwnc] Deadlock Detection and how to see if a process is REALLY terminated
> >
> > Wouter
> >
> > #isTerminated was the correct implementation up through
> > VW 7.5. It appears that in 7.6 a change was made in the
> > VM so if the process was waiting on a semaphore the suspendedContext
> > was not set to nil when the process was terminated.
> >
> > The quick fix for this would be to patch #finalTerminate
> > to nil out suspendedContext.
> >
> > However, this is a bug and needs to be addressed by Cincom.
> >
> > Terry
> >
> > ===========================================================
> > Terry Raymond
> > Crafted Smalltalk
> > 80 Lazywood Ln.
> > Tiverton, RI  02878
> > (401) 624-4517      [hidden email]
> > < http://www.craftedsmalltalk.com>
> > ===========================================================
> > > -----Original Message-----
> > > From: [hidden email] [[hidden email]] On Behalf Of Wouter Gazendam
> > > Sent: Thursday, November 05, 2009 8:26 AM
> > > To: VWNC
> > > Subject: [vwnc] Deadlock Detection and how to see if a process is REALLY terminated
> > >
> > > Hi,
> > >
> > > Two questions:
> > >  - I'm working on some crude form of deadlock detection for smalltalk
> > > processes. Mainly to see whether two processes lock each other in a
> > > 'semaphore critical: [foo bar]' piece of code. Has anyone already done
> > > something like this already for visualworks?
> > >  - For this deadlock detector I ran into a problem of how to detect
> > > whether a process is terminated. Process>>isTerminated doesn't always
> > > respond the right answer here.
> > >
> > > waitingProcess := [Semaphore new wait] fork.
> > > waitingProcess isTerminated --> false.
> > > waitingProcess terminateUnsafelyNow.
> > > waitingProcess isTerminated --> false, I would expect true here.
> > >
> > > Is there a way to see whether a process is REALLY terminated?
> > >
> > > Thanks,
> > >
> > > Wouter
> > >
> > >
> > >
> > >
> > > --
> > > Wouter Gazendam
> > > AG5 B.V.
> > > Timorplein 37
> > > 1094 CC Amsterdam
> > > www.ag5.nl
> > > tel. 020-4630942
> > >
> > > Tel: 020-4630942
> > > Fax: 020-4630946
> > > _______________________________________________
> > > vwnc mailing list
> > > [hidden email]
> > > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
> >
> > _______________________________________________
> > vwnc mailing list
> > [hidden email]
> > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

--
Alan Knight [|], Engineering Manager, Cincom Smalltalk

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc