Linux»·¾³½ø³Ì¼äͨÐÅ£¨Î壩——¹²ÏíÄÚ´æ
http://www.ibm.com/developerworks/cn/linux/l-ipc/part5/index1.html
¹²ÏíÄÚ´æ¿ÉÒÔ˵ÊÇ×îÓÐÓõĽø³Ì¼äͨÐÅ·½Ê½£¬Ò²ÊÇ×î¿ìµÄIPCÐÎʽ¡£Á½¸ö²»Í¬½ø³ÌA¡¢B¹²ÏíÄÚ´æµÄÒâ˼ÊÇ£¬Í¬Ò»¿éÎïÀíÄÚ´æ±»Ó³Éäµ½
½ø³ÌA¡¢B¸÷×ԵĽø³ÌµØÖ·¿Õ¼ä¡£½ø³ÌA¿ÉÒÔ¼´Ê±¿´µ½½ø³ÌB¶Ô¹²ÏíÄÚ´æÖÐÊý¾ÝµÄ¸üУ¬·´Ö®ÒàÈ»¡£ÓÉÓÚ¶à¸ö½ø³Ì¹²Ïíͬһ¿éÄÚ´æÇøÓò£¬±ØÈ»ÐèҪijÖÖͬ²½»úÖÆ£¬»¥
³âËøºÍÐźÅÁ¿¶¼¿ÉÒÔ¡£
²ÉÓù²ÏíÄÚ´æͨÐŵÄÒ»¸öÏÔ¶ø
Ò×¼ûµÄºÃ´¦ÊÇЧÂʸߣ¬ÒòΪ½ø³Ì¿ÉÒÔÖ±½Ó¶ÁдÄڴ棬¶ø²»ÐèÒªÈκÎÊý¾ÝµÄ¿½±´¡£¶ÔÓÚÏñ¹ÜµÀºÍÏûÏ¢¶ÓÁеÈͨÐÅ·½Ê½£¬ÔòÐèÒªÔÚÄں˺ÍÓû§¿Õ¼ä½øÐÐËĴεÄÊý¾Ý¿½±´£¬
¶ø¹²ÏíÄÚ´æÔòÖ»¿½±´Á½´ÎÊý¾Ý[1]£ºÒ»´Î´ÓÊäÈëÎļþµ½¹²ÏíÄÚ´æÇø£¬ÁíÒ»´Î´Ó¹²ÏíÄÚ´æÇøµ½Êä³öÎļþ¡£Êµ¼ÊÉÏ£¬½ø³ÌÖ®¼äÔÚ¹²ÏíÄÚ´æʱ£¬²¢²»×ÜÊǶÁдÉÙÁ¿Êý¾Ýºó
¾Í½â³ýÓ³É䣬ÓÐеÄͨÐÅʱ£¬ÔÙÖØн¨Á¢¹²ÏíÄÚ´æÇøÓò¡£¶øÊDZ£³Ö¹²ÏíÇøÓò£¬Ö±µ½Í¨ÐÅÍê±ÏΪֹ£¬ÕâÑù£¬Êý¾ÝÄÚÈÝÒ»Ö±±£´æÔÚ¹²ÏíÄÚ´æÖУ¬²¢Ã»ÓÐд»ØÎļþ¡£¹²ÏíÄÚ
´æÖеÄÄÚÈÝÍùÍùÊÇÔÚ½â³ýÓ³Éäʱ²Åд»ØÎļþµÄ¡£Òò´Ë£¬²ÉÓù²ÏíÄÚ´æµÄͨÐÅ·½Ê½Ð§ÂÊÊǷdz£¸ßµÄ¡£
LinuxµÄ2.2.xÄÚºËÖ§
³Ö¶àÖÖ¹²ÏíÄڴ淽ʽ£¬Èçmmap()ϵͳµ÷Óã¬Posix¹²ÏíÄڴ棬ÒÔ¼°ÏµÍ³V¹²ÏíÄÚ´æ¡£linux·¢Ðа汾ÈçRedhat
8.0Ö§³Ömmap()ϵͳµ÷Óü°ÏµÍ³V¹²ÏíÄڴ棬µ«»¹Ã»ÊµÏÖPosix¹²ÏíÄڴ棬±¾ÎĽ«Ö÷Òª½éÉÜmmap()ϵͳµ÷Óü°ÏµÍ³V¹²ÏíÄÚ´æAPIµÄÔÀí¼°Ó¦

