linux 0.11 ÄÚºËѧϰ sched.c£¬µ÷¶È½ø³Ì¡£
/*
* 2010-1-21
* ¸ÃÎļþʱÄÚºËÖÐÓйØÈÎÎñµ÷¶ÈµÄº¯Êý³ÌÐò£¬ÆäÖаüº¬»ù±¾º¯Êýsleep_on£¬
* wakeup£¬scheduleµÈ£¬ÒÔ¼°Ò»Ð©¼òµ¥µÄϵͳµ÷Óá£Í¬Ê±½«ÈíÅ̵ļ¸¸ö²Ù×÷
* º¯ÊýÒ²·ÅÖÃÔÚÕâÀï¡£
*
* scheduleº¯ÊýÊ×ÏȶÔËùÓеÄÈÎÎñ¼ì²é£¬»½ÐÑÈκÎÒ»¸öÒѾµÃµ½ÐźŵÄÈÎÎñ£¬
* ¾ßÌåµÄ·½·¨ÊÇÕë¶ÔÈÎÎñÊý×éÖеÄÿ¸öÈÎÎñ£¬¼ì²éÆ侯±¨¶¨Ê±Öµalarm¡£Èç¹ûÈÎÎñ
* µÄalarmÒѾ³¬ÆÚ£¨alarm < jiffies£©£¬ÔòÔÚËüµÄÐźÅλͼÖÐÉèÖÃSIGALARM£¬È»ºó
* ÇéÊéalarmÖµ¡£jiffiesÊÇϵͳ×Ô´Ó¿ª»úÖ®ºóËãÆðµÄµÎ´ðÊý¡£ÔÚscheed.hÖж¨Ò壬
* Èç¹û½ø³ÌÐźŵÄλͼÖгýÈ¥±»×èÈûµÄÐźÅÖ®Í⻹ÓÐÆäËûÐźţ¬²¢ÇÒÈÎÎñ´¦ÓÚ¿É
* ÖжÏ˯Ãß״̬£¬ÔòÖÃÈÎÎñΪ¾ÍÐ÷״̬¡£
* ËæºóÊǵ÷¶Èº¯ÊýµÄºËÐÄ´¦Àí£¬Õⲿ·Ö´úÂë¸ù¾Ý½ø³Ìʱ¼äƬºÍÓÅÏÈȨµÄµ÷¶È»úÖÆ£¬
* À´Ñ¡Ôñ½«ÒªÖ´ÐеijÌÐò¡£ËûÊ×ÏÈÊÇÑ»·¼ì²éÈÎÎñÊý×éÖеÄËùÓÐÈÎÎñ¡£¸ù¾Ýÿ¸ö¾ÍÐ÷
* ÈÎÎñÊ£ÓàÖ´ÐÐʱ¼äÖµcounterÖÐÑ¡È¡Ò»¸ö×î´óµÄ£¬ÀûÓÃswitch_toº¯ÊýÍê³ÉÈÎÎñ
* ת»»¡£Èç¹ûËùÓеľÍÐ÷ÈÎÎñµÄ¸ÃÖµ¶¼ÊÇ0£¬Ôò±íʾ´Ë¿ÌËùÓÐÈÎÎñµÄʱ¼äƬ¶¼ÒÑÔËÐÐÍê¡£
* ÓÚÊǾ͸ù¾ÝÈÎÎñµÄÓÅÏÈȨֵpriority£¬ÖØÖÃÿ¸öÈÎÎñµÄÔËÐÐʱ¼äcounter¡£ÔÚÖØÐÂ
* Ñ»·¼ì²éËùÓеÄÈÎÎñÖصÄÖ´ÐеÄʱ¼äƬֵ¡£
* ÁíÒ»¸öÖµµÃһ˵µÄÊÇsleep_onº¯Êý£¬¸Ãº¯ÊýËä¶Ì£¬È´Òª±Èscheduleº¯ÊýÄÑÀí½â£¬
* ¼òµ¥µÄ½²£¬sleep_onº¯ÊýÖ÷ÒªµÄ¹¦ÄÜÊǵ±Ò»¸ö½ø³ÌËùÇëÇóµÄ×ÊÔ´ÕýÔÚ棬»òÕßÊÇ
* ²»ÔÚÄÚ´æÖб»Çл»³öÈ¥£¬·ÅÔڵȴý¶ÓÁÐÖеȴýÒ»¶Îʱ¼ä¡£Çл»»ØÀ´ºóÔÚ¼ÌÐøÖ´ÐС£
* ·ÅÈëµÈ´ý¶ÓÁеķ½Ê½ÊÇ£¬ÀûÓÃÁ˺¯ÊýÖеÄtmpÖ¸ÕëΪ¸÷¸öÕýÔڵȴýÈÎÎñµÄÁªÏµ¡£
* »¹ÓÐÒ»¸öº¯Êýinterrupt_sleep_on£¬¸Ãº¯ÊýµÄÖ÷Òª¹¦ÄÜÊÇÔÚ½ø³Ìµ÷¶È֮ǰ£¬°Ñµ±Ç°
* ÈÎÎñÉèÖÃΪ¿ÉÖжϵȴý״̬£¬²¢ÔÚ±¾ÈÎÎñ±»»½ÐÑÖ®ºó»¹ÐèÒª²é¿´¶ÓÁÐÉÏÊÇ·ñ»¹ÓÐ
* ºóÀ´µÄµÈ´ýÈÎÎñ£¬Èç¹ûÓУ¬Ïȵ÷¶ÈËûÃÇ¡£
*
*/
/*
* linux/kernel/sched.c
*
* (C) 1991 Linus Torvalds
*/
/*
* 'sched.c' is the main kernel file. It contains scheduling primitives
* (sleep_on, wakeup, schedule etc) as well as a number of simple system
* call functions (type getpid(), which just extracts a field fr
Ïà¹ØÎĵµ£º
Boss˵£¬Òª¿´OpenGL£¬¿´ÁË¿ìÒ»¸öÔ£¬×ÜËã³öÁ˸öÏñÑùµÄ¶«Î÷£¬ÓÃCдÁ˸ö3DÃÔ¹¬£¬
ËäȻֻÓÐ350ÐÐ
´úÂ룬²»¹ý±ßѧ±ßд£¬×ã×ãдÁËÒ»ÖÜʱ¼ä£¬»¹ÊÇСÓгɾ͸еģ¬»î»î»î£¡
&n ......
Linux 2.6 ×Ö·ûÉ豸Çý¶¯³ÌÐò
¡ð¡¢ËµÃ÷
±Ê¼ÇÊÊÓÃÓÚLinuxµÄ2.6.10ÒÔºóµÄÄںˡ£
±Ê¼ÇÒÔLinux
Device
Driver3ÌṩµÄscull³ÌÐò(scullĿ¼ÖеÄmain.cºÍscull.h)Ϊ¼Ç¼Ö÷Ïߣ¬²¢ÒÔ¸ÃÇý¶¯³ÌÐòÖеĸ÷ÖÖϵͳµ÷Óúͺ¯Êýµ÷ÓÃÁ÷³ÌΪ¼Ç
¼˳Ðò¡£±ÈÈ磬module_init( )ºÍmodule_exit(
)ΪÏà¶ÔÓ¦µÄÒ»¶Ôϵͳµ÷Óã¬Ò»°ãÊé¼®Öж¼»á·ÅÔÚÒ ......
Íز¨±ü³Ð²»¶Ï¿ªÍؽøÈ¡µÄ¾«Éñ£¬ÔÚ¼¼ÊõÑз¢ºÍÖ§³ÖÉϲ»¶ÏµÄͶÈëÈËÁ¦ÎïÁ¦£¬Á¦ÇóÔÚ²»¶Ï±ä»¯µÄÊг¡ÐèÇóÖУ¬´ïµ½100%µÄ¿Í»§ÂúÒâ¶È¡£ÔÚ¸Õ¸Õ̤Èë2010Ä꣬¸ù¾Ý¹ýÍùµÄÊг¡µ÷²é£¬½áºÏ¿Í»§µÄÐèÇóºÍ½¨Ò飬Íز¨ÓʼþϵͳÍƳöÁËLinux_°²ÌÚ°æ±¾£¬×÷ΪдºË͸ø¹ã´ó¿Í»§µÄµÚÒ»·ÝÀñÎï¡£
°²ÌÚ´¦ÀíÆ÷ÊÇ×î½üÊ®Äê²ÅÖð½¥·¢Õ¹ÆðÀ´µ ......
1.1 coreÎļþµÄ¼òµ¥½éÉÜ
ÔÚÒ»¸ö³ÌÐò±ÀÀ£Ê±£¬ËüÒ»°ã»áÔÚÖ¸¶¨Ä¿Â¼ÏÂÉú³ÉÒ»¸öcoreÎļþ¡£coreÎļþ½ö½öÊÇÒ»¸öÄÚ´æÓ³Ïó(ͬʱ¼ÓÉϵ÷ÊÔÐÅÏ¢)£¬Ö÷ÒªÊÇÓÃÀ´µ÷ÊԵġ£
1.2 ¿ªÆô»ò¹Ø±ÕcoreÎļþµÄÉú³É
ÓÃÒÔÏÂÃüÁîÀ´×èֹϵͳÉú³ÉcoreÎļþ:
ulimit -c 0
Ò²¿ÉÒÔÐÞ¸ÄϵͳÎļþÀ´µ÷ÕûcoreÑ¡Ïî
ÔÚ/etc/profileͨ³£»áÓÐÕâÑùÒ»¾ä»°À´½ûÖ¹²úÉú ......
1.CPU&½ø³Ì
1.1 topÃüÁî
top - 20:07:00 up 186 days, 3:47, 3 users, load average: 0.01, 0.02, 0.00
Tasks: 82 total, 1 running, 80 sleeping, 1 stopped, 0 zombie
Cpu(s): 3.7% us, 0.0% sy, 0.0% ni, ......