MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How to kill slave kernel securely?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg117142] Re: How to kill slave kernel securely?
  • From: "Alexey Popkov" <lehin.p at gmail.com>
  • Date: Thu, 10 Mar 2011 06:13:30 -0500 (EST)

I do not use the built-in parallel computing functionality but trying to
implement another one with reliable protection from swapping and support for
older versions of kernels. I use standard MathLink methods from the
Documentation for this at the moment.
I wish to terminate the slave kernel(s) securely when 'Alt+.' is pressed in
the FrontEnd. The $ParentLink (the master kernel) in this case will not be
closed.


----- Original Message ----- 
From: "John Fultz" <jfultz at wolfram.com>
To: <lehin.p at gmail.com>; <mathgroup at smc.vnet.net>
Sent: Thursday, March 10, 2011 1:59 AM
Subject: [mg117142] Re: [mg117082] How to kill slave kernel securely?


It's not clear to me whether you're talking using the built-in parallel
computing functionality or whether you're talking about using some sort of
custom front end to a program (a kernel?  your own program?) which is in
turn
hooked to a kernel.  You've posted on this forum before about writing custom
front ends before, which makes any attempt at guessing your circumstances on
my
part difficult.

The statement that I made is precisely true.  If a kernel has its
$ParentLink
pointing to a link which is closed from the other side, that kernel will kill
itself, even if it's in the middle of a computation.  There could, of
course, be
a bug in the mechanism, but I have to say that I rely on this fact *very*
frequently (often multiple times daily because of the nature of the work I do),
and I almost never see it fail.

However, it's also possible that you're describing a situation which does not
precisely mirror the circumstances I'm laying out (e.g., the link is not closed,
or the kernel's $ParentLink is not that link at the time the link is
closed).  I
simply can't tell, as your description is not precise enough.

Also, I should have mentioned that you can send the MLTerminateMessage
message
using MLPutMessage().  Any program which respects this message (both the
kernel
and the FE do) will quit as quickly as possible.  In top-level Mathematica
code,
this can be accomplished by executing LinkInterrupt[1].

Sincerely,

John Fultz
jfultz at wolfram.com
User Interface Group
Wolfram Research, Inc.


On Thu, 10 Mar 2011 01:33:01 +0500, Alexey Popkov wrote:
> Very often when I Abort (by Alt+",") a program that heavily uses slave
> kernel I get an "emancipated" slave kernel that even can be used
> interactively.
>
> (sorry for typos and mistakes in the original response)
>
> ----- Original Message -----
> From: "Alexey Popkov" <lehin.p at gmail.com>
> To: <jfultz at wolfram.com> <mathgroup at smc.vnet.net>
> Sent: Thursday, March 10, 2011 1:12 AM
> Subject: Re: [mg117082] How to kill slave kernel securely?
>
>
>> Very often if I Abort (by Alt+",") a program heavily uses slave kernel I
> get
>> an "emancipated" slave kernel that even can be uses interactively.
>>
>>
>> ----- Original Message -----
>> From: "John Fultz" <jfultz at wolfram.com>
>> To: <lehin.p at gmail.com> <mathgroup at smc.vnet.net>
>> Sent: Thursday, March 10, 2011 12:06 AM
>> Subject: Re: [mg117082] How to kill slave kernel securely?
>>
>>
>> On Wed, 9 Mar 2011 07:00:02 -0500 (EST), Alexey wrote:
>>> Good day,
>>>
>>> LinkClose[link] "does not necessarily terminate the program at the
>>> other end of the connection" as it is said in the Documentation. Is
>>> there a way to kill the process of the slave kernel securely?
>>>
>> If the kernel's $ParentLink is the link that got closed, then the kernel
>> should
>> kill itself after, at most, a few seconds.  This is not true for
>> MathLink
>> programs generally, but it is true for Mathematica kernels.  Are you
> coming
>> across a case where that isn't happening?
>>
>> Sincerely,
>>
>> John Fultz
>> jfultz at wolfram.com
>> User Interface Group
>> Wolfram Research, Inc.





  • Prev by Date: Re: How to kill slave kernel securely?
  • Next by Date: Re: FindFit power law problem
  • Previous by thread: Re: How to kill slave kernel securely?
  • Next by thread: Re: How to kill slave kernel securely?