linux¶àÏß³Ìѧϰ(¶þ)——Ï̵߳Ĵ´½¨ºÍÍ˳ö
ÔÚÉÏһƪÎÄÕÂÖжÔÏ߳̽øÐÐÁ˼òµ¥µÄ¸ÅÊö£¬ËüÔÚϵͳÖкͱà³ÌµÄÓ¦ÓÃÖУ¬°çÑݵĽÇÉ«ÊDz»ÑÔ¶øÓ÷µÄ¡£Ñ§Ï°Ëü¡¢ÕÆÎÕËü¡¢³Ô͸ËüÊÇ×÷Ϊһ¸ö³ÌÐòÔ±µÄ±ØÐë×÷Ϊ¡£ÔÚ½ÓÏÂÀ´µÄ½²ÊöÖУ¬ËùÓÐÏ̵߳IJÙ×÷¶¼ÊÇÓû§¼¶µÄ²Ù×÷¡£ÔÚLINUXÖУ¬Ò»°ãpthreadÏ߳̿âÊÇÒ»Ì×ͨÓõÄÏ߳̿⣬ÊÇÓÉPOSIXÌá³öµÄ£¬Òò´ËËûµÄÒÆÖ²ÐÔÊǷdz£ºÃµÄ¡£
´´½¨Ïß³Ìʵ¼ÊÉϾÍÊÇÈ·¶¨µ÷ÓøÃÏ̺߳¯ÊýµÄÈë¿Úµã£¬ÕâÀïͨ³£Ê¹Óõĺ¯ÊýÊÇpthread_create¡£ÔÚÏ̴߳´½¨Ö®ºó£¬¾Í¿ªÊ¼ÔËÐÐÏà¹ØµÄÏ̺߳¯Êý¡£Ôڸú¯ÊýÔËÐнáÊø£¬Ïß³ÌÒ²»áËæ×ÅÍ˳ö¡£ÕâÊÇÆäÖÐÍ˳öÏ̵߳ÄÒ»ÖÖ·½·¨£¬ÁíÍâÒ»ÖÖÍ˳öÏ̵߳ķ½·¨¾ÍÊǵ÷ÓÃpthread_exit()º¯Êý½Ó¿Ú£¬ÕâÊǽáÊøº¯ÊýµÄÖ÷¶¯ÐÐΪ¡£ÔÚÕâÀïҪעÒâµÄÊÇ£¬ÔÚʹÓÃÏ̺߳¯Êýʱ£¬²»ÒªÇáÒ×µ÷ÓÃexit()º¯Êý£¬ÒòΪÕâÑù»áʹÕû¸ö½ø³ÌÍ˳ö£¬ÍùÍùÒ»¸ö½ø³Ì°üº¬×Ŷà¸öỊ̈߳¬ËùÒÔµ÷ÓÃÁËexit()Ö®ºó£¬ËùÓиýø³ÌÖеÄÏ̶߳¼»á±»½áÊøµô¡£Òò´Ë£¬ÔÚÏß³ÌÖУ¬ÀûÓÃpthread_exitÀ´Ìæ´ú½ø³ÌÖеÄexit¡£
ÓÉÓÚÒ»¸ö½ø³ÌÖеÄÊý¾Ý¶ÎÊǹ²ÏíµÄ£¬Òò´Ëͨ³£ÔÚÏß³ÌÍ˳öÖ®ºó£¬Í˳öÏß³ÌËùÕ¼µÄ×ÊÔ´²¢²»»áËæ×ÅÏ̵߳ĽáÊø¶øµÃµ½ÊÍ·Å¡£ÕýÈç½ø³ÌÖ®¼ä¿ÉÒÔµ÷ÓÃwait()º¯ÊýÀ´Í¬²½ÖÐÖ¸²¢ÊÍ·Å×ÊÔ´Ò»Ñù£¬Ïß³ÌÖ®¼äÒ²ÓÐÀàËƵĻúÖÆ£¬ÄǾÍÊÇpthread_joinº¯Êý.pthread_join¿ÉÒÔ½«µ±Ç°Ï̹߳ÒÆ𣬵ȴýÏ̵߳ĽáÊø£¬Õâ¸öº¯ÊýÊÇÒ»¸ö×èÈûº¯Êý£¬µ÷ÓÃËüµÄº¯Êý½«Ò»Ö±µÈ´ýµ½±»µÈ´ýµÄÏ߳̽áÊøΪֹ£¬µ±º¯Êý·µ»Øʱ£¬±»µÈ´ýº¯ÊýµÄ×ÊÔ´¾Í»á±»ÊÍ·Å¡£
1¡¢º¯ÊýÓï·¨¼òÊö¡£
pthread_create
Í·Îļþ£º pthread.h
º¯ÊýÔÐÍ£º int pthread_create (pthread_t* thread, pthread_attr_t* attr,
void* (start_routine)(void*), void* arg);
º¯Êý´«ÈëÖµ£º thread: Ï̱߳êʶ·û
attr: Ïß³ÌÊôÐÔÉèÖÃ
Ïà¹ØÎĵµ£º
Service Discovery Protocol(SDP)ÌṩһÖÖÄÜÁ¦£¬ÈÃÓ¦ÓóÌÐòÓз½·¨·¢ÏÖÄÄÖÖ·þÎñ¿ÉÓÃÒÔ¼°ÕâÖÖ·þÎñµÄÌØÐÔ¡£
·þÎñ·¢ÏÖÐÒé(SDP»òBluetooth SDP)ÔÚÀ¶ÑÀÐÒéÕ»ÖжÔÀ¶ÑÀ»·¾³ÖеÄÓ¦ÓóÌÐòÓÐÌØÊâµÄº¬Ò⣬·¢ÏÖÄĸö·þÎñÊÇ¿ÉÓõĺÍÈ·¶¨ÕâЩ¿ÉÓ÷þÎñµÄÌØÕ÷¡£SDP¶¨ÒåÁËbluetooth client·¢ÏÖ¿ÉÓÃbluetooth server·þÎñºÍËüÃǵÄÌØÕ÷µÄ·½·¨¡£ ......
.tar
½â°ü£º tar xvf FileName.tar
´ò°ü£ºtar cvf FileName.tar DirName
£¨×¢£ºtarÊÇ´ò°ü£¬²»ÊÇѹËõ£¡£©
---------------------------------------------
.gz
½âѹ1£ºgunzip FileName.gz
½âѹ2£ºgzip -d FileName.gz
ѹËõ£ºgzip FileName
.tar.gz
½âѹ£ºtar zxvf FileName.tar.gz
ѹËõ£ºtar zcvf FileName ......
LinuxÌṩÁËÄÚ´æÓ³É亯Êýmmap, Ëü°ÑÎļþÄÚÈÝÓ³Éäµ½Ò»¶ÎÄÚ´æÉÏ(׼ȷ˵ÊÇÐéÄâÄÚ´æÉÏ), ͨ¹ý¶ÔÕâ¶ÎÄÚ´æµÄ¶ÁÈ¡ºÍÐÞ¸Ä, ʵÏÖ¶ÔÎļþµÄ¶ÁÈ¡ºÍÐÞ¸Ä, ÏÈÀ´¿´Ò»ÏÂmmapµÄº¯ÊýÉùÃ÷: Í·Îļþ: ÔÐÍ: void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offsize); ·µ» ......