Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Ò»¸öLinuxÏÂCÏ̳߳صÄʵÏÖ

ʲôʱºòÐèÒª´´½¨Ï̳߳ØÄØ£¿¼òµ¥µÄ˵£¬Èç¹ûÒ»¸öÓ¦ÓÃÐèҪƵ·±µÄ´´½¨ºÍÏú»ÙỊ̈߳¬¶øÈÎÎñÖ´ÐеÄʱ¼äÓַdz£¶Ì£¬ÕâÑùÏ̴߳´½¨ºÍÏú»ÙµÄ´øÀ´µÄ¿ªÏú¾Í²»ÈݺöÊÓ£¬ÕâʱҲÊÇÏ̳߳ظóö³¡µÄ»ú»áÁË¡£Èç¹ûÏ̴߳´½¨ºÍÏú»Ùʱ¼äÏà±ÈÈÎÎñÖ´ÐÐʱ¼ä¿ÉÒÔºöÂÔ²»¼Æ£¬ÔòûÓбØҪʹÓÃÏ̳߳ØÁË¡£
ÏÂÃæÊÇLinuxϵͳÏÂÓÃCÓïÑÔ´´½¨µÄÒ»¸öÏ̳߳ء£Ï̳߳ػáά»¤Ò»¸öÈÎÎñÁ´±í(ÿ¸öCThread_worker½á¹¹¾ÍÊÇÒ»¸öÈÎÎñ)¡£
pool_init()º¯ÊýÔ¤ÏÈ´´½¨ºÃmax_thread_num¸öỊ̈߳¬Ã¿¸öÏß³ÌÖ´thread_routine ()º¯Êý¡£¸Ãº¯ÊýÖÐ
1. while (pool->cur_queue_size == 0)
2. {
3. pthread_cond_wait (&(pool->queue_ready),&(pool->queue_lock));
4. }
±íʾÈç¹ûÈÎÎñÁ´±íÖÐûÓÐÈÎÎñ£¬Ôò¸ÃÏ̳߳öÓÚ×èÈûµÈ´ý״̬¡£·ñÔò´Ó¶ÓÁÐÖÐÈ¡³öÈÎÎñ²¢Ö´ÐС£
pool_add_worker()º¯ÊýÏòÏ̳߳صÄÈÎÎñÁ´±íÖмÓÈëÒ»¸öÈÎÎñ£¬¼ÓÈëºóͨ¹ýµ÷ÓÃpthread_cond_signal (&(pool->queue_ready))»½ÐÑÒ»¸ö³öÓÚ×èÈû״̬µÄÏß³Ì(Èç¹ûÓеĻ°)¡£
pool_destroy ()º¯ÊýÓÃÓÚÏú»ÙÏ̳߳أ¬Ï̳߳ØÈÎÎñÁ´±íÖеÄÈÎÎñ²»»áÔÙ±»Ö´ÐУ¬µ«ÊÇÕýÔÚÔËÐеÄÏ̻߳áÒ»Ö±°ÑÈÎÎñÔËÐÐÍêºóÔÙÍ˳ö¡£
ÏÂÃæÌù³öÍêÕû´úÂë
1. #include
2. #include
3. #include
4. #include
5. #include
6. #include
7.
8. /*
9. *Ï̳߳ØÀïËùÓÐÔËÐк͵ȴýµÄÈÎÎñ¶¼ÊÇÒ»¸öCThread_worker
10. *ÓÉÓÚËùÓÐÈÎÎñ¶¼ÔÚÁ´±íÀËùÒÔÊÇÒ»¸öÁ´±í½á¹¹
11. */
12. typedef struct worker
13. {
14. /*»Øµ÷º¯Êý£¬ÈÎÎñÔËÐÐʱ»áµ÷Óô˺¯Êý£¬×¢ÒâÒ²¿ÉÉùÃ÷³ÉÆäËüÐÎʽ*/
15. void *(*process) (void *arg);
16. void *arg;/*»Øµ÷º¯ÊýµÄ²ÎÊý*/
17. struct worker *next;
18.
19. } CThread_worker;
20.
21.
22. /*Ï̳߳ؽṹ*/
23. typedef struct
24. {
25. pthread_mutex_t queue_lock;
26. pthread_cond_t queue_ready;
27.
28. /*Á´±í½á¹¹£¬Ï̳߳ØÖÐËùÓеȴýÈÎÎñ*/
29. CThread_worker *queue_head;
30.
31. /*ÊÇ·ñÏú»ÙÏ̳߳Ø*/
32. int shutdown;
33. pthread_t *threadid;
34. /*Ï̳߳ØÖÐÔÊÐíµÄ»î¶¯Ïß³ÌÊýÄ¿*/
35. int max_thread_num;
36. /*µ±Ç°µÈ´ý¶ÓÁеÄÈÎÎñÊýÄ¿*/
37. int cur_queue_size;
38.
39. } CThread_pool;
40.
41.
42. int pool_add_worker (void *(*process) (void *arg), void *arg);
43. void *thread_routine (void *arg);
44.
45.
46. static CT


Ïà¹ØÎĵµ£º

Linux ÖÐ RPM ÃüÁî²ÎÊýʹÓÃÏê½â

