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

תÌù£ºÊóÑÛ¿´Linuxµ÷¶ÈÆ÷ £¨2£©

ת×Ô  http://hi.baidu.com/grantzhou/blog/item/56a91cf3b685cdc90a46e09d.html
ËÄ¡¢sched_setscheduler()ϵͳµ÷Óá£
Õâ¸öϵͳµ÷Óõĵ÷Óòã´ÎºÍ´úÂ붼±Ènice¸´ÔÓЩ£¬ËùÉæ¼°µÄÒ²Óв»ÉÙÎÒÃÇÕâÀï²»¸ÐÐËȤµÄ¶«Î÷£¬Òò´Ë¾Í²»ÔÙÒÔչʾ´úÂëµÄ·½·¨½éÉÜËüÃÇÁË¡£ÕâÀï½öÔÚ¹¦Äܲã´ÎÉÏ£¬´ÓÓënice()¶Ô±ÈµÄ½Ç¶ÈÉ϶ÔËü×öÒ»¸ö¼òÒª½éÉÜ£º
1¡¢ÒòΪsched_setscheduler()ϵͳµ÷Óò»½ö¿ÉÒÔÐ޸ĵ±Ç°ÈÎÎñµÄµ÷¶È²ßÂÔºÍÓÅÏȼ¶£¬»¹¿ÉÒÔÐÞ¸ÄÖ¸¶¨ÈÎÎñµÄÕâ¸öÐÅÏ¢¡£ËùÒÔ£¬ËüµÄºÏ·¨ÐÔ¼ì²é¸üÑϸñЩ£¬×îÖØÒªµÄÊÇÔö¼ÓÁËÓû§Éí·ÝÑéÖ¤£¬µ±È»Õâ¸ö¼ì²éÒÀ¾ÉÊÇÔÚtask_struct½á¹¹ÉÏ×öµÄ¡£
2¡¢ºÍnice()Ò»Ñù£¬sched_setscheduler()Ò²²»ÌرðÇø·Ö½ø³ÌºÍỊ̈߳¬½«Á½Õß×÷µÈͬ´¦Àí£¬¸ÃÈÎÎñÒ²»áÓÐÖØмÓÈëÔËÐжÓÁеÄÐÐΪ¡£
3¡¢sched_setscheduler()Ö»Ð޸Ķ¯Ì¬ÓÅÏȼ¶£¬¶ÔÓÚĬÈϵ÷¶È²ßÂÔ£¬Ëü±»ÉèÖÃΪÓ뾲̬ÓÅÏȼ¶ÏàµÈ¡£
Îå¡¢¾²Ì¬ÓÅÏȼ¶ÀïµÄèÄå¡£
˵ÁËÕâô¶à¾²Ì¬ÓÅÏȼ¶ÈçºÎÈçºÎ£¬Ëüµ½µ×ÊǸöʲôÍæÒâ¶ù£¿ÏÖÔÚ¾ÍÈÃÎÒÃÇ°þµôÆäÉÏËùÓпÉÄܵÄ"ºÄ×ÓÒ©"£¬ÅªÇå³þËüµ½µ×ÊÇÔõÑùÓ°Ïì½ø³ÌµÄ¡£"¾²Ì¬ÓÅÏȼ¶"£¬Ö®ËùÒÔ¹ÚÖ®ÒÔ"¾²Ì¬"ǰ׺£¬ÊÇÒòΪÄÚºË×Ô¼º´Ó²»Ö÷¶¯ÐÞ¸ÄËü£¬Ö»ÓÐͨ¹ýϵͳµ÷ÓòÅÄÜÐÞ¸ÄËü¡£ÄÇô£¬ËüÔÚµ÷¶ÈÀïµ½µ×°çÑÝʲô½ÇÉ«ÄØ£¿ÈÝ°³×ÐϸµÀÀ´£º
1¡¢¼ÆËãÈÎÎñʱ¼äƬ¡£
ÈôúÂë˵»°£¬ÏÈ¿´task_timeslice()ʵÏÖ£º
/*
* task_timeslice() scales user-nice values [ -20 ... 0 ... 19 ]
* to time slice values: [800ms ... 100ms ... 5ms]
*
* The higher a thread's priority, the bigger timeslices
* it gets during one round of execution. But even the lowest
* priority thread gets MIN_TIMESLICE worth of execution time.
*/
#define SCALE_PRIO(x, prio) \
max(x * (MAX_PRIO - prio) / (MAX_USER_PRIO/2), MIN_TIMESLICE)
static inline unsigned int task_timeslice(task_t *p)
{
if (p->static_prio < NICE_TO_PRIO(0))
return SCALE_PRIO(DEF_TIMESLICE*4, p->static_prio);
else
return SCALE_PRIO(DEF_TIMESLICE, p->static_prio);
}
´ÓÃû×ÖÉÏÒ²¿´µÃ³öÀ´£¬Õâ¸öº¯Êý¾ÍÊÇÓÃÀ´¼ÆËãÈÎÎñʱ¼äƬµÄ¡£Ò»°ã˵À´£¬Ö»ÓÐÔÚʱ¼äƬÏûºÄ¹âµÄʱºò²ÅÖØмÆËãÈÎÎñµÄʱ¼äƬ£¬¶øÕâ¸ö¼ÆËã¹ý³ÌÖ»Ó뾲̬ÓÅÏȼ¶Óйء£Õâ¸öº¯ÊýµÄÂß¼­ºÜ¼òµ¥£¬Èç¹ûÈÎÎñpµÄniceÖµ<0£¨Ò²¾ÍÊÇ˵¾²Ì¬ÓÅÏÈ


