¸úÎÒÒ»²½Ò»²½ÖÆ×÷Ò»¸ö»ù±¾µÄlinuxÆô¶¯ÅÌ
Ô´´ÎÄÕ£¬×ªÔØÇë×¢Ã÷³ö´¦£¬Ð»Ð»£¡
×÷ÕߣºÇåÁÖ£¬²©¿ÍÃû£º·É¿Õ¾²¶É
ÕâÊÇһƪ×Ô¼ººÜÔçдµÄÎÄÕÂÁË£¬µ±Ê±¸ù¾ÝÍøÉϵÄһЩ½Ì³ÌÒ»²½Ò»²½ÖÆ×÷£¬±¾À´Ïë°Ñ×Ô¼º×öµÄ¹ý³Ì·Åµ½ÍøÉÏ£¬¿ÉÒÔÎ÷һֵæÓÚ¹«Ë¾ÏîÄ¿£¬Ã»ÓÐʱ¼ä£¬È¥ÄêÏë·ÅÉÏÀ´µÄʱºò·¢ÏÖcsdnÉÏ´«²»ÁËͼƬ£¬ÎÒÏ룬ûÓÐͼƬµÄ½Ì³Ì¾Í²»½ÐÒ»²½Ò»²½µÄ½Ì³ÌÁË¡£ºÃÁË£¬ÏÂÃæÊÇÎÒÒ»²½Ò»²½ÖÆ×÷µÄlinuxµÄ¼òµ¥µÄÆô¶¯ÅÌ£¬¸´ÔÓһЩµÄÒÔºóÔÙд°É£¡
±¾ÎĽ«»áÒ»²½Ò»²½´Ó»ù´¡Òýµ¼´ó¼Ò¹¹½¨Ò»¸ölinuxÆô¶¯ÅÌ£¬ÔÚÕâ¸ölinuxÆô¶¯ÅÌÔÚÆô¶¯ºó¿ÉÒÔÔËÐÐÎÒÃÇÌض¨µÄ³ÌÐò£¬Íê³ÉÌض¨µÄ¹¦ÄÜ¡£±¾ÎÄÁ¦Çó¼òµ¥Ïêϸ£¬Ð´³öÖÆ×÷µÄÿһ²½£¬ÆäÖлᴩ²å¸÷ÖÖͼƬ£¬ÔÚÒýÓÃÆäËûÎÄÕÂʱ£¬»á°ÑÎÄÕÂÌù³öÀ´£¬Ê¹µÃ¶ÁÕß²»ÓÃÈ¥Á´½ÓÑ°ÕÒ£¬Ò²Í¬Ê±Ê¹µÃûÓÐÍøÂçµÄ¶ÁÕß¿ÉÒÔÊ¡È¥ÎÞÍøÂçÖ®Âé·³¡£Ê¹µÃ³õѧÕß¿ÉÒÔÕÕ×ÅÒ»²½Ò»²½µÄÍê³É£¬
±¾×Å×ðÖØÔ´´µÄ¾«Éñ£¬ÎÄÕÂÖÐÈç¹ûûÓÐÌØÊâ˵Ã÷£¬ÔòËùÓÐбÌåÎÄ×Ö¶¼Òý×ÔÆäËûÎÄÕµÄÄÚÈÝ£¬ÆäÖд󲿷ÖÀ´×Ô¡¶¾«Í¨initramfs¹¹½¨step by step¡·¡£
×¢£º±¾ÎIJο¼µÄÖ÷ÒªÁ½ÆªÎÄÕÂÊÇ¡¶¾«Í¨initramfs¹¹½¨step by step¡·ºÍ¡¶ÉîÈëÀí½â Linux 2.6 µÄ initramfs 機ÖÆ (ÉÏ)¡·£¬ÎÄÕÂÈç¹ûÒýÓõ½ÆäËûÎÄÕÂÔòÔÚÎÄÖÐ˵Ã÷¡£
¹¤×÷»·¾³£ºubuntu9.10£¬Á·Ï°ÓõÄÄÚºËÊÇlinux-2.6.31.tar.bz2£¬ubuntu9.10ĬÈϵÄÊÇgcc4.4£¬ÎÒÓõÄÊÇgcc4.3.4£¨¾ßÌåÐÞ¸Ägcc°æ±¾¿ÉÓÃupdate-alternativesÃüÁ¡£
Ò»¡¢ÖÆ×÷Ò»¸öÏÔʾhello worldµÄÆô¶¯linux
Ò»¡¢ initramfs ÊÇʲô
ÔÚ 2.6 °æ±¾µÄ linux ÄÚºËÖÐ,¶¼°üº¬Ò»¸öѹËõ¹ýµÄ cpio ¸ñʽ µÄ´ò°üÎļþ¡£µ±ÄÚºËÆô¶¯Ê±,»á´ÓÕâ¸ö´ò°üÎļþÖе¼³öÎļþµ½ÄÚºËµÄ rootfs Îļþϵͳ,È»ºóÄں˼ì²é rootfs ÖÐÊÇ·ñ°üº¬ÓÐ init Îļþ,Èç¹ûÓÐÔòÖ´ÐÐ Ëü,×÷Ϊ PID Ϊ 1 µÄµÚÒ»¸ö½ø³Ì¡£Õâ¸ö init ½ø³Ì¸ºÔðÆô¶¯ÏµÍ³ºóÐøµÄ¹¤×÷,°üÀ¨¶¨Î»¡¢¹ÒÔØ“ÕæÕýµÄ”¸ùÎļþϵͳÉ豸(Èç¹ûÓеĻ°)¡£Èç¹ûÄÚºËûÓÐÔÚ rootfs ÖÐÕÒµ½ init Îļþ,ÔòÄں˻ᰴÒÔÇ°°æ±¾µÄ·½Ê½¶¨Î»¡¢¹ÒÔظù·ÖÇø,È»ºóÖ´ÐÐ/sbin/init ³ÌÐòÍê³ÉϵͳµÄºóÐø³õʼ»¯¹¤×÷¡£
Õâ ¸öѹËõ¹ýµÄ cpio ¸ñʽµÄ´ò°üÎļþ¾ÍÊÇ initramfs¡£±àÒë 2.6 °æ±¾µÄ linux ÄÚºËʱ,±àÒëϵͳ×ܻᴴ½¨ initramfs,È»ºó°ÑËüÓë±àÒëºÃµÄ ÄÚºËÁ¬½ÓÔÚÒ»Æð¡£ÄÚºËÔ´´úÂëÊ÷ÖÐµÄ usr Ä¿Â
Ïà¹ØÎĵµ£º
×î½ü¶ÔLinuxµÄÏ߳̽ӿڽøÐÐÁËЩ×ܽᣬҲ²Î¿¼ÁËÍøÂçÉÏÐÖµÜÃǵÄһЩ×ÊÁÏ£¬×Ô¼ºÍ¬Ê±Ò²Ð´ÁËЩ³ÌÐò½øÐвâÊÔ£¬ÏȰѲο¼µÄ
×ÊÁÏÁгöÀ´°É
http://blog.mcuol.com/User/liuzhilii521/Article/12738_1.htm
ÏÂÃæÊÇÎÒµÄһЩÀí½â£º
pthread_key_create(pthread_key_t *key,void (*destructor)(void*))
destructorÕâ¸ö»Øµ÷º¯ÊýÔÚÏß³Ì ......
£¨1£©exit()Óë_exit()Çø±ð£º _exit()Ö±½Óʹ½ø³ÌÍ£Ö¹ÔËÐУ¬Çå³ýÆ÷ʹÓõÄÄÚ´æ¿Õ¼ä£¬Ïú»ÙÆäÔÚÄÚºËÖеĸ÷ÖÖÊý¾Ý½á¹¹¡£
exit()º¯ÊýÔÚµ÷ÓÃexitϵͳµ÷ÓÃ֮ǰҪ¼ì²éÎļþµÄ´ò¿ªÇé¿ö£¬°ÑÎļþ»º³åÇøÖеÄÄÚÈÝд»ØÎļþ£¬ÇåÀíI/O»º³å£¨ÍƼöʹÓÃÕâ¸öº¯Êý£©
£¨2£©waitpid
#include <sys/ ......
/bin ´æ·Å×î³£ÓõÄÃüÁ´ËĿ¼ÏµÄÃüÁîËùÓÐÓû§¶¼ÓÐÖ´ÐеÄȨÏÞ
/boot LinuxϵͳÒýµ¼Ä¿Â¼£¬´ËĿ¼±£´æϵͳÆô¶¯Ê±µÄÄÚºËÎļþºÍÄÚºËÓ³ÏñÎļþ¼°Æô¶¯Ê±ËùÐèµÄÆäËüÎļþ
/dev É豸Îļþ£¬±£´æËùÓеÄÓ²¼þÉ豸Îļþ£¬ÈçÓ²ÅÌÉ豸Îļþ£¬ÈíÇý¡¢¹âÇýÉ豸ÎļþµÈµÈ
/etc ......
´ÅÅ̵ÄIOÐÔÄÜÊǺâÁ¿¼ÆËã»ú×ÜÌåÐÔÄܵÄÒ»¸öÖØÒªÖ¸±ê¡£LinuxÌṩÁËiostatÃüÁîÀ´»ñÈ´´ÅÅÌÊäÈ룯Êä³ö£¨¼´IO£©Í³¼ÆÐÅÏ¢£¬WindowsÔòÌṩÁËWMI½Ó¿Ú£¬¿ÉÒÔͨ¹ý±àдһ¸ö¼òµ¥µÄ½Å±¾À´»ñÈ¡ÓëiostatÏ൱µÄ¹¦ÄÜ¡£
1¡¢LinuxϵÄiostatÃüÁî
iostat -d -k -t 2
ÿ¸ô2Ãëͳ¼ÆÒ»´Î´ÅÅÌIOÐÅÏ¢£¬Ö±µ½°´Ctrl+CÖÕÖ¹³ÌÐò£¬-d Ñ¡Ïî±íʾͳ¼Æ´ÅÅÌÐÅÏ¢ ......
Oracle°ïÄú׼ȷ¶´²ì¸÷¸öÎïÁ÷»·½Ú
ʹÓÃUbuntuÒ»¶Îʱ¼äºó£¬¾Í»á·¢¾õÓÉÓÚ×Ô¶¯Éý¼¶£¬ÏµÍ³Àï°²×°Á˺ܶàÄںˡ£ÏñÎÒ£¬¾¹È»°²×°ÁËÏÂÃæÄÇô¶à£¬Õâ¸öÔì³ÉÁËÂþ³¤µÄÆô¶¯ÁÐ±í¡£±ØÐëɾµôһЩ²»Óõġ£
Ê×ÏȾÍÊÇʹÓÃÈçÏÂÃüÁÁгöËùÓа²×°µÄÄںˣ¬Ï±íÖУ¬´øÓÐimageµÄ¾ÍÊÇÄÚºËÎļþ¡£´ÓÖÐÑ¡ÔñҪжÔصİü£¬ÓÃapt-getÀ´Ð¶ÔØ¡£
[tc@ibm:~ ......