OOM killer
来源:互联网 发布:j2ee会用到java吗 编辑:程序博客网 时间:2024/05/01 20:09
Thomas Habets had an unfortunate experience recently. His Linux system ran out of memory, and the dreaded "OOM killer" was loosed upon the system's unsuspecting processes. One of its victims turned out to be his screen locking program, leaving his session open to whoever might happen to walk by. His response was the oom_pardon patch, which allows the system administrator to exempt certain processes from the OOM killer's revenge. It turns out that SUSE has a similar patch which allows administrators to set the "OOM score" of specific processes, increasing or decreasing their chances of being chosen for an untimely demise.
The OOM killer exists because the Linux kernel, by default, can commit to supplying more memory than it can actually provide. Overcommitting memory in this way allows the kernel to make fuller use of the system's resources, because processes typically do not use all of the memory they claim. As an example, consider the fork() system call, which copies all of a process's memory for the new child process. In fact, all it does is to mark the memory as "copy on write" and allow parent and child to share it. Should either change a page shared in this way, a true copy is made. In theory, the kernel could be called upon to copy all of the copy-on-write memory in this way; in practice, that does not happen. If the kernel reserved all of the necessary virtual memory (which includes swap space), some of that space would certainly go unused. Rather than waste that space - and fail to run programs or memory allocations that, in practice, it could have handled - the kernel overcommits itself and hopes for the best.
When the best does not happen, the OOM killer comes into play; its job is to kill processes and free up some memory. Getting it to kill the right processes has been an ongoing challenge, however. One person's useless memory hog is another's crucial application. Thus, over the years, numerous efforts have been made to refine the OOM killer's heuristics, and patches like "oom_pardon" have been created.
Not everybody agrees that this is a fruitful use of developer time. Andries Brouwer came up with this analogy:
Overcommitting memory and fearing the OOM killer are not necessary parts of the Linux experience, however. Simply setting the sysctl parameter vm/overcommit_memory to 2 turns off the overcommit behavior and keeps the OOM killer forever at bay. Most modern systems should have enough disk space to provide an ample swap file for most situations. Rather than trying to keep pet processes from being killed when overcommitted memory runs out, it might be easier just to avoid the situation altogether.
come from: http://lwn.net/Articles/104179/
- OOM killer
- oom killer
- OOM Killer
- oom-killer
- oom-killer
- OOM Killer
- oom-killer
- OOM killer
- OOM-killer
- linux oom killer
- Taming the OOM killer
- OOM(out_of_memory) killer分析
- 关于OOM-killer
- Linux OOM-killer
- OOM(out_of_memory) killer分析
- OOM killer分析
- OOM(out_of_memory) killer分析
- 关闭oom killer
- Delphi 7.0常用函数速查手册
- 浮躁
- 获取网站来源,以及搜索引擎来源的关键字
- 我们工作到底为了什么
- linu下安装java开发环境及部署JBOSS服务器
- OOM killer
- 明辨值类型和引用类型的使用场合
- 责任与创新并存 摩卡软件引领中国IT运维
- 社会生存的75条忠告
- UVa 10132 - File Fragmentation
- 什么意思,google也没找到
- 情侣间搞笑短信
- MySQL+DRBD+HeartBeat实现高可用性
- DropDownList 确认提示后在提交(__doPostBack)