Linux½ø³Ì¹ÜÀíÖ®CFSµ÷¶ÈÆ÷·ÖÎö
------------------------------------------
±¾ÎÄϵ±¾Õ¾Ô´´,»¶ÓתÔØ!
תÔØÇë×¢Ã÷³ö´¦:http://ericxiao.cublog.cn/
------------------------------------------
Ò»:Ç°ÑÔ
CFSµ÷¶ÈÔÚ2.6.23°æ±¾µÄkernelÖб»¼ÓÈë.ÒýÓÃIngo
MolnarµÄÒ»¾ä»°:80%µÄÉè¼Æ¿ÉÒÔÓÃÒ»¾ä»°À´¸ÅÀ¨:CFSÖÐÒ»¸ö”ÀíÏëµÄ¶àÈÎÎñ´¦ÀíÆ÷”.Ò²´Ó¸Ã°æ±¾¿ªÊ¼,linuxµÄµ÷¶È²¿·Ý²ÉÓÃÄ£¿é»¯Éè¼Æ.ÎÒ
ÃÇÔÚ½ÓÏÂÀ´µÄ·ÖÎöÖÐ,·ÖΪ¼¸¸öÖØÒªµÄ״̬½øÐзÖÎö.±¾ÎĵĴúÂë·ÖÎö»ùÓÚ2.6.28µÄkernel.·ÖÎö´úÂë»ù±¾Î»ÓÚlinux-2.6.28-
rc7/kernel/sched.cºÍlinux-2.6.28-rc7/kernel/sched_fair.cλÖÃ.
¶þ:CFS·ÖÎö
ÔÚÉÏÃæ˵¹ý,linuxµ÷¶È´úÂë²ÉÓÃÁËÄ£¿é»¯Éè¼Æ,ʲô½ÐÄ£¿é»¯?¼ò¶øÑÔÖ®,¾ÍÊÇÒÔºóÈç¹ûÒª¸ü¸Äµ÷¶ÈÆ÷,²»ÐèÒª¸ü¸Äµ÷¶ÈÖ´Ðв¿·ÝµÄ´úÂë,Ö»ÐèÒªÌî³ä¶ÔÓ¦¼¸¸öº¯Êý¼´¿É.ÏÂÃæ·ÖΪ¼¸¸ö״̬½øÐзÖÎö.
2.1: tickÖжÏ
ÔÚtickÖжϴ¦Àíº¯ÊýÖÐ,»áµ÷ÓÃscheduler_tick()º¯Êý.¸Ãº¯Êý´úÂëÈçÏÂ:
void scheduler_tick(void)
{
/*È¡µÃµ±Ç°CPU*/
int cpu = smp_processor_id();
/*È¡µÃµ±Ç°CPU¶ÔÓ¦µÄrunqueue*/
struct rq *rq = cpu_rq(cpu);
/*µ±Ç°ÔËÐеĽø³Ì*/
struct task_struct *curr = rq->curr;
sched_clock_tick();
spin_lock(&rq->lock);
/*¸üÐÂrqµÄµ±Ç°Ê±¼ä´Á.¼´Ê¹rq->clock±äΪµ±Ç°Ê±¼ä´Á*/
update_rq_clock(rq);
/*¸üÐÂrqµÄ¸ºÔØ*/
update_cpu_load(rq);
/*µ÷Óõ÷¶ÈÄ£¿éµÄtask_tickº¯Êý*/
curr->sched_class->task_tick(rq, curr, 0);
spin_unlock(&rq->lock);
#ifdef CONFIG_SMP
rq->idle_at_tick = idle_cpu(cpu);
trigger_load_balance(rq, cpu);
#endif
}
ÎÒÃÇ´ÓÉÏÃæµÄ´úÂëÖпÉÒÔ¿´µ½,¾¹ýÒ»²¿·Ý¹²Í¬´¦ÀíÖ®ºó,Á÷³Ì»áתÈëµ÷¶ÈÄ£¿éµÄtask_tick()º¯Êý.
¶ÔÓ¦CFS,ËüµÄsched_class½á¹¹ÈçÏÂ:
static const struct sched_class fair_sched_class = {
.next = &idle_sched_class,
.enqueue_task
Ïà¹ØÎĵµ£º
1. HCI²ãÐÒé¸ÅÊö£º
HCIÌṩһÌ×ͳһµÄ·½·¨À´·ÃÎÊBluetoothµ×²ã¡£ÈçͼËùʾ£º
´ÓͼÉÏ¿ÉÒÔ¿´³ö£¬Host Controller Interface(HCI) ¾ÍÊÇÓÃÀ´¹µÍ¨HostºÍModule¡£Hostͨ³£¾ÍÊÇPC£¬ ModuleÔòÊÇÒÔ¸÷ÖÖÎïÀíÁ¬½ÓÐÎʽ£¨USB,serial,pc-cardµÈ£©Á¬½Óµ½PCÉϵÄbluetooth Dongle¡£
ÔÚHostÕâÒ»¶Ë£ºapplication,SDP,L2capµÈÐÒé ......
ÀýÒ»£º·¢ËÍSignaling Packet£º
Signaling CommandÊÇ2¸öBluetoothʵÌåÖ®¼äµÄL2CAP²ãÃüÁî´«Êä¡£ËùÒÔµÃSignaling CommandʹÓÃCID 0x0001.
¶à¸öCommand¿ÉÒÔÔÚÒ»¸öC-frame£¨control frame£©Öз¢ËÍ¡£
Èç¹ûÒªÖ±½Ó·¢ËÍSignaling Command.ÐèÒª½¨Á¢SOCK_RAWÀàÐ͵ÄL2CAPÁ¬½ÓSocket¡£ÕâÑù²ÅÓлú»á×Ô¼ºÌî³äCommand Code£¬Identi ......
Service Discovery Protocol(SDP)ÌṩһÖÖÄÜÁ¦£¬ÈÃÓ¦ÓóÌÐòÓз½·¨·¢ÏÖÄÄÖÖ·þÎñ¿ÉÓÃÒÔ¼°ÕâÖÖ·þÎñµÄÌØÐÔ¡£
·þÎñ·¢ÏÖÐÒé(SDP»òBluetooth SDP)ÔÚÀ¶ÑÀÐÒéÕ»ÖжÔÀ¶ÑÀ»·¾³ÖеÄÓ¦ÓóÌÐòÓÐÌØÊâµÄº¬Ò⣬·¢ÏÖÄĸö·þÎñÊÇ¿ÉÓõĺÍÈ·¶¨ÕâЩ¿ÉÓ÷þÎñµÄÌØÕ÷¡£SDP¶¨ÒåÁËbluetooth client·¢ÏÖ¿ÉÓÃbluetooth server·þÎñºÍËüÃǵÄÌØÕ÷µÄ·½·¨¡£ ......
Linux»·¾³Ï¸÷¸öä¯ÀÀÆ÷µÄ±È½Ï
2009Äê05ÔÂ11ÈÕ ÐÇÆÚÒ» 09:46
kingliyouдµÀ "Èç¹ûÄ㻹ÊÇÒ»¸öLinuxµÄ²ËÄñ£¬ÄÇôÄãÊ×ÏÈ»á¶ÔËü¼¯³ÉµÄÍøÒ³ä¯ÀÀÆ÷ÓÐÐËȤ¶ø²»ÊÇÄÇЩÎÄ×Ö±à¼Æ÷£¬¿ª·¢ÓÃIDEµÈ¡£ÄÇô³ýÁ˶úÊìÄÜÏêµÄFirefoxÍâÄ㻹¶ÔÏÂÃæÄÇÒ»¿î¸ÐÐËȤÄØ£¿
Konqueror:KDE×ÀÃæ»·¾³ÏÂÖøÃûµÄ"°ëºì²»ºÚ"µÄä¯ÀÀÆ÷£»ËüÎȶ¨£¬Ëü¼ò½à£¬Ëü×°ÔØÒ ......