自动终止消耗过多内存或在Linux上停顿的进程 [英] Automatically kill process that consume too much memory or stall on linux
本文介绍了自动终止消耗过多内存或在Linux上停顿的进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果有以下情况,我希望有一个系统"来监视进程并杀死该进程:
I would like a "system" that monitors a process and would kill said process if:
- 该过程超出了某些内存要求
- 该过程在一段时间内未响应来自系统"的消息
我认为这个系统"可以像监视过程一样简单吗?有关如何完成此操作的代码示例将很有用.对于这个问题,我当然不反对完全不同的解决方案.
I assume this "system" could be something as simple as a monitoring process? A code example of how this could be done would be useful. I am of course not averse to a completely different solution to this problem.
推荐答案
对于第一个要求,您可能需要使用ulimit
或对系统上的内核OOM-killer设置进行调整.
For the first requirement, you might want to look into either using ulimit
, or tweaking the kernel OOM-killer settings on your system.
也存在针对此类情况的监视守护程序. 上帝是最近的例子.
Monitoring daemons exist for this sort of thing as well. God is a recent example.
这篇关于自动终止消耗过多内存或在Linux上停顿的进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文