Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

ǶÈëʽLinuxÎïÀíÄÚ´æÓ³Éä

The physical memory map for Linux is completely independent from the virtual map and is designed to maximize contiguous space. Given that the kernel image will always be at the start of DRAM, the Linux kernel maximizes contiguous space by allocating runtime memory from the end of physical DRAM moving downward.
The kernel starts by breaking available memory out into large, contiguous blocks (typically 4MB or more).It then maintains memory using the buddy system, where physical memory is always allocated in combinations of blocks of 2^n pages (where n is the order, that is, 4K is a 0 order block, 8K is a 1st order block, 16K is a 2nd order block, etc).
    LinuxÎïÀíÄÚ´æµÄÓ³ÉäÍêÈ«¶ÀÁ¢ÓÚÐéÄâÄÚ´æµÄÓ³É䣬¶øÇÒ¾¡¿ÉÄÜÓ³Éäµ½Á¬ÐøµÄ¿Õ¼ä¡£¼Ù¶¨ÄÚºËÓ³Ïñ×ÜÊÇλÓÚDRAMµÄ¿ªÊ¼´¦£¬LinuxÄں˾¡¿ÉÄÜÈÿռäÁ¬Ðø£¬ÕâÊÇͨ¹ý´ÓÎïÀíDRAMµÄÄ©¶ËÏòÏÂÒƶ¯À´·ÖÅäÔËÐÐʱÄÚ´æ¶ø´ïµ½µÄ¡£
   ÄÚºËÒ»¿ªÊ¼°Ñ¿ÉÓÃÄÚ´æ·Ö¸îΪ´ó¶øÁ¬ÐøµÄ¿é£¨Í¨³£Îª4MB »ò¸ü¶à£©¡£´Ëºó£¬ÄÚºËÀûÓûï°éËã·¨À´¹ÜÀíÄڴ棬ÕâÀÎïÀíÄÚ´æµÄ·ÖÅä×ÜÊÇ2^n¸öÒ³ËùÐγɿéµÄ×éºÏ£¨ÕâÀnÊÇÃÝ£¬4k¾ÍÊÇÃÝΪ0µÄ¿é£¬8KÊÇÃÝΪ1¿é£¬16KΪÃÝΪ2µÄ¿é£¬Èç´ËµÈµÈ£©¡£
   
             
When physical memory is allocated, that is, on process start, or when malloc’ed memory is written to (copy-on-write), the kernel scans for the smallest order block that will fill fit starting from the top of DRAM. As the number of running processes increases, or new allocations are spawned from drivers or processes, the physical memory used grows downward.
µ±ÎïÀíÄÚ´æ·ÖÅäʱ£¬Ò²¾ÍÊÇÔÚ½ø³Ì¸Õ¿ªÊ¼Ê±£¬»òÕß˵µ±·ÖÅäµÄÄڴ汻дÈëʱ£¨Ð´Ê±¸´ÖÆ£©£¬ÄÚºËɨÃè×îСÃݴεĿ飨´ÓDRAM¶¥²¿¿ªÊ¼Ñ°ÕÒ×îºÏÊʵģ©¡£Ëæ׎ø³ÌÊýµÄÔö¼Ó£¬»òÕßÀ´×ÔÇý¶¯³ÌÐò»ò½ø³ÌзÖÅäµÄÂûÑÓ£¬ËùʹÓõÄÎïÀíÄÚ´æÏòÏÂÑÓÉì¡£
When a process exits or a large enough memory block is freed, its DRAM space is unmapped and becomes a gap in memory. This process is called memory fragmentation and becomes more and more prevalent the longer a device is used and the more frequently


Ïà¹ØÎĵµ£º

Linux²Ù×÷ϵͳÏÂÈýÖÖÅäÖû·¾³±äÁ¿µÄ·½·¨


ÏÖÔÚʹÓÃlinuxµÄÅóÓÑÔ½À´Ô½¶àÁË£¬ÔÚlinuxÏÂ×ö¿ª·¢Ê×ÏȾÍÊÇÐèÒªÅäÖû·¾³±äÁ¿£¬ÏÂÃæÒÔÅäÖÃjava»·¾³±äÁ¿ÎªÀý½éÉÜÈýÖÖÅäÖû·¾³±äÁ¿µÄ·½·¨¡£
 
