ZZ: When Linux Runs Out of Memory (OOM killer)
When Linux Runs Out of Memory
http://linuxdevcenter.com/pub/a/linux/2006/11/30/linux-out-of-memory.html?page=1
Perhaps you rarely face it, but once you do, you surely know what's
wrong: lack of free memory, or Out of Memory (OOM). The results are
typical: you can no longer allocate more memory and the kernel kills a
task (usually the current running one). Heavy swapping usually
accompanies this situation, so both screen and disk activity reflect
this.
At the bottom of this problem lie other questions: how much memory
do you want to allocate? How much does the operating system (OS)
allocate for you? The basic reason of OOM is simple: you've asked for
more than the available virtual memory space. I say "virtual" because
RAM isn't the only place counted as free memory; any swap areas apply.
Exploring OOM
Ïà¹ØÎĵµ£º
1. ѧ»áд¼òµ¥µÄmakefile
2. ±àһЩӦÓÃ
³ÌÐò
£¬¿ÉÒÔÓÃmakefileÅÜÆðÀ´
3. ѧ»áдÇý¶¯
µÄmakefile
4. дһ¼òµ¥charÇý¶¯£¬makefile±àÒëͨ¹ý£¬¿ÉÒÔinsmod£¬ lsmod£¬ rmmod. ÔÚÇý¶¯µÄinitº¯ÊýÀï´òÓ¡hello world£¬insmodºóÓ¦¸ÃÄܹ»Í¨¹ýdmesg¿´µ½Êä³ö
¡£
5. дһÍêÕûÇý¶¯£¬ ¼ÓÉÏread£¬ write£¬ ioctl£¬ pollingµÈ¸ ......
ÒëÕߣº¹ùÉÙ±¯
2009/12/02
ÔÎÄ£ºlinux/Documentation/driver-model/device.txt
»ù±¾µÄÉ豸Êý¾Ý½á¹¹
~~~~~~~~~~~~~~~~~~
struct device {
struct list_head g_list;
struct list_head node;
......
˵Ã÷1£º
ÎÄ×ÖÖеÄY±íʾѡÔñ½øÄںˡ£M±íʾ±à³ÉÄ£¿é¡£N±íʾ²»Ñ¡Ôñ¡£ÓеÄÖ»ÄÜÑ¡Y£¬ÓеÄÖ»ÄÜÑ¡M¡£
ÔÚmake menuconfig Ï£¬£ª±íʾY£¬M±íʾM£¬¿Õ°×±íʾN¡£
make xconfigÏ£¬√ ±íʾY£¬? ±íʾM£¬¿Õ°×±íʾN¡£
˵Ã÷2£º
²Ëµ¥ÖУ¬ÓеÄÑ¡ÏîÄãÑ¡ÁËY²Å³öÏÖ£¬ÓеÄÑ¡ÁËY£¬Ëü·´¶ø²»»á³öÏÖ¡£ÓеÄÑ¡Ïî¸ù±¾²»»áÌṩѡÔñ¡£ËùÒÔÎÒÌṩµ ......
Ëæ×ÅLinuxÓ¦ÓõÄÀ©Õ¹Ðí¶àÅóÓÑ¿ªÊ¼½Ó´¥Linux£¬¸ù¾ÝѧϰWindwosµÄ¾ÑéÍùÍùÓÐһЩãȻµÄ¸Ð¾õ£º²»Öª´ÓºÎ´¦¿ªÊ¼Ñ§Æð¡£ÕâÀï½éÉÜѧϰLinuxµÄһЩ½¨Òé¡£
Ò»¡¢´Ó»ù´¡¿ªÊ¼£º³£³£ÓÐЩÅóÓÑÔÚLinuxÂÛ̳ÎÊһЩÎÊÌ⣬²»¹ý£¬ÆäÖдó¶àÊýµÄÎÊÌâ¶¼ÊǺܻù´¡µÄ¡£ÀýÈ磺ΪʲôÎÒʹÓÃÒ»¸öÃüÁîµÄʱºò£¬ÏµÍ³¸æËßÎÒÕÒ²»µ½¸ÃĿ¼£¬ÎÒÒªÈçºÎÏÞÖÆÊ¹ÓÃÕß ......
ÎÞÂÛÊÇVC»¹ÊÇVB£¬»¹ÊÇC#£¬»¹ÊÇJSP PHPµÈµÈÓïÑÔ£¬ÔÚѧϰËûÃÇ֮ǰ×ÜÊÇÏÈÀ´Ò»¸öHELLO
WORLDµÄÀý×Ó£¬Õâ¸öºÃÏñ³ÉÁËÎÒÃdzÌÐòÈëÃŵıؾ֮·¡£ËùÒÔÔÚÇý¶¯³ÌÐòµÄѧϰÉÏ£¬Ò²Àë²»¿ªÕâ¸ö²½Öè¡£µ«ÊÇÇý¶¯³ÌÐòµÄ¿ª·¢ÊÇÔËÐÐÔÚÄں˿ռäµÄ£¬¶øÓ¦ÓóÌÐò
ÊÇÔËÐÐÔÚÓû§¿Õ¼äµÄ£¬ËùÒÔÇý¶¯³ÌÐòµÄ¿ª·¢ºÐµ÷ÊÔºÍÓ¦ÓóÌÐòµÄ¿ª·¢¶¼ÓкܴóµÄÇø±ð¡£¶ÔÓÚÕ ......