linuxỊ̈߳¨×ª£©
³ÌÏà¹Øº¯Êý£º
pthread_attr_init()
pthread_attr_setschedpolicy()
pthread_attr_setschedparam()
pthread_attr_destroy()
¾ßÌåÓ¦ÓÃdemo£º
pthread_attr_init(&attr);
pthread_attr_setschedpolicy(&attr, SCHED_RR);
pthread_attr_getschedparam(&attr, ¶m);
param.sched_priority=20;
pthread_attr_setschedparam(&attr, ¶m);
pthread_create(&tid, &attr, (void *)myfunction, myarg);
linux½ø³Ìµ÷¶È·½·¨(SCHED_OTHER,SCHED_FIFO,SCHED_RR)
linux½ø³Ìµ÷¶È·½·¨(SCHED_OTHER,SCHED_FIFO,SCHED_RR)
linuxÄں˵ÄÈýÖÖµ÷¶È·½·¨£º
1£¬SCHED_OTHER ·Öʱµ÷¶È²ßÂÔ£¬
2£¬SCHED_FIFOʵʱµ÷¶È²ßÂÔ£¬Ïȵ½ÏÈ·þÎñ
3£¬SCHED_RRʵʱµ÷¶È²ßÂÔ£¬Ê±¼äƬÂÖת
linuxÄں˵ÄÈýÖÖµ÷¶È·½·¨£º
1£¬SCHED_OTHER ·Öʱµ÷¶È²ßÂÔ£¬
2£¬SCHED_FIFOʵʱµ÷¶È²ßÂÔ£¬Ïȵ½ÏÈ·þÎñ
3£¬SCHED_RRʵʱµ÷¶È²ßÂÔ£¬Ê±¼äƬÂÖת
ʵʱ½ø³Ì½«µÃµ½ÓÅÏȵ÷Óã¬ÊµÊ±½ø³Ì¸ù¾ÝʵʱÓÅÏȼ¶¾ö¶¨µ÷¶ÈȨֵ£¬·Öʱ½ø³ÌÔòͨ¹ýniceºÍcounterÖµ¾ö¶¨È¨Öµ£¬niceԽС£¬counterÔ½´ó£¬±»µ÷¶ÈµÄ¸ÅÂÊÔ½´ó£¬Ò²¾ÍÊÇÔø¾Ê¹ÓÃÁËcpu×îÉٵĽø³Ì½«»áµÃµ½ÓÅÏȵ÷¶È¡£
SHCED_RRºÍSCHED_FIFOµÄ²»Í¬£º
µ±²ÉÓÃSHCED_RR²ßÂԵĽø³ÌµÄʱ¼äƬÓÃÍ꣬ϵͳ½«ÖØзÖÅäʱ¼äƬ£¬²¢ÖÃÓÚ¾ÍÐ÷¶ÓÁÐβ¡£·ÅÔÚ¶ÓÁÐβ±£Ö¤ÁËËùÓоßÓÐÏàͬÓÅÏȼ¶µÄRRÈÎÎñµÄµ÷¶È¹«Æ½¡£
SCHED_FIFOÒ»µ©Õ¼ÓÃcpuÔòÒ»Ö±ÔËÐС£Ò»Ö±ÔËÐÐÖ±µ½Óиü¸ßÓÅÏȼ¶ÈÎÎñµ½´ï»ò×Ô¼º·ÅÆú¡£
Èç¹ûÓÐÏàͬÓÅÏȼ¶µÄʵʱ½ø³Ì£¨¸ù¾ÝÓÅÏȼ¶¼ÆËãµÄµ÷¶ÈȨֵÊÇÒ»ÑùµÄ£©ÒѾ׼±¸ºÃ£¬FIFOʱ±ØÐëµÈ´ý¸Ã½ø³ÌÖ÷¶¯·ÅÆúºó²Å¿ÉÒÔÔËÐÐÕâ¸öÓÅÏȼ¶ÏàͬµÄÈÎÎñ¡£¶øRR¿ÉÒÔÈÃÿ¸öÈÎÎñ¶¼Ö´ÐÐÒ»¶Îʱ¼ä¡£
Ïàͬµã£º
RRºÍFIFO¶¼Ö»ÓÃÓÚʵʱÈÎÎñ¡£
´´½¨Ê±ÓÅÏȼ¶´óÓÚ0(1-99)¡£
°´ÕÕ¿ÉÇÀÕ¼ÓÅÏȼ¶µ÷¶ÈËã·¨½øÐС£
¾ÍÐ÷̬µÄʵʱÈÎÎñÁ¢¼´ÇÀÕ¼·ÇʵʱÈÎÎñ¡£
ËùÓÐÈÎÎñ¶¼²ÉÓÃlinux·Öʱµ÷¶È²ßÂÔʱ¡£
1£¬´´½¨ÈÎÎñÖ¸¶¨²ÉÓ÷Öʱµ÷¶È²ßÂÔ£¬²¢Ö¸¶¨ÓÅÏȼ¶niceÖµ(-20~19)¡£
2£¬½«¸ù¾Ýÿ¸öÈÎÎñµÄniceֵȷ¶¨ÔÚcpuÉϵÄÖ´ÐÐʱ¼ä(counter)¡£
3£¬Èç¹ûûÓеȴý×ÊÔ´£¬Ô
Ïà¹ØÎĵµ£º
SamÒ»ÄêÇ°ÔÚLinuxÏÂдÁËÒ»¸öÀàËÆWindowsÏÂBTWµÄ¿â--BTX¡£ÏÖÔÚÐèÒªÌí¼Óй¦ÄÜʱ·¢Ïֺܶà֪ʶµã¶¼Íü¼ÇÁË¡£ËùÒÔ¾ö¶¨ÔÚÕâ´ÎѧϰÖУ¬°ÑһЩbluez API¼Ç¼ÏÂÀ´¡£Õ⼸ÌìÓÖÏ룬ÕâÑù»¹²»¹»£¬²»Èç°ÑLinuxϵÄBluetooth±à³Ì»ù´¡¸ø¼Ç¼ÏÂÀ´°É¡£
Ç°ÑÔ£ºËæ×ÅǶÈëʽϵͳµÄ·ÉËÙ·¢Õ¹£¬ºÜ¶àǶÈëʽƽ̨ÉÏÐèÒªBluetoothÉ豸ºÍÓ¦Óᣵ«ÔÚLinuxÏ ......
LinuxÏÂBluetoothÐÒéÕ»µÄʵÏÖ. LinuxÏ¿ª·ÅµÄÀ¶ÑÀÐÒéÕ»Ö÷Òª°üÀ¨IBM¹«Ë¾µÄBlueDrekar£¬Nokia¹«Ë¾µÄAffix, Axis¹«Ë¾µÄOpenBTºÍ¹Ù·½ÐÒéÕ»BlueZ¡£ÎÒÃÇÖ÷ÒªÃæ¶ÔBluezÀ´Ì½ÌÖ¡£
BlueZ»ù´¡´úÂë¾ùÊÇÓÉMaxim KrasnyanskyÍê³ÉµÄ¡£°üÀ¨£ºHCI£¬L2CAP£¬RFCOMMºÍ»ù±¾socketµÄʵÏÖ¡£Ëû¾ÍÖ°ÓÚQualcomm(¸ßͨ)¡£Marcel Holtmann¿ª·¢²ãµÄÐÒ ......
1. HCI²ãÐÒé¸ÅÊö£º
HCIÌṩһÌ×ͳһµÄ·½·¨À´·ÃÎÊBluetoothµ×²ã¡£ÈçͼËùʾ£º
´ÓͼÉÏ¿ÉÒÔ¿´³ö£¬Host Controller Interface(HCI) ¾ÍÊÇÓÃÀ´¹µÍ¨HostºÍModule¡£Hostͨ³£¾ÍÊÇPC£¬ ModuleÔòÊÇÒÔ¸÷ÖÖÎïÀíÁ¬½ÓÐÎʽ£¨USB,serial,pc-cardµÈ£©Á¬½Óµ½PCÉϵÄbluetooth Dongle¡£
ÔÚHostÕâÒ»¶Ë£ºapplication,SDP,L2capµÈÐÒé ......
ÔÚLinux²Ù×÷ϵͳÏÂÓÐ3ÀàÖ÷ÒªµÄÉ豸ÎļþÀàÐÍ£º¿éÉ豸¡¢×Ö·ûÉ豸ºÍÍøÂçÉ豸¡£ÕâÖÖ·ÖÀà·½·¨¿ÉÒÔ½«¿ØÖÆÊäÈë/Êä³öÉ豸µÄÇý¶¯³ÌÐòÓëÆäËû²Ù×÷ϵͳÈí¼þ·ÖÀ뿪À´¡£×Ö·ûÉ豸ÊÇÖ¸´æȡʱûÓлº´æµÄÉ豸¡£µäÐ͵Ä×Ö·ûÉ豸°üÀ¨Êó±ê¡¢¼üÅÌ¡¢´®Ðпڵȡ£
×Ö·ûÉ豸Óë¿éÉ豸µÄÖ÷ÒªÇø±ðÊÇ£ºÔÚ¶Ô×Ö·ûÉ豸·¢³ö¶Á/дÇëÇóʱ£¬Êµ¼ÊµÄÓ²¼þI/OÒ»°ã½ô½Ó× ......