Re: How to kill slave kernel securely?
- To: mathgroup at smc.vnet.net
- Subject: [mg117209] Re: How to kill slave kernel securely?
- From: "Alexey Popkov" <lehin.p at gmail.com>
- Date: Fri, 11 Mar 2011 04:35:40 -0500 (EST)
Todd, In really I just need a function that kills the slave kernel securely and returns only when the process of the slave kernel has already killed and its memory has already released. Alexey Popkov ----- Original Message ----- From: "Alexey Popkov" <lehin.p at gmail.com> To: <mathgroup at smc.vnet.net>; "Todd Gayley" <tgayley at wolfram.com> Sent: Friday, March 11, 2011 4:56 AM Subject: [mg117209] Re: [mg117082] How to kill slave kernel securely? > Todd, > > I have discovered that in standard cases when using LinkInterrupt[link, 1] > my operating system (Windows 2000 at the moment) releases physical memory > only in 0.05-0.1 second beginning with a moment of execution of > LinkInterrupt[link, 1] while with LinkClose[link] it releases physical > memory in 0.01-0.03 second (both values include the time, spent on execution > of the command itself). Time intervals were measured by using SessionTime > under equal conditions and are steadily reproduced. > > Is there a way to make LinkInterrupt[link, 1] faster? > > Alexey Popkov > > > ----- Original Message ----- > From: "Todd Gayley" <tgayley at wolfram.com> > To: "Alexey" <lehin.p at gmail.com>; <mathgroup at smc.vnet.net> > Sent: Thursday, March 10, 2011 4:09 AM > Subject: Re: [mg117082] How to kill slave kernel securely? > > > > At 06:00 AM 3/9/2011, 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? > > > > > > Alexey, > > > > As you note, the kernel doesn't always die immediately when the link > > to it closes. That requires some cooperation from the kernel, and if > > the kernel is deep in some computational library function, it might > > not be in a position to respond. A much stronger step than just > > closing the link is to send the kernel an MLTerminateMessage. From > > top-level code (which is what I know you are using): > > > > LinkInterrupt[link, 1] (* An undocumented form that lets you pick > > the message type *) > > > > In C: > > > > MLPutMessage(link, MLTerminateMessage); > > > > In Java using J/Link: > > > > link.terminateKernel(); > > > > In .NET using .NET/Link: > > > > link.TerminateKernel(); > > > > > > Todd Gayley > > Wolfram Research > > > > >