1.ÐÞ¸Ä/etc/profileÎļþ
Èç¹ûÄãµÄ¼ÆËã»ú½ö½ö×÷Ϊ¿ª·¢Ê¹ÓÃʱÍƼöʹÓÃÕâÖÖ·½·¨£¬ÒòΪËùÓÐÓû§µÄshell¶¼ÓÐȨʹÓÃÕâЩ»·¾³±äÁ¿£¬¿ÉÄÜ»á¸øϵͳ´øÀ´°²È«ÐÔÎÊÌâ¡£
 
(1)Ó ......

linux½ø³Ì¿ØÖÆ£­wait£¨£©

http://blog.chinaunix.net/u1/53053/showart_425197.html
#include <sys/types.h> /* ÌṩÀàÐÍpid_tµÄ¶¨Òå */
#include <sys/wait.h>
pid_t wait(int *status)

½ø³ÌÒ»µ©µ÷ÓÃÁËwait£¬¾ÍÁ¢¼´×èÈû×Ô¼º£¬ÓÉwait×Ô¶¯·ÖÎöÊÇ·ñµ±Ç°½ø³ÌµÄij¸ö×Ó½ø³ÌÒѾ­Í˳ö£¬Èç¹ûÈÃËüÕÒµ½ÁËÕâÑùÒ»¸öÒѾ­±ä³É½©Ê¬µÄ×Ó½ø³Ì£¬wai ......

linux C ±à³Ì»·¾³µÄ×齨

ÓüÇʱ¾Ð´C³ÌÐò£¬²¢±àÒë¡£    ¸Õ×°ºÃµÄϵͳ
ÖÐÒѾ­ÓÐGCCÁË£¬µ«ÊÇÕâ¸öGCCʲôÎļþ¶¼²»ÄܱàÒ룬ÒòΪûÓÐһЩ±ØÐëµÄÍ·Îļþ£¬ËùÒÔÒª°²×°build-essentialÕâ¸öÈí¼þ
°ü£¬°²×°ÁËÕâ¸ö°ü»á×Ô¶¯°²×°ÉÏg++,libc6-dev,linux
-libc-dev,libstdc++6-4.1-devµÈһЩ±ØÐëµÄÈí¼þºÍÍ·ÎļþµÄ¿â¡£
    ¿ÉÒÔÔÚÐÂÁ¢µÃÀïÃæË ......

linux c socket ¿ª·¢Óë±àÒëʵÀý

ÕâƪÈÕÖ¾»¹ÊÇÏÈ´ÓÒ»¸öÄܹ»ÔËÐÐÆðÀ´µÄÀý×Ó³ö·¢£¬Ò»µ©ÄÜ˳ÀûµÄ¿´µ½³ÌÐòµÄ³É¹¦ÔËÐУ¬ÄÇô½ÓÏÂÀ´µÄʼþÎÒÏëÓ¦¸ÃÊÇÎÊΪʲôÁË£¿ËƺõÕâÑù¸ü¼ÓÈÝÒ×Àí½âºÍÕÆÎÕ¡£
¶ÔÓÚsocket³ÌÐòµÄ¸ÅÄîÕâÀï¾Í²»¶àдÁË£¬µ«ÎÒÏàÐÅ£¬Èç¹ûÄÜ¿´ÍêÕâÕûƪÎÄÕ£¬ÎÒÏàÐŲ»»áÔÙÓÐÕâÑùµÄÒÉÎʵġ£
ÏÂÃ潫±àдһ¸öc/s½á¹¹µÄ³ÌÐò£¬Ö÷Òª¹¦ÄÜÊÇclient½«Ïòserver·¢Ë ......

LinuxÏÂC¿ª·¢Ö®gcc,gdbµÄʹÓÃ

gcc£¬gdbµÄʹÓÃ
×÷Õߣºzccst
 
ÉÏÖÜÎåÔÚͼÊé¹Ý½èÁËÒ»±¾¡¶LinuxÈí¼þ¹¤³Ìʦ£¨CÓïÑÔ£©ÊµÓý̡̳·£¬ÈÃÎÒÊÕ»ñÁ¼¶à¡£²»½ö½öÊÇÊéÖеÄ֪ʶ£¬»¹ÓжÔ֪ʶÌåϵºÍ¼Ü¹¹ÈÏʶµÄÉîÈë¡£
 
LinuxÏÂC¿ª·¢£º
1£¬gcc,gdbµÄʹÓá£
2£¬MakefileÎļþµÄ±àд¡£
3£¬ÏµÍ³º¯ÊýµÄʹÓÃ
4£¬Îļþ²Ù×÷
5£¬´®ÐÐͨÐÅ
6£¬½ø³Ì¿ØÖÆ
7£¬½ø³Ì¼ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