Linux¶àÏ̱߳à³Ì
Linux
¶àÏ̱߳à³Ì£º¡¾
http://fanqiang.chinaunix.net/a4/b8/20010811/0905001105.html
¡¿
Linux
¶àÏß³ÌÖ§³Ö
POSIX
Ï߳̽ӿڣ¬³ÆΪ
pthread,
pthread_create
ÓÃÀ´´´½¨Ị̈߳¬
pthread_join
µÈ´ýÏ߳̽áÊø£¬º¯ÊýµÄÔÐÍ·Ö±ðÈçÏ£º
extern int pthread_create __P
((pthread_t *__thread, __const pthread_attr_t *__attr,
¡¡¡¡
void *(*__start_routine) (void *), void
*__arg));
extern int pthread_join __P
((pthread_t __th, void **__thread_return));
´´½¨Ïß³Ìʱ¿ÉÒÔ¸øÏß³ÌÉèÖÃÏà¹ØÊôÐÔ£¬¸ÃÊôÐÔ°üÀ¨ÉèÖÃÊÇ·ñ°ó¶¨£¬ÊÇ·ñ·ÖÀ룬¶ÑÕ»µØÖ·£¬¶ÑÕ»´óС£¬ÓÅÏȼ¶£¬Ä¬ÈϵÄÊôÐÔΪ·Ç°ó¶¨¡¢·Ç·ÖÀ롢ȱʡ
1M
µÄ¶ÑÕ»¡¢Ó븸½ø³ÌͬÑù¼¶±ðµÄÓÅÏȼ¶¡£
ÊôÐÔÏà¹ØµÄ½á¹¹ÌåÊÇ
pthread_attr_t
£¬³õʼ»¯º¯ÊýΪ
pthread_attr_init.
ÉèÖÃḬ̈߳ó¶¨×´Ì¬µÄº¯ÊýΪ
pthread_attr_setscope
£¬ËüÓÐÁ½¸ö²ÎÊý£¬µÚÒ»¸öÊÇÖ¸ÏòÊôÐԽṹµÄÖ¸Õ룬µÚ¶þ¸öÊÇ°ó¶¨ÀàÐÍ£¬ËüÓÐÁ½¸öÈ¡Öµ£º
PTHREAD_SCOPE_SYSTEM
£¨°ó¶¨µÄ£©ºÍ
PTHREAD_SCOPE_PROCESS
£¨·Ç°ó¶¨µÄ£©¡£
Ï̵߳ķÖÀë״̬¾ö¶¨Ò»¸öÏß³ÌÒÔʲôÑùµÄ·½Ê½À´ÖÕÖ¹×Ô¼º¡£ÔÚÉÏÃæµÄÀý×ÓÖУ¬ÎÒÃDzÉÓÃÁËÏ̵߳ÄĬÈÏÊôÐÔ£¬¼´Îª·Ç·ÖÀë״̬£¬ÕâÖÖÇé¿öÏ£¬ÔÓеÄÏ̵߳ȴý´´½¨µÄÏ߳̽áÊø¡£Ö»Óе±
pthread_join
£¨£©º¯Êý·µ»Øʱ£¬´´½¨µÄÏ̲߳ÅËãÖÕÖ¹£¬²ÅÄÜÊÍ·Å×Ô¼ºÕ¼ÓõÄϵͳ×ÊÔ´¡£¶ø·ÖÀëÏ̲߳»ÊÇÕâÑù×ӵģ¬ËüûÓб»ÆäËûµÄÏß³ÌËùµÈ´ý£¬×Ô¼ºÔËÐнáÊøÁË£¬Ïß³ÌÒ²¾ÍÖÕÖ¹ÁË£¬ÂíÉÏÊÍ·Åϵͳ×ÊÔ´¡£³ÌÐòÔ±Ó¦¸Ã¸ù¾Ý×Ô¼ºµÄÐèÒª£¬Ñ¡ÔñÊʵ±µÄ·ÖÀë״̬¡£ÉèÖÃÏ̷߳ÖÀë״̬µÄº¯ÊýΪ
pthread_attr_setdetachstate
£¨
pthread_attr_t *attr, int detachstate
£©¡£µÚ¶þ¸ö²ÎÊý¿ÉѡΪ
PTHREAD_CREATE_DETACHED
£¨·ÖÀëỊ̈߳©ºÍ
PTHREAD _CREATE_JOINABLE
£¨·Ç·ÖÀëỊ̈߳©¡£
Ïß³ÌÊý¾Ý
[TSD, Thread Specific Data]
Ïà¹ØµÄº¯ÊýÖ÷ÒªÓÐ
4
¸ö£º
´´½¨Ò»¸ö¼ü£»
Ϊһ¸ö¼üÖ¸¶¨Ïß³ÌÊý¾Ý£»
´ÓÒ»¸ö¼ü¶ÁÈ¡Ïß³ÌÊý¾Ý£»
ɾ³ý¼ü¡£
Ïß³Ìͬ²½£º
»¥³âËø£º
pthread_mutex_lock,pthread_mutex_unlock.
Ìõ¼þ±äÁ¿£º
l
Ìõ¼þ±äÁ¿Í¨³£Ó뻥³âËøÒ»ÆðʹÓã¬ÓÃÀ´´òÆÆ»¥³
Ïà¹ØÎĵµ£º
ÒÔÇ°×Ô¼º¸ú×ÅÄÚºËÄÚ´æ¹ÜÀíµÄһЩºê¶¨Ò廹ýÄÚ´æ·Ö²¼Í¼
±ÈÈçVMALLOC_START, VMALLOC_END, FIXADDR_STARTµÈµÈ
Ò»Ö±ÒÔΪÕâЩֵÔÚʵ¼ÊÄÚºËÖжà¶àÉÙÉÙ»áÓÐÎó²î£¬Ã»Ï뵽ǰ¼¸Ìì¿´ÁËÒ»ÏÂ
¾ÓÈ»ÍêÈ«ÎǺϡ£
À´ÊÔ׿ÆËãÒ»ÏÂVmallocµÄ×Ü´óС£¬ÎªÁ˱ãÓÚ¼ÆËãÎÒÃÇÈÏΪ1GµÄÄں˿ռä´Ó0µØÖ·¿ªÊ¼¡£
Ê×ÏÈÎÒµÄÎïÀíÄڴ泬¹ýÁË896M£¬Òò´Ëhigh_ ......
http://hi.baidu.com/vsgp/blog/item/0daae64589a3852fcffca3e7.html
1¡¢°²×°vsftpd
ÖÕ¶ËÊäÈ룺sudo apt-get install vsftpd
°²×°ÁËÖ®ºó»áÔÚ/home/Ͻ¨Á¢Ò»¸öftpĿ¼¡£ÕâʱºòÄã¿ÉÒÔÊÔ×Å·ÃÎÊÏÂftp://IPµØÖ·¡£Ó¦¸Ã¿ÉÒÔ¿´µ½Ò»¸ö¿Õ°×ÄÚÈݵÄftp¿Õ¼ä¡£
ÆôÓãºsudo /etc/init.d/vsftpd start
Í£Óãºsudo /etc/init.d/ ......
×î½üʵÑéÊÒÄÚ²¿µÄmysqlµÄrootÃÜÂë±»ÐÞ¸ÄÁË£¬ÐèÒªÏë°ì·¨ÐÞ¸ÄÐÂÃÜÂë¡£·½·¨ÈçÏ£º
1£¬ ¹Ø±Õmysql·þÎñ
/etc/init.d/mysqld stop
2£¬Ê¹ÓÖskip-grant-tablesÑ¡ÏîÆô¶¯MySQL·þÎñ,¿ÉÒÔÐÞ¸Ä/etc/inin.d/mysqld½Å±¾Æô¶¯Î»ÖÃÔö¼Ó´ËÑ¡Ï
vi /etc/init.d/mysqld
ÔÚÏÂÃæÔËÐÐÆô¶¯µÄÓï¾äÀïÔö¼Ó--skip-grant-tables
......