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

¡¶LinuxÐÔÄܼ°µ÷ÓÅÖ¸ÄÏ¡·£­£­£­£­1.1 Linux½ø³Ì¹ÜÀí

·­Ò룺·É¸ç (
http://hi.baidu.com/imlidapeng
)
°æȨËùÓУ¬×ðÖØËûÈËÀͶ¯³É¹û£¬×ªÔØʱÇë×¢Ã÷×÷ÕߺÍԭʼ³ö´¦¼°±¾ÉùÃ÷¡£
Ô­ÎÄÃû³Æ£º¡¶Linux Performance and Tuning Guidelines¡·
Ô­ÎĵØÖ·£ºhttp://www.redbooks.ibm.com/abstracts/redp4285.html
-------------------------------------------------------------------------------------------
1.1.1 ½ø³ÌÊÇʲô£¿
1.1.2 ½ø³ÌÉúÃüÖÜÆÚ
1.1.3 Ïß³Ì
1.1.4 ½ø³ÌÓÅÏȼ¶ºÍNiceÖµ
1.1.5 ÉÏÏÂÎĽ»»»
1.1.6 Öжϴ¦Àí
1.1.7 ½ø³Ì״̬
1.1.8 ½ø³ÌÄÚ´æ¶Î
1.1.9 CPUµ÷¶ÈÆ÷
-------------------------------------------------------------------------------------------
½ø³Ì¹ÜÀí¶ÔÓÚÈκÎÒ»¸ö²Ù×÷ϵͳÀ´Ëµ¶¼ÊÇ×îÖØÒªµÄÈÎÎñÖ®Ò»¡£¸ßЧµÄ½ø³Ì¹ÜÀíÄܱ£Ö¤Ó¦ÓÃƽÎÈÓÐЧµÄÔËÐС£LinuxµÄ½ø³Ì¹ÜÀíÓëUNIXÊ®·ÖÏàËÆ¡£Ëü°üÀ¨½ø³Ìµ÷¶È¡¢Öжϴ¦Àí¡¢Ðźŷ¢ËÍ¡¢½ø³ÌÓÅÏȼ¶¡¢½ø³ÌÇл»¡¢½ø³Ì״̬¡¢½ø³ÌÄÚ´æµÈ¡£ÔÚ±¾Õ½ÚÖУ¬ÎÒ½«ÌÖÂÛLinux½ø³Ì¹ÜÀíµÄÔ­Àí¡£ËüÄÜ°ïÖúÄã¸üºÃµÄÁ˽âLinuxÄÚºËÊÇÔõÑù¹ÜÀí½ø³ÌÀ´Ó°ÏìϵͳÐÔÄܵġ£
1.1.1 ½ø³ÌÊÇʲô£¿
½ø³Ì¾ÍÊÇÖ´ÐгÌÐòÔËÐÐÔÚ´¦ÀíÆ÷ÉϵÄÒ»¸öʵÀý¡£½ø³Ì¿ÉÒÔʹÓÃLinuxÄÚºËËùÄÜ¿ØÖƵÄÈκÎ×ÊÔ´À´Íê³ÉËüµÄÈÎÎñ¡£ËùÓÐÔËÐÐÔÚLinux²Ù×÷ϵͳÉϵĽø³Ì¶¼Ê¹ÓÃÒ»¸öÃû½Ðtask_structµÄ½á¹¹À´¹ÜÀí£¬Õâ¸ö½á¹¹Òà±»³Æ×÷½ø³ÌÃèÊö·û¡¾Process
Descriptor¡¿¡£½ø³ÌÃèÊö·û°üÀ¨½ø³ÌÔËÐеÄËùÓÐÐÅÏ¢Èç½ø³ÌID¡¢½ø³ÌÊôÐԺ͹¹½¨Õâ¸ö½ø³ÌËùÐèÒªµÄ×ÊÔ´¡£Èç¹ûÄãÇå³þ½ø³ÌµÄ½á¹¹£¬¾ÍÄÜÁ˽⵽ʲô¶ÔÓÚ
½ø³ÌÖ´ÐкÍЧÄÜÀ´ËµÊÇÖØÒªµÄ¡£Í¼1-2Õ¹ÏÖÁ˽ø³Ì½á¹¹µÄ¸ÅÒª¡£
ͼ 1-2 task_struct½á¹¹
1.1.2 ½ø³ÌÉúÃüÖÜÆÚ
ÿ¸ö½ø³Ì¶¼ÓÐ×Ô¼ºµÄÉúÃüÖÜÆÚÈç´´½¨¡¢Ö´ÐС¢½áÊøºÍÏû³ý¡£ÕâЩ½×¶ÎÔÚϵͳÆô¶¯ÔËÐÐÖлᱻÖظ´ÎÞÊý´Î¡£Òò´Ë´ÓÐÔÄܽǶÈÀ´¿´½ø³ÌÉúÃüÖÜÆÚÊǼ«ÆäÖØÒªµÄ¡£Í¼1-3չʾ½ø³ÌµäÐ͵ÄÉúÃüÖÜÆÚ
ͼ1-3½ø³ÌµäÐ͵ÄÉúÃüÖÜÆÚ
µ±½ø³Ì´´½¨Ò»¸öеĽø³Ì£¬´´½¨½ø³Ì£¨¸¸½ø³Ì£©·¢³öfork()ϵͳµ÷Óᣵ±Ò»¸öfork()ϵͳµ÷Óñ»·¢³ö£¬Ëü½«µÃµ½Ò»¸ö¹ØÓÚнø³Ì£¨×Ó½ø³Ì£©µÄ½ø
³ÌÃèÊö·û²¢ÉèÖÃÒ»¸öеĽø³ÌID¡£Ëü»á½«¸¸½ø³ÌµÄ½ø³ÌÃèÊö·ûÖÐËùÓÐÊý¾Ý¸´ÖƵ½×Ó½ø³Ì¡£´Ëʱ¸¸½ø³ÌµÄÕû¸öµØÖ·¿Õ¼ä²¢Ã»Óб»¸´ÖƵģ¬ËùÒÔ¸¸×Ó½ø³Ì»á¹²ÏíÏàͬµÄ
µØÖ·¿Õ¼ä¡£exec()ϵͳµ÷ÓûḴÖÆÒ»¸öеijÌÐòµ½×Ó½ø³ÌµÄµØÖ·¿Õ¼ä¡£ÒòΪ¸¸×Ó½ø³Ì¹²ÏíÏàͬµÄµØÖ·¿Õ¼ä£¬ËùÒÔµ±Ð³ÌÐòдÈëÊý¾Ýʱ»áµ¼Ö·ÖÒ³´íÎó¡¾page
fault¡¿µÄÀýÍâ·¢Éú¡£ÕâʱºòÄں˻á·ÖÅä¸ø×Ó½ø³ÌÒ»¸öÐ


