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

Linux C ʵÏÖÏ̳߳Ø

×î½ü×öµÄһЩ¹¤×÷ÐèÒªÓõ½Ï̳߳ؼ¼Êõ£¬Òò´Ë²Î¿¼ÁËһЩ×ÊÁϺÍÊé¼®£¬Èç¡¶0bug c/c++ÉÌÓù¤³ÌÖ®µÀ¡·¡£
Ϊ´ËÔÚlinuxƽ̨ÉÏÓô¿cдÁËÒ»¸öÏ̳߳صÄʵÏÖ¡£
ÔÚ´ËÁгöÁËÔ­´úÂë¡£
Ö÷ÒªÓõ½µÄÊý¾Ý½á¹¹ÓÐ
1.struct  thread_pool_t    // thread pool µÄʵÏÖ´úÂë
2.struct thread_pool_token_t    //ÔÚthread pool ÖÐÓõ½µÄ½á¹¹£¬Ò»¸ö¸ÃÀàÐͱäÁ¿´ú±íÒ»ÌõÏß³Ì
3.struct thread_pool_job_t     //µ±Ïßǰ³Ì´¦Àí¸ÃÈÎÎñ½«»Øµ÷½á¹¹
Éè¼ÆË¼Â·£º
Ö÷Ï̴߳´½¨Ï̳߳صĿØÖÆỊ̈߳¬
¹ÜÀíÏ߳̽«½øÈëÑ­»·À´×öÒÔÏÂÊÂÇ飺
1.Èç¹ûµ±Ç°¿ÕÏнø³Ì²»×ã²¢ÇÒ×ÜÏß³ÌÊýûÓдﵽÉÏÏÞ£¬½«´´½¨Ò»Ìõ¿ÕÏÐỊ̈߳¬ÖÁµÀ¿ÕÏÐÏ̴߳ﵽ3Ìõ£¨¼ûTHREAD_POOL_MIN_IDLE_SIZE£©
2.²»¶Ï¼ì²é¹¤×÷ÈÎÎñ¶ÓÁУ¬ÓÐÔò°²ÅÅÒ»Ìõ¿ÕÏÐÏ̶߳ԸÃÈÎÎñ½øÐд¦Àí
ÆÕͨÏ̱߳»¹ÜÀíÏ̴߳´½¨ºóÒ²½«½øÈëÑ­»·À´×öÒÔÏÂÊÂÇ飺
1.¼ì²éµ±Ç°assignµÄthread_pool_token_t½á¹¹µÄ״̬£¬Èç¹ûÊÇTREAD_POOL_STATE_BUSYÔòµ÷ÓÃthread_pool_token_tËù×¢²áµÄ»Øµ÷º¯ÊýÀ´´¦ÀíÈÎÎñ¡£
2.Íê³É¸ÃÈÎÎñºó¼ì²âµ±Ç°¿ÕÏнø³Ì¹»²»¹»£¬Èç¹ûÌ«¶àÔòÍ˳ö±¾Ị̈߳¬·ñÔò»á¸ÄдÔËÐÐ״̬ΪTREAD_POOL_STATE_IDLEºó¼ÌÐøÑ­»·
×¢²áÈÎÎñ£º
1.µ±Ã»ÓпÕÏÐÏ߳̿ÉÓÃʱ½«°Ñ¸ÃÈÎÎñ¼ÓÈ빤×÷ÈÎÎñ¶ÓÁУ¨Ð趨Òå_THREAD_POOL_JOB_LIST_£©£¬ÒÔ±¸½«À´ÓпÕÏÐÏß³ÌÊÇÄܹ»½øÐд¦Àí¡£
Ö÷ÒªÎļþ £º
1.thread_pool.h
 
#ifndef _LIB_DOL_THREAD_POOL_H_
#define _LIB_DOL_THREAD_POOL_H_
#include "thread_pool.def"
#include <pthread.h>
#define THREAD_POOL_MIN_SIZE      5     /* at least 5 threads, 4 job + 1 manage thread */
#define THREAD_POOL_MIN_IDLE_SIZE 3     /* at least 3 threads idle to improve the efficiency */
#define THREAD_POOL_DEFAULT_SIZE  10    /* default threads in thread pool */
#define THREAD_POOL_MAX_SIZE      100   /* max threads in thread pool */
#define TREAD_POOL_STATE_NOTRUN   0
#define TREAD_POOL_STATE_IDLE     1
#define TREAD_POOL_STATE_BUSY     2
#define TREAD_POOL_REG_OK         0
#define


Ïà¹ØÎĵµ£º

Linux iptableÎĵµ

×ÜÀÀ
ÓÃiptables -ADC À´Ö¸¶¨Á´µÄ¹æ
Ôò
£¬-AÌí¼Ó -Dɾ³ý -C ÐÞ¸Ä
iptables - [RI] chain rule num rule-specification[option]
ÓÃiptables - RI ͨ¹ý¹æÔòµÄ˳ÐòÖ¸¶¨
iptables -D chain rule num[option]
ɾ³ýÖ¸¶¨¹æÔò
iptables -[LFZ] [chain][option]
ÓÃiptables -LFZ Á´Ãû [Ñ¡Ïî]
iptables -[NX] chain
ÓÃ -NX ......

linux mmapÇý¶¯ÊµÏÖ

ÔÚʵÏÖÇý¶¯³ÌÐòµÄmmapº¯Êýʱ£¬Òª×¢ÒâÓ³É䵨ַµÄת»»ÎÊÌ⣬¼û´úÂë¡£
¶¨ÒåÒ»¸öÉ豸½á¹¹Ì壺
struct leedriver
{
struct cdev cdev;
unsigned char mem[MEMSIZE];
};
ÕâÀïÃæÕâ¸öMEMSIZE£¬×îС¶¼ÒªÊÇ4096£¬ÒòΪÄÚ´æÓ³ÉäÊÇÒÔҳΪµ¥Î»µÄ¡£
ÔÚʵÏÖsimple_remap_mmapº¯Êýʱ£¬´úÂëÈçÏÂ
static int simple_remap_mmap(stru ......

linuxϵͳϰ²×°flashplayer

µÚÒ»²½:ÏÂÔØFLASHµÄ²å¼þ
 
http://www.adobe.com/ÔÚÕâ¸öÒ³ÃæÉÏÓкܶà²å¼þ,ÔÚÕâÀïÄãÖ»ÓÃÏÂÔØ
 
ÎļþÃû×Ö:install_flash_player_9_linux.tar.gz
 
 
µÚ¶þ²½:½âѹÎļþ°ü
 
µ±Ç°µÄ¹¤×÷Ŀ¼ÊÇ:USR
 
[root@isitqnx usr]#tar zvxf install_flash_player_7_linux.tar.gz µÃµ½Ò»¸öͬÃûÎļ ......

fork compare to exec in linux c program

pid_t  pid=fork()
it has 3 situation for the return result pid
0  child
>0 parent process
<0 fork fail
fork create a new process  and it parent live alse when the child process had been created ......

Can C beat RTL?


http://www.edn.com/article/457428-Can_C_beat_RTL_.php 
With the appearance of higher speeds and more DSP macrocells in low-cost FPGAs, more and more design teams are seeing the configurable chips not as glue but as a way to accelerate the inner loops of numerical algorithms, either in conjun ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