ÔÚLinux²Ù×÷ϵͳÖУ¬ÓÐÒ»¸öϵͳÈí¼þ°ü£¬ËüµÄ¹¦ÄÜÀàËÆÓÚWindowsÀïÃæµÄ“Ìí¼Ó/ɾ³ý³ÌÐò”£¬µ«Êǹ¦ÄÜÓֱȓÌí¼Ó/ɾ³ý³ÌÐò”Ç¿ºÜ¶à£¬Ëü¾ÍÊÇRed Hat Package Manager(¼ò³ÆRPM)¡£´Ë¹¤¾ß°ü×îÏÈÊÇÓÉRed Hat¹«Ë¾ÍƳöµÄ£¬ºóÀ´±»ÆäËûLinux¿ª·¢ÉÌËù½èÓá£ÓÉÓÚËüΪLinuxʹÓÃÕßÊ¡È¥Á˺ܶàʱ¼ä£¬ËùÒÔ±»¹ã·ºÓ¦ÓÃÓÚÔÚLin ......

LinuxѧϰµÄ·Ïßͼ 2010 04 21

Õýʽ¿ªÊ¼Ó¦ÓÃlinux£¬Êµ¼ù»¹ÊǺÜÖØÒªµÄ£¬ÃüÁî²»ÊDZ³³öÀ´µÄ£¬ÊÇʵ¼ù³öÀ´µÄ
LinuxѧϰµÄ·Ïßͼ£º
1£® ÕÆÎÕÖÁÉÙ50¸öÒÔÉϵij£ÓÃÃüÁî¡£
2£® ÊìϤGnome/KDEµÈX-windows×ÀÃæ»·¾³²Ù×÷ ¡£
3£® ÕÆÎÕ.tgz¡¢.rpmµÈÈí¼þ°üµÄ³£Óð²×°·½·¨
4£® ѧϰÌí¼ÓÍâÉ裬°²×°É豸Çý¶¯³ÌÐò£¨±ÈÈçÍø¿¨£©
5£® ÊìϤGrub/LiloÒýµ¼Æ÷¼°¼òµ¥µÄÐÞ¸´² ......

תÔØ ½ñÌìΪÎÒµÄGodaddy LinuxÖ÷»ú¿ªÍ¨SSH

ÒÔÇ°GodaddyµÄLinuxµÄÖ÷»úÊDz»ÄÜ¿ªÍ¨SSHµÄ£¬Ö»ÓÐVDS¡¢VPS¡¢¶ÀÁ¢Ö÷»ú¿ÉÒÔ¿ªÍ¨£¬Ç°¼¸ÌìÔÚºǫ́ÉÏ¿´µ½ÓÐÁËSSHÕâ¸ö¹¦ÄÜ£¬²»¹ýÐèҪɾ³ýËùÓеÄÊý¾Ý¿â£¬²Å¿ÉÒÔ½øÐпªÍ¨µÄ²½Ö衣ǿÁÒ½¨Ò鱸·ÝÊý¾Ý¿â¼°ÍøÕ¾£¡£¡
ɾ³ýÊý¾Ý¿â¾Í²»ÓÃ˵ÁË¡«ºÜ¼òµ¥¡£
²½Ö裺½øÈë¿Õ¼ä¹ÜÀíÃæ°å£¬Ñ¡ÔñSettingsÑ¡ÏϵÄSSHÑ¡ÏÈçÏÂͼ£º
godaddyssh-thumb. ......

Linux Windows ¹²ÏíÎļþ


sambaʵÏÖubuntu¸úwindowsÎļþ¹²Ïí
Ò»£® Samba ¼ò½é
Samba£¨SMBÊÇÆäËõд£© ÊÇÒ»¸öÍøÂç·þÎñÆ÷£¬ÓÃÓÚLinuxºÍWindows¹²ÏíÎļþÖ®Óã»Samba ¼´¿ÉÒÔÓÃÓÚWindowsºÍLinuxÖ®¼äµÄ¹²ÏíÎļþ£¬Ò²Ò»ÑùÓÃÓÚLinuxºÍLinuxÖ®¼äµÄ¹²ÏíÎļþ£»²»¹ý¶ÔÓÚLinuxºÍLinuxÖ®¼ä¹²ÏíÎļþÓиüºÃµÄÍøÂçÎļþϵͳNFS£¬NFSÒ²ÊÇÐèÒª¼ÜÉè·þÎñÆ÷µÄ£»
´ó¼ÒÖª ......

½â¾ölinuxÎÞ·¨Ò»´Îɾ³ýÐí¶àÎļþµÄÎÊÌâ


ÔÚlinuxÏÂÒ»Ö±±»ÎÞ·¨Ò»ÏÂɾ³ýºÜ¶àÎļþ£¨³¬¹ý1024£©µÄÎÊÌâÀ§ÈÅ£»½ñÌìÕÒÁËһϣ¬·¢ÏÖÓÐÒ»¸öºÜ¼òµ¥µÄ½â¾ö°ì·¨¡£ÔÚterminalÖÐÊäÈë
flora03:/scratch/weibinli> find . -name 'Rubidium*' | xargs rm
 
¸ÃÃüÁîÒ»ÏÂ×Ó ½«ËùÓÐÒÔRubidium¿ªÍ·µÄÎļþɾ³ýµô¡£ÒÔ´ËÀàÍÆ£¬Ó¦¸Ã¿ÉÒÔ½«rm¸ÄΪcpÒ»´Îcopy´óÊýÄ¿µÄÎļþ¡£
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