Ïà¹ØÎĵµ£º

LinuxϱàÒ붯̬¿â£¬¾²Ì¬¿â£¬ÒÔ¼°µ÷ÓÃ

so_test.h£º
#include
#include
void test_a();
void test_b();
void test_c();
test_a.c£º
#include "so_test.h"
void test_a()
{
printf("this is in test_a...\n");
}
test_b.c£º
#include "so_test.h"
void test_b()
{
printf("this is in test_b...\n");
......

LinuxÇý¶¯µÄ±àÒëÓë¼ÓÔØ

±àÒëºÍ¼ÓÔØ
±¾Õ¿ªÍ·µÄ "hello world" Àý×Ó°üº¬ÁËÒ»¸ö¼ò¶ÌµÄ½¨Á¢²¢¼ÓÔØÄ£¿éµ½ÏµÍ³ÖÐÈ¥µÄÑÝʾ. µ±È», Õû¸ö¹ý³Ì±ÈÎÒÃÇÄ¿Ç°¿´µ½µÄ¶à. ±¾½ÚÌṩÁ˸ü¶àϸ½Ú¹ØÓÚÒ»¸öÄ£¿é×÷ÕßÈçºÎ½«Ô´Âëת»»³ÉÄÚºËÖеÄÔËÐеÄ×Óϵͳ.
2.4.1. ±àÒëÄ£¿é
µÚÒ»²½, ÎÒÃÇÐèÒª¿´Ò»ÏÂÄ£¿éÈçºÎ±ØÐë±»½¨Á¢. Ä£¿éµÄ½¨Á¢¹ý³ÌÓëÓû§¿Õ¼äµÄÓ¦ÓóÌÐòµÄ½ ......

Linux²Ù×÷ϵͳÖ÷»úÃû(hostname)¼ò˵£¨v0.1b£©


×÷Õߣº±±ÄÏÄϱ±
À´×Ô£ºLinuxSir.Org
ÕªÒª£º±¾ÎÄÊǹØÓÚLinux²Ù×÷ϵͳÖ÷»úÃû(hostname)µÄÎĵµ£¬¶ÔÖ÷ÒªÅäÖÃÎļþ/etc/hosts½øÐмòÒªµÄ˵Ã÷ £»ÁíÍâ¶Ô»ùÅä¾ß¹¤¾ßhostnameÒ²½øÐÐÁ˾ÙÀý˵Ã÷£» »¶Ó­¸ßÊÖ¸«Õý£¬Ð»Ð»£»
Ŀ¼
 
2.1 Ö÷»úÃûÅäÖÃÎļþ /etc/hosts½â˵£»
2.2 Ö÷»úÃû(hostname)ºÍÓòÃû(Domain£©µÄÇø±ð£»
......

LinuxÍøÂç½Ø°ü²»ÍêÈ«ÕûÀí

ÍøÂç½Ø°üÊÇÒ»ÏîºÜÓÐÒâ˼µÄ¿ÎÌ⣬¿ÉÒÔÓÐÊý¾Ý¹ýÂË£¬·À»ðǽ£¬Á÷Á¿¿ØÖÆ£¬±¨ÎĴ۸ĵÈÖî¶àÓ¦Ó㬰´ÕÕÄں˷ֲã¼Ü¹¹½«Ò»Ð©½Ø°ü·½·¨²»ÍêÈ«ÕûÀíÈçÏ£¬»¶Ó­²¹³ä¡£
1¡¢ L1²ãÇý¶¯½Ø°ü·¨
    ÔÚÇý¶¯ÖÐÏÂÊÖÓ¦¸Ã¿ÉÒÔ˵ÊÇ×îÌù½üµ×²ãµÄ£¬Íø¿¨Çý¶¯ÖÐ×ÜÓÐrx½ÓÊÕºÍxmit·¢Ëͺ¯Êý£¬²ÎÊý×ÜÊÇsk_buffer£¬ÔÚÕâÀïÐ޸ĺܻƺܱ©Á¦£¬¶øÇÒ ......

times(2) Linux man page

Name
times - get process times
Synopsis
#include <sys/times.h>
clock_t times(struct tms *buf);
Description
times() stores the current process times in the
struct tms that buf points to. The struct tms is as defined
in <sys/times.h>
:
struct tms {
clock_t tms_utime; /* us ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