Linux ÏÂÏß³Ìͬ²½
½øÐжàÏ̱߳à³Ì£¬×îÍ·Ì۵ľÍÊÇÄÇЩ¹²ÏíµÄÊý¾Ý¡£ÒòΪÄãÎÞ·¨ÖªµÀÄĸöÏ̻߳áÔÚÄĸöʱºò¶ÔËü½øÐвÙ×÷£¬ÄãÒ²ÎÞ·¨µÃÖªÄǸöÏ̻߳áÏÈÔËÐУ¬ÄĸöÏ̻߳áºóÔËÐС£ÏÂÃæ½éÉÜһЩ¼¼Êõ£¬Í¨¹ýËûÃÇ£¬Äã»áºÏÀí°²ÅÅÄãµÄÏß³ÌÖ®¼ä¶Ô×ÊÔ´µÄ¾ºÕù¡£
l »¥³âÌåMutex
l ÐźŵÆSemophore
l Ìõ¼þ±äÁ¿Conditions
ÏÈ˵һÏ»¥³âÁ¿¡£
ʲôʱºò»áÓÃÉÏ»¥³âÁ¿ÁË£¿±ÈÈçÄãÏÖÔÚÓÐһȫ¾ÖÁ´±í£¬ÄãÓм¸¸ö¹¤×÷Ï̡߳£Ã¿Ò»¸öÏ̴߳ӸÃÁ´±íÖÐÈ¡³öÍ·½Úµã£¬È»ºó¶Ô¸ÃÍ·½Úµã½øÐд¦Àí¡£±ÈÈçÏÖÔÚÏß³Ì1ÕýÔÚÈ¡³öÍ·½Úµã£¬ËûµÄ²Ù×÷ÈçÏ£º
Item * p =queue_list;
Queue_list=queue_list->next;
Process_job(p);
Free(p);
µ±Ïß³Ì1´¦ÀíÍêµÚÒ»²½£¬Ò²¾ÍÊÇItem *p=queue_listºó£¬ÕâʱºòϵͳֹͣÏß³Ì1µÄÔËÐУ¬¸Ä¶øÔËÐÐÏß³Ì2¡£Ïß³Ì2ÕÕÑùÈ¡³öÍ·½Úµã£¬È»ºó½øÐд¦Àí£¬×îºóÊÍ·ÅÁ˸ýڵ㡣¹ýÁ˶Îʱ¼ä£¬Ïß³Ì1ÖØеõ½ÔËÐС£¶øÕâ¸öʱºò£¬ÆäʵpËùÖ¸ÏòµÄ½ÚµãÒѾ±»Ïß³Ì2Êͷŵô£¬¶øÏß³Ì1¶Ô´ËºÁÎÞÖªÏþ¡£Ëû»á½Ó×ÅÔËÐÐprocess_job(p)¡£¶øÕ⽫µ¼ÖÂÎÞ·¨Ô¤Áϵĺó¹û£¡
¶ÔÓÚÕâÖÖÇé¿ö£¬ÏµÍ³¸øÎÒÃÇÌṩÁË»¥³âÁ¿¡£ÄãÔÚÈ¡³öÍ·½ÚµãÇ°±ØÐëÒªµÈ´ý»¥³âÁ¿£¬Èç¹û´ËʱÓÐÆäËûÏß³ÌÒѾ»ñµÃ¸Ã»¥³âÁ¿£¬ÄÇôÏ߳̽«»á×èÈûÔÚÕâ¸öµØ·½¡£Ö»Óеȵ½ÆäËûÏß³ÌÊͷŵô¸Ã»¥³âÁ¿ºó£¬ÄãµÄÏ̲߳ÅÓпÉÄܵõ½¸Ã»¥³âÁ¿¡£ÎªÊ²Ã´ÊÇ¿ÉÄÜÁË£¿ÒòΪ¿ÉÄÜ´ËʱÓв»Ö¹ÄãÒ»¸öÏß³ÌÔڵȺò¸Ã»¥³âÁ¿£¬¶øϵͳÎÞ·¨±£Ö¤ÄãµÄÏ߳̽«»áÓÅÏÈÔËÐС£
»¥³âÁ¿µÄÀàÐÍΪpthread_mutex_t¡£Äã¿ÉÒÔÉùÃ÷¶à¸ö»¥³âÁ¿¡£ÔÚÉùÃ÷¸Ã±äÁ¿ºó£¬ÄãÐèÒªµ÷ÓÃpthread_mutex_init()À´´´½¨¸Ã±äÁ¿¡£pthread_mutex_initµÄ¸ñʽÈçÏ£º
int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutex-
attr_t *mutexattr);
µÚÒ»¸ö²ÎÊý£¬mutext£¬Ò²¾ÍÊÇÄã֮ǰÉùÃ÷µÄÄǸö»¥³âÁ¿£¬µÚ¶þ¸ö²ÎÊýΪ¸Ã»¥³âÁ¿µÄÊôÐÔ¡£Õâ¸ö½«ÔÚºóÃæÏêϸÌÖÂÛ¡£
ÔÚ´´½¨¸Ã»¥³âÁ¿Ö®ºó£¬Äã±ã¿ÉÒÔʹÓÃËüÁË¡£ÒªµÃµ½»¥³âÁ¿£¬ÄãÐèÒªµ÷ÓÃÏÂÃæµÄº¯Êý£º
int pthread_mutex_lock(pthread_mutex_t *mutex);
¸Ãº¯ÊýÓÃÀ´¸ø»¥³âÁ¿ÉÏËø£¬Ò²¾ÍÊÇÎÒÃÇÇ°ÃæËù˵µÄµÈ´ý²Ù×÷¡£»¥³âÁ¿Ò»µ©±»ÉÏËøºó£¬ÆäËûÏß³ÌÈç¹ûÏë¸ø¸Ã»¥³âÁ¿ÉÏËø£¬ÄÇô¾Í»á×èÈûÔÚÕâ¸ö²Ù×÷ÉÏ¡£Èç¹ûÔÚ´Ë֮ǰ¸Ã»¥³âÁ¿ÒѾ±»ÆäËûÏß³ÌÉÏËø£¬ÄÇô¸Ã²Ù×÷½«»áÒ»Ö±×èÈûÔÚÕâ¸öµØ·½£
Ïà¹ØÎĵµ£º
²ÉÓù²ÏíÄÚ´æͨÐŵÄÒ»¸öÏÔ¶øÒ×¼ûµÄºÃ´¦ÊÇЧÂʸߣ¬ÒòΪ½ø³Ì¿ÉÒÔÖ±½Ó¶ÁдÄڴ棬¶ø²»ÐèÒªÈκÎÊý¾ÝµÄ¿½±´¡£¶ÔÓÚÏñ¹ÜµÀºÍÏûÏ¢¶ÓÁеÈͨÐÅ·½Ê½£¬ÔòÐèÒªÔÚÄÚ
ºËºÍÓû§¿Õ¼ä½øÐÐËĴεÄÊý¾Ý¿½±´£¬¶ø¹²ÏíÄÚ´æÔòÖ»¿½±´Á½´ÎÊý¾Ý[1]£ºÒ»´Î´ÓÊäÈëÎļþµ½¹²ÏíÄÚ´æÇø£¬ÁíÒ»´Î´Ó¹²ÏíÄÚ´æÇøµ½Êä³öÎļþ¡£Êµ¼ÊÉÏ£¬½ø³ÌÖ®¼äÔÚ¹²
ÏíÄÚ´æʱ£¬²¢²»×ÜÊ ......
ÕªÒª£º ±¾ÎÄÊÇfind ÃüÁîµÄÏêϸ˵Ã÷£¬¿É¹óµÄÊÇÕë¶Ô²ÎÊý¾ÙÁ˺ܶàµÄʵÀý£¬´óÁ¿µÄÀýÖ¤£¬ÈóõѧÕ߸üΪÈÝÒ×Àí½â£»±¾ÎÄÊÇzhyflyÐÖÌùÔÚÂÛ̳ÖУ»ÎÒ¶Ô±¾ÎĽøÐÐÁËÔÙ´ÎÕûÀí£¬Îª·½±ã´ó¼ÒÔĶÁ£»
Ŀ¼
°æȨÉùÃ÷
Ç°ÑÔ£º¹ØÓÚfindÃüÁî
Ò»¡¢find ÃüÁî¸ñʽ
1¡¢findÃüÁîµÄÒ»°ãÐÎʽΪ£»
2¡¢findÃüÁîµÄ²ÎÊý£»
3¡¢findÃüÁîÑ¡Ï
4¡¢Ê¹ÓÃexe ......
Linux Ô¶³ÌµÇ¼·þÎñ£ºtelnetºÍssh
ͨ³£Çé¿öÏÂÔ¶³ÌµÇ¼ÎÒÃÇʹÓÃtelnet·þÎñ£¬Red Hat
Linux´øÓÐtelnet·þÎñÆ÷µÄÈí¼þ°ü£¬ÎÒÃÇÐèÒª°²×°telnet-serverºÍxinetdÁ½¸öÈí¼þ°ü£º
[root@rh73 ~]# rpm -ivh
/mnt/cdrom/RedHat/RPMS/telnet-server-0.17-20.i386.rpm
[root@rh73 ~]# rpm -ivh
/mnt/cdrom/RedHat/RPMS/xinetd-2.3.4-0 ......
64λ linux ±àÒëÁ´½Ó´í¿âµÄÎÊÌâ
ÔÚ64λ»úÆ÷ÏÂÃæ±àÒëÈí¼þµÄʱºò£¬¾³£»áÓöµ½±àÒëµÄʱºòÐèÒªÁ´½Ó64λµÄ¿â£¬µ«ÊDZàÒëʱÕÒµÄÈ´ÊÇ32λµÄ¿â£¬¿ÉÒÔͨ¹ýÈçϵİ취ǿÖƱàÒë³ÌÐòÈ¥ÕÒ64λµÄ¿â
LDFLAGS="-L/usr/lib64 -L/lib64" \
ÔÚÅäÖÃʱ¼ÓÉÏÕâôһ¸öÑ¡Ïî¼´¿É¡£
......
LinuxµÄÖ÷ÒªÌصã
¡¡¡¡×÷Ϊһ¸ö²Ù×÷ϵͳ£¬Linux¼¸ºõÂú×ãµ±½ñUnix²Ù×÷ϵͳµÄËùÓÐÒªÇó£¬Òò´Ë£¬Ëü¾ßÓÐUnix²Ù×÷ϵͳµÄ»ù±¾ÌØÕ÷¡£
1.·ûºÏPOSIX 1003.1±ê×¼
¡¡ ¡¡POSIX 1003.1±ê×¼¶¨ÒåÁËÒ»¸ö×îСµÄUnix²Ù×÷ϵͳ½Ó¿Ú£¬ÈκβÙ×÷ϵͳֻÓзûºÏÕâÒ»±ê×¼£¬²ÅÓпÉÄÜÔËÐÐUnix³ÌÐò¡£Unix¾ßÓзḻµÄÓ¦ÓóÌÐò£¬µ±½ñ¾ø ´ó¶àÊý²Ù×÷ϵͳ¶¼°Ñ ......