Re: How to kill slave kernel securely?
- To: mathgroup at smc.vnet.net
- Subject: [mg117167] Re: How to kill slave kernel securely?
- From: "Alexey Popkov" <lehin.p at gmail.com>
- Date: Thu, 10 Mar 2011 16:00:45 -0500 (EST)
----- Original Message ----- From: "Oliver Ruebenkoenig" <ruebenko at wolfram.com> > > 1) I cannot know how much memory I should allow MathKernel to allocate > > because other applications can allocate memory too. If I simply set > > MemoryConstrained to the amount of physical memory or even to the half of > > physical memory the system still can go into swapping. From the other side I > > do wish to allow MathKernel to use almost all available free physical memory > > with except for about 200 MB which must be always available for other > > applications. > > I am not sure I understand that. How would you that know with > FreeMemoryConstrained. FreeMemoryConstrained will check the current amount of free physical memory for example 100 times per second. It is not very expensive and should not take considerable processor time if it is implemented on the level of kernel functions. For example under Windows the GlobalMemoryStatusEx function of kernel32.dll is pretty fast. At this moment I am forced to call this function through NETLink and even in such way it does not take much of processor time on my machine. But using NETLink requires to be under Windows and have Microsoft .NET 2 or later to be installed. It also seems that for 64-bit systems I should implement another function. I think it would be very useful to have such function inside MathKernel and do not rely on .NET. As I understand MemoryConstrained works in the same way: it checks the amount of memory used with some intervals but the intervals depends on what is happening inside the MathKernel at this moment and this is the reason why it often fails. > > If you do not want your system to go into swap, have you tried switching > it off in the first place? > > Assuming you are on Linux you could use ulimit to set memory constraints. > This then would allow other processes to access the rest of the memory. I > have no idea how and if this works, say, on windows. I did not know about this, thank you. Now I am interested to find such function for Windows. > > 2) My bitter experience with MemoryConstrained clearly shows that it is not > > a reliable function. It practical cases when I heavily use such functions as > > NDSolve, NIntegrate etc. it often allows MathKernel to take for example > > 500-900 MB more that I have set. And system goes into swapping... > > > > You could forward that to the tech support for us to look at. > > Oliver >