Sometimes the kernel hangs and I'd like to see if I can kill the math-kernel process without destroying my front-end session and losing the changes in my unsaved notebook!
Asked
Active
Viewed 2,984 times
6
-
I believe @Rojo made something to autosave the notebook automatically before each run some time ago – Dr. belisarius Feb 14 '15 at 20:56
-
2Usually I just go into Task Manager on Windows and manually kill the MathKernel objects. I don't think I've experienced failures with this, but maybe others have experienced otherwise? – DumpsterDoofus Feb 14 '15 at 21:14
-
@DumpsterDoofus: Same here, have never had a problem with losing NB... – ciao Feb 14 '15 at 21:52
-
I've experienced many permutations of possibilities. On which versions, whether betas or not, etc., are all confused in my memory. If the front end is not hung, I can (almost always) save while the kernel is running, as well as kill the kernel from the command line without crashing the front end. If the front end is hung, then sometimes the front crashes when the kernel is killed; but this has not yet happened with V10.0.2. In V10.0.2, killing the kernel has been "safe" (knock on wood). – Michael E2 Feb 14 '15 at 23:16
-
Related: http://mathematica.stackexchange.com/q/13997 and http://mathematica.stackexchange.com/a/8762/5 – Michael E2 Feb 14 '15 at 23:18
-
@DumpsterDoofus I did exactly same work for about one month in about 16 core and 14GB ram PC. I run more than 40 computation session. in 10 different kernels. by making memory free by task manager. but now I have just one running kernel with using about 80MB Ram. but the task manager say more than 11GB Ram is inuse. but I can't see anything in process list. – jack cilba Jun 20 '16 at 22:08
1 Answers
4
In your aliases file (~/.zsh_aliases) add
alias a=alias
a km='kill -9 `pidof WolframKernel`'
Reload your shell. Now, if the front-end is hanging and you can't quit the kernel but don't want to lose your unsaved notebook changes, simply open a shell and type
km
Presto, kernels killed!
On OSX, if you don't have the pidof command do brew install pidof.
M.R.
- 31,425
- 8
- 90
- 281
-
This does not work for me. It successfully quits the kernel when the front end is not stuck, but when it hangs it does not stop the OS X rainbow wheel from spinning and have to force-quit, losing all unsaved progress. – abcd May 22 '22 at 13:07
-
1I would not start with -9. If you want to abort, for example it is useful to send a signal -2 , first, which tries to open control window an allows to abort/quit kernel gracefully. – Acus Jun 13 '22 at 10:41