Ïà¹ØÎĵµ£º

linux ÄãÊÇÎÒµÄÏ£Íû

ÎÒÊÇÒ»¸öƽ·²µÄÈí¼þ¹¤³Ìʦ
һֱϣÍû¹ú²úÈí¼þÄܹ»´ó·ÅÒì²Ê
¿ÉÕýËùνϣÍûÔ½´ó£¬Ê§ÍûÒ²Ô½´ó
Ô½À´Ô½¸Ð¾õµ½ÒªÏë°ÑÈí¼þ×ö´ó×öÇ¿
ʵÔÚÊÇÌ«ÄÑÌ«ÄÑÁË
ÓÞÃÁÈçÎÒÔõôҲ¿´²»µ½¹âÃ÷µÄ´óµÀ
¿ÉÊÇÄѾͲ»×öÁË
¶àÉÙÖÇÕߣ¬×ÜÊÇ¿´×¼ÁËÒ»¸ö·½Ïò£¬¼á³ÖÔÚÒ»¸öСµÄÁìÓò×öϸ×öר×öÇ¿.......
linux¸øÁ˺ܶàÈËÒ»¸öÏ£Íû£¬¿ªÔ´µÄÊÀ½çÈúܶàÈËÈç³Õ ......

Linux ÐÞ¸ÄIP¡¢DNSºÍ·ÓÉÅäÖÃ

ÔÚLinux²Ù×÷ϵͳÏÂÐÞ¸ÄIP¡¢DNSºÍ·ÓÉÅäÖà
¡¡¡¡ifconfig eth0 ÐÂip
¡¡¡¡È»ºó±à¼­/etc/sysconfig/network-scripts/ifcfg-eth0£¬ÐÞ¸Äip
¡¡¡¡Ò»¡¢ÐÞ¸ÄIPµØÖ·
¡¡¡¡[aeolus@db1 network-scripts]$ vi ifcfg-eth0
¡¡¡¡DEVICE=eth0
¡¡¡¡ONBOOT=yes
¡¡¡¡BOOTPROTO=static
¡¡¡¡IPADDR=219.136.241.211
¡¡¡¡NETMASK=255 ......

LinuxÄÚ´æ¹ÜÀí ÄÚ´æ·ÖÅ亯ÊýµÄÑ¡Ôñ

ÄÚ´æ·ÖÅ亯ÊýµÄÑ¡Ôñ
 
Èç¹ûÄãÐèÒªÁ¬ÐøµÄÎïÀíÒ³£¬¾Í¿ÉÒÔʹÓÃij¸öµÍ¼¶Ò³·ÖÅäÆ÷»òÕßkmalloc()¡£ÕâÊÇÄÚºËÖÐÄÚ´æ·ÖÅäµÄ³£Ó÷½Ê½£¬Ò²ÊÇ´ó¶àÊýÇé¿öÏÂÄã×Ô¼ºÓ¦¸ÃʹÓõÄÄÚ´æ·ÖÅ䷽ʽ¡£´«µÝ¸øÕâЩº¯Êý×î³£ÓõÄÁ½¸ö±êÖ¾ÊÇGFP_AUTOMICºÍGFP_KERNEL¡£GFP_AUTOMIC±íʾ½øÐв»Ë¯ÃߵĸßÓÅÏȼ¶·ÖÅä¡£ÕâÊÇÖжϳÌÐòºÍÆäËû²»ÄÜ˯ÃߵĴúÂë¶ ......

Linux ÖÐÈçºÎ²éѯºÍжÔØÒÑ°²×°µÄÈí¼þ

Linux ÖÐÈçºÎ²éѯºÍжÔØÒÑ°²×°µÄÈí¼þ
¡¡¡¡LinuxÈí¼þµÄ°²×°ºÍжÔØÒ»Ö±ÊÇÀ§ÈÅÐí¶àÐÂÓû§µÄÄÑÌâ¡£ÔÚWindowsÖУ¬ÎÒÃÇ¿ÉÒÔʹÓÃÈí¼þ×Ô´øµÄ°²×°Ð¶ÔسÌÐò»òÔÚ¿ØÖÆÃæ°åÖеēÌí¼Ó/ɾ³ý³ÌÐò” À´ÊµÏÖ¡£ÓëÆäÏàÀàËÆ£¬ÔÚLinuxÏÂÓÐÒ»¸ö¹¦ÄÜÇ¿´óµÄÈí¼þ°²×°Ð¶Ôع¤¾ß£¬ÃûΪRPM¡£Ëü¿ÉÒÔÓÃÀ´½¨Á¢¡¢°²×°¡¢²éѯ¡¢¸üС¢Ð¶ÔØÈí¼þ¡£¸Ã¹¤ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