Ò»¡¢ÄÚºËÔõÑù±£Ö¤¸÷¸ö½ø³ÌÑ°Ö·µ½Í¬Ò»¸ö¹²ÏíÄÚ´æÇøÓòµÄÄÚ´æÒ³Ãæ
1¡¢
page cache¼°swap cacheÖÐÒ³ÃæµÄÇø·Ö£ºÒ»¸ö±»·ÃÎÊÎļþµÄÎïÀíÒ³Ã涼פÁôÔÚpage cache»òswap
cacheÖУ¬Ò»¸öÒ³ÃæµÄËùÓÐÐÅÏ¢ÓÉstruct pageÀ´ÃèÊö¡£struct pageÖÐÓÐÒ»¸öÓòΪָÕëmapping £¬ËüÖ¸ÏòÒ»¸östruct
address_spaceÀàÐͽṹ¡£page cache»òswap
cacheÖеÄËùÓÐÒ³Ãæ¾ÍÊǸù¾Ýaddress_space½á¹¹ÒÔ¼°Ò»¸öÆ«ÒÆÁ¿À´Çø·ÖµÄ¡£
2¡¢ÎļþÓë
address_space½á¹¹µÄ¶ÔÓ¦£ºÒ»¸ö¾ßÌåµÄÎļþÔÚ´ò¿ªºó£¬Äں˻áÔÚÄÚ´æÖÐΪ֮½¨Á¢Ò»¸östruct
inode½á¹¹£¬ÆäÖеÄi_mappingÓòÖ¸ÏòÒ»¸öaddress_space½á¹¹¡£ÕâÑù£¬Ò»¸öÎļþ¾Í¶ÔÓ¦Ò»¸öaddress_space½á¹¹£¬Ò»¸ö
address_spaceÓëÒ»¸öÆ«ÒÆÁ¿Äܹ»È·¶¨Ò»¸öpage cache »òswap
cacheÖеÄÒ»¸öÒ³Ãæ¡£Òò´Ë£¬µ±ÒªÑ°Ö·Ä³¸öÊý¾Ýʱ£¬ºÜÈÝÒ׸ù¾Ý¸ø¶¨µÄÎļþ¼°Êý¾ÝÔÚÎļþÄÚµÄÆ«ÒÆÁ¿¶øÕÒµ½ÏàÓ¦µÄÒ³Ãæ¡£
3¡¢½ø³Ìµ÷ÓÃmmap()ʱ£¬Ö»ÊÇÔÚ½ø³Ì¿Õ¼äÄÚÐÂÔöÁËÒ»¿éÏàÓ¦´óСµÄ»º³åÇø£¬²¢ÉèÖÃÁËÏàÓ¦µÄ·ÃÎʱêʶ£¬µ«²¢Ã»Óн¨Á¢½ø³Ì¿Õ¼äµ½ÎïÀíÒ³ÃæµÄÓ³Éä¡£Òò´Ë£¬µ
Ïà¹ØÎĵµ£º
ÕâÊÇÔÚʵÑéÊҴ¾ÖÓòÍøʱµÄÅäÖÃдÔÚÕâÀï°É£¬µÈÔÚ»ØÒäÄǶδóѧÉú»îʱ»¹ÊǺÜÃÀºÃµÄ!
»·¾³£ºÍâÍøIP 202.206.249.186 ×ÓÍøÑÚÂë 255.255.255.0 ĬÈÏÍø¹Ø 202.206.249.1
ÄÚÍøIP192.168.0.1 ×ÓÍøÑÚÂë 255 ......
vi filename :´ò¿ª»òн¨Îļþ£¬²¢½«¹â±êÖÃÓÚµÚÒ»ÐÐÊ×
¡¡¡¡vi +n filename £º´ò¿ªÎļþ£¬²¢½«¹â±êÖÃÓÚµÚnÐÐÊ×
¡¡¡¡vi + filename £º´ò¿ªÎļþ£¬²¢½«¹â±êÖÃÓÚ×îºóÒ»ÐÐÊ×
¡¡¡¡vi +/pattern filename£º´ò¿ªÎļþ£¬²¢½«¹â±êÖÃÓÚµÚÒ»¸öÓëpatternÆ¥ÅäµÄ´®´¦
¡¡¡¡vi -r filename £ºÔÚÉÏ´ÎÕýÓÃvi±à¼Ê±·¢Éúϵͳ±ÀÀ££¬»Ö¸´filename
......
Õâ¸öÊÇÎÒÔÚÒ»±¾ÊéÉÏ¿´µ½µÄ£¬ÆäÖеÄһЩ´úÂëÎÒÓÐËù¸Ä±ä£¬Ð´¸ø¸÷λºÃÓѹ²Ïíһϣ¡
#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h&g ......
ÍêÉÆLinuxϵͳ
1.¿ª»ú×Ô¶¯¹ÒÔØwindow·ÖÇø
fedora10ËäÈ»ÄÜ×Ô¶¯¹ÒÔØ,µ«ÊǹÒÔصķÖÇøÓÐʱ»á²»ÈϺº×ÖÎļþ¼Ð
´ÓÖÕ¶ËÓÃvi»ògedit´ò¿ª/etc/fstab£¬ÔÚÆäÖÐÌí¼Ó£º
/dev/sda1 /mnt/1 ntfs default 0 0
×¢£ºµÚÒ»ÏîÊÇ·ÖÇøÇý¶¯µØÖ·
......
ºÜÔçÒÔÇ°,¾ÍÏë°Ñ×Ô¼ºÔÚ¿ª·¢ÏîĿʱ¹ØÓÚlinuxÊØ»¤½ø³ÌµÄ¼¼ÊõÕûÀíÒ»ÏÂ,·¢±íһƪÎÄÕÂ.½ñÌìÔÚÍøÉÏżȻÅöµ½ÓÐһƪдµÄͦ²»´íµÄÎÄÕÂ,ÕýºÃ¿ÉÒÔתÌù¹ýÀ´ºÍ´ó¼Ò·ÖÏí.
Linux Deamon±à³Ì·½·¨
ÊØ»¤½ø³Ì£¨Daemon£©ÊÇÔËÐÐÔÚºǫ́µÄÒ»ÖÖÌØÊâ½ø³Ì¡£Ëü¶ÀÁ¢ÓÚ¿ØÖÆÖն˲¢ÇÒÖ ......