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
Ïà¹ØÎĵµ£º
Service Discovery Protocol(SDP)ÌṩһÖÖÄÜÁ¦£¬ÈÃÓ¦ÓóÌÐòÓз½·¨·¢ÏÖÄÄÖÖ·þÎñ¿ÉÓÃÒÔ¼°ÕâÖÖ·þÎñµÄÌØÐÔ¡£
·þÎñ·¢ÏÖÐÒé(SDP»òBluetooth SDP)ÔÚÀ¶ÑÀÐÒéÕ»ÖжÔÀ¶ÑÀ»·¾³ÖеÄÓ¦ÓóÌÐòÓÐÌØÊâµÄº¬Ò⣬·¢ÏÖÄĸö·þÎñÊÇ¿ÉÓõĺÍÈ·¶¨ÕâЩ¿ÉÓ÷þÎñµÄÌØÕ÷¡£SDP¶¨ÒåÁËbluetooth client·¢ÏÖ¿ÉÓÃbluetooth server·þÎñºÍËüÃǵÄÌØÕ÷µÄ·½·¨¡£ ......
Ò»£ºÇ°ÑÔ
×î½üÔÚÑо¿androidµÄsensor driver£¬Ö÷ÒªÊÇE-compass£¬ÆäÖÐÓõ½ÁËLinux input×Óϵͳ.ÔÚÍøÉÏÒ²¿´Á˺ܶàÕâ·½ÃæµÄ×ÊÁÏ£¬¸Ð¾õ»¹ÊÇÕâƪ·ÖÎöµÄ±È½ÏϸÖÂ͸³¹£¬Òò´ËתÔØÒ»ÏÂÒÔ±ã×Ô¼ºÑ§Ï°£¬Í¬Ê±ºÍ´ó¼Ò·ÖÏí£¡
£¨Õâƪ²©¿ÍÖ÷ÒªÊÇÒÔ¼üÅÌÇý¶¯ÎªÀýµÄ£¬²»¹ý½²½âµÄÊÇLinux Input Subsystem£¬¿ÉÒÔ×ÐϸµÄÑо¿Ò»Ï£¡£©
¼üÅÌÇý¶¯½«¼ì ......
1.1 Óï·¨»ù±¾½éÉÜ
1.1.1 ¿ªÍ·
³ÌÐò±ØÐëÒÔÏÂÃæµÄÐпªÊ¼£¨±ØÐë·½ÔÚÎļþµÄµÚÒ»ÐУ©£º
#!/bin/sh
·ûºÅ#!ÓÃÀ´¸æËßϵͳËüºóÃæµÄ²ÎÊýÊÇÓÃÀ´Ö´ÐиÃÎļþµÄ³ÌÐò¡£ÔÚÕâ¸öÀý×ÓÖÐÎÒÃÇʹÓÃ/bin/shÀ´Ö´ÐгÌÐò¡£
µ±±à¼ºÃ½Å±¾Ê±£¬Èç¹ûÒªÖ´Ðиýű¾£¬»¹±ØÐëʹÆä¿ÉÖ´ÐС£
Ҫʹ½Å±¾¿ÉÖ´ÐУº
±àÒë chmod +x filename ÕâÑù²ÅÄÜÓÃ./filena ......
1.1.5 ShellÃüÁîºÍÁ÷³Ì¿ØÖÆ
ÔÚshell½Å±¾ÖпÉÒÔʹÓÃÈýÀàÃüÁ
1)Unix ÃüÁî:
ËäÈ»ÔÚshell½Å±¾ÖпÉÒÔʹÓÃÈÎÒâµÄunixÃüÁµ«ÊÇ»¹ÊÇÓÉһЩÏà¶Ô¸ü³£ÓõÄÃüÁî¡£ÕâЩÃüÁîͨ³£ÊÇÓÃÀ´½øÐÐÎļþºÍÎÄ×Ö²Ù×÷µÄ¡£
³£ÓÃÃüÁîÓï·¨¼°¹¦ÄÜ
echo "some text": ½«ÎÄ×ÖÄÚÈÝ´òÓ¡ÔÚÆÁÄ»ÉÏ
ls: ÎļþÁбí
wc –l filewc -w filewc -c fi ......
ÐźÅÊÇLinux±à³ÌÖзdz£ÖØÒªµÄ²¿·Ö£¬±¾ÎĽ«Ïêϸ½éÉÜÐźŻúÖƵĻù±¾¸ÅÄî¡¢Linux¶ÔÐźŻúÖƵĴóÖÂʵÏÖ·½·¨¡¢ÈçºÎʹÓÃÐźţ¬ÒÔ¼°ÓйØÐźŵļ¸¸öϵͳµ÷Óá£
ÐźŻúÖÆÊǽø³ÌÖ®¼äÏ໥´«µÝÏûÏ¢µÄÒ»ÖÖ·½·¨£¬ÐźÅÈ«³ÆΪÈíÖжÏÐźţ¬Ò²ÓÐÈ˳Æ×÷ÈíÖжϡ£´ÓËüµÄÃüÃû¿ÉÒÔ¿´³ö£¬ËüµÄʵÖʺÍʹÓúÜÏóÖжϡ£ËùÒÔ£¬ÐźſÉÒÔ˵Êǽø³Ì¿ØÖƵÄÒ ......