LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   Can kernel kill long-running process? (https://www.linuxquestions.org/questions/linux-kernel-70/can-kernel-kill-long-running-process-561526/)

registering 06-13-2007 12:22 PM

Can kernel kill long-running process?
 
I've heard the kernel can kill a process that eats-up too much CPU time, and that it's configurable, however I don't see anything in sysctl that sounds similar. Anyone know if this feature exists? That is, I can tell the kernel "anything using more than 5 minutes CPU time, kill it"?

MensaWater 06-13-2007 01:23 PM

Yikes!!!

You could write a script to do that but it would be rather dangerous. Some things accumulate time throughout their lifecycle (monitoring tools are notorious for this) and killing them just because they had a lot of CPU time would hardly be reasonable.

You need to understand what is running on your system and determine impact of stopping it (and restarting if necessary). If you have commands that have a lot of CPU time it would be better to understand WHY they do (or accept that they do) than to kill them willy-nilly.

registering 06-13-2007 01:29 PM

I understand the repercussions of killing processes using various criteria. I was wondering if the kernel was capable of doing this via either a compile-time parameter or at runtime (e.g., via sysctl), similar to various 3rd party tools like NetIQ. Thanks.

sundialsvcs 06-14-2007 11:06 PM

The kernel would not do this on its own. A process with sufficient authority could be programmed to [tell the kernel to] do it.

syg00 06-14-2007 11:14 PM

Maybe you're thinking of the OOM_killer - but that's based on memory consumption, not CPU.

registering 07-20-2007 08:45 AM

For others searching for the same thing, I found the solution: ulimit -t can limit processes' CPU time.


All times are GMT -5. The time now is 09:55 PM.