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

Linux»·¾³½ø³Ì¼äͨÐÅ ¹²ÏíÄڴ棨Ï£©


ÔÚ¹²ÏíÄڴ棨ÉÏ£©ÖУ¬Ö÷ҪΧÈÆ×Åϵͳµ÷ÓÃmmap()½øÐÐÌÖÂ۵ģ¬±¾²¿·Ö½«ÌÖÂÛϵͳV¹²ÏíÄڴ棬²¢Í¨¹ýʵÑé½á¹û¶Ô±ÈÀ´²ûÊöÁ½ÕßµÄÒìͬ¡£ÏµÍ³V¹²ÏíÄÚ´æÖ¸µÄÊÇ°ÑËùÓй²ÏíÊý¾Ý·ÅÔÚ¹²ÏíÄÚ´æÇøÓò£¨IPC shared memory region£©£¬ÈκÎÏëÒª·ÃÎʸÃÊý¾ÝµÄ½ø³Ì¶¼±ØÐëÔÚ±¾½ø³ÌµÄµØÖ·¿Õ¼äÐÂÔöÒ»¿éÄÚ´æÇøÓò£¬ÓÃÀ´Ó³Éä´æ·Å¹²ÏíÊý¾ÝµÄÎïÀíÄÚ´æÒ³Ãæ¡£
ϵͳµ÷ÓÃmmap()ͨ¹ýÓ³ÉäÒ»¸öÆÕͨÎļþʵÏÖ¹²ÏíÄڴ档ϵͳVÔòÊÇͨ¹ýÓ³ÉäÌØÊâÎļþϵͳshmÖеÄÎļþʵÏÖ½ø³Ì¼äµÄ¹²ÏíÄÚ´æͨÐÅ¡£Ò²¾ÍÊÇ˵£¬Ã¿¸ö¹²ÏíÄÚ´æÇøÓò¶ÔÓ¦ÌØÊâÎļþϵͳshmÖеÄÒ»¸öÎļþ£¨ÕâÊÇͨ¹ýshmid_kernel½á¹¹ÁªÏµÆðÀ´µÄ£©£¬ºóÃ滹½«²ûÊö¡£
1¡¢ÏµÍ³V¹²ÏíÄÚ´æÔ­Àí
½ø³Ì¼äÐèÒª¹²ÏíµÄÊý¾Ý±»·ÅÔÚÒ»¸ö½Ð×öIPC¹²ÏíÄÚ´æÇøÓòµÄµØ·½£¬ËùÓÐÐèÒª·ÃÎʸù²ÏíÇøÓòµÄ½ø³Ì¶¼Òª°Ñ¸Ã¹²ÏíÇøÓòÓ³Éäµ½±¾½ø³ÌµÄµØÖ·¿Õ¼äÖÐÈ¥¡£ÏµÍ³V¹²ÏíÄÚ´æͨ¹ýshmget»ñµÃ»ò´´½¨Ò»¸öIPC¹²ÏíÄÚ´æÇøÓò£¬²¢·µ»ØÏàÓ¦µÄ±êʶ·û¡£ÄÚºËÔÚ±£Ö¤shmget»ñµÃ»ò´´½¨Ò»¸ö¹²ÏíÄÚ´æÇø£¬³õʼ»¯¸Ã¹²ÏíÄÚ´æÇøÏàÓ¦µÄshmid_kernel½á¹¹×¢Í¬Ê±£¬»¹½«ÔÚÌØÊâÎļþϵͳshmÖУ¬´´½¨²¢´ò¿ªÒ»¸öͬÃûÎļþ£¬²¢ÔÚÄÚ´æÖн¨Á¢Æð¸ÃÎļþµÄÏàÓ¦dentry¼°inode½á¹¹£¬Ð´ò¿ªµÄÎļþ²»ÊôÓÚÈκÎÒ»¸ö½ø³Ì£¨Èκνø³Ì¶¼¿ÉÒÔ·ÃÎʸù²ÏíÄÚ´æÇø£©¡£ËùÓÐÕâÒ»Çж¼ÊÇϵͳµ÷ÓÃshmgetÍê³ÉµÄ¡£
×¢£ºÃ¿Ò»¸ö¹²ÏíÄÚ´æÇø¶¼ÓÐÒ»¸ö¿ØÖƽṹstruct shmid_kernel£¬shmid_kernelÊǹ²ÏíÄÚ´æÇøÓòÖзdz£ÖØÒªµÄÒ»¸öÊý¾Ý½á¹¹£¬ËüÊÇ´æ´¢¹ÜÀíºÍÎļþϵͳ½áºÏÆðÀ´µÄÇÅÁº£¬¶¨ÒåÈçÏ£º
struct shmid_kernel /* private to the kernel */
{
struct kern_ipc_perm shm_perm;
struct file * shm_file;
int id;
unsigned long shm_nattch;
unsigned long shm_segsz;
time_t shm_atim;
time_t shm_dtim;
time_t shm_ctim;
pid_t shm_cprid;
pid_t shm_lprid;
};
¸Ã½á¹¹ÖÐ×îÖØÒªµÄÒ»¸öÓòÓ¦¸ÃÊÇshm_file£¬Ëü´æ´¢Á˽«±»Ó³ÉäÎļþµÄµØÖ·¡£Ã¿¸ö¹²ÏíÄÚ´æÇø¶ÔÏ󶼶ÔÓ¦ÌØÊâÎļþϵͳshmÖеÄÒ»¸öÎļþ£¬Ò»°ãÇé¿öÏ£¬ÌØÊâÎļþϵͳshmÖеÄÎļþÊDz»ÄÜÓÃread()¡¢write()µÈ·½·¨·ÃÎʵģ¬µ±²ÉÈ¡¹²ÏíÄÚ´æµÄ·½Ê½°ÑÆäÖеÄÎļþÓ³Éäµ½½ø³ÌµØÖ·¿Õ¼äºó£¬¿ÉÖ±½Ó²ÉÓ÷ÃÎÊÄÚ´æµÄ·½Ê½¶ÔÆä·ÃÎÊ¡£
ÕâÀïÎÒÃDzÉÓÃ[1]ÖеÄͼ±í¸ø³öÓëϵͳV¹²ÏíÄÚ´æÏà¹ØÊý¾Ý½á¹¹£º
 
ÕýÈçÏûÏ¢¶ÓÁкÍÐźŵÆÒ»Ñù£¬ÄÚºËͨ¹ýÊý¾Ý½á¹¹struct ipc_ids shm_idsά»¤ÏµÍ³ÖеÄËùÓй²ÏíÄÚ´æÇøÓò¡£ÉÏͼÖеÄshm_ids.entries±äÁ¿Ö¸ÏòÒ»¸öipc_id½á¹¹Êý×飬¶øÿ¸öipc_id


Ïà¹ØÎĵµ£º

LinuxÏÂApacheµÄ°²×°

µØÖ·£ºhttp://httpd.apache.org/
ÏÂÔصØÖ·£ºhttp://httpd.apache.org/download.cgi
1,½âѹËõ
tar -xzvf httpd-2.0.63.tar.gz
2,ÅäÖÃ
./configure --prefix=/usr/local/apache --enable-module=all --enable-shared=max
3,±àÒë
make
4,°²×°
make install
5,¹ÜÀí
apachectl start
apachectl stop
apachectl rest ......

linux tail ÃüÁîÏê½â£¡Linux ÎļþÄÚÈݲ鿴¹¤¾ß½éÉÜ

cat ÊÇÒ»¸öÎı¾Îļþ²é¿´ºÍÁ¬½Ó¹¤¾ß¡£²é¿´Ò»¸öÎļþµÄÄÚÈÝ£¬ÓÃcat±È½Ï¼òµ¥£¬¾ÍÊÇcat ºóÃæÖ±½Ó½ÓÎļþÃû¡£
±ÈÈ磺
[root@localhost ~]# cat /etc/fstab
ΪÁ˱ãÓÚÐÂÊÖµÜÐÖÁé»îÕÆÎÕÕâ¸ö¹¤¾ß£¬ÎÒÃǶà˵һµã³£ÓõIJÎÊý£»
1.0 cat Óï·¨½á¹¹£»
cat [Ñ¡Ïî] [Îļþ]...
Ñ¡Ïî
  -A, --show-all    &nbs ......

ÓÃNohupÃüÁîÈÃLinuxϵijÌÐòÔÚºǫִ́ÐÐ

Unix/LinuxÏÂÒ»°ãÏëÈÃij¸ö³ÌÐòÔÚºǫ́ÔËÐУ¬ºÜ¶à¶¼ÊÇʹÓà & ÔÚ³ÌÐò½áβÀ´ÈóÌÐò×Ô¶¯ÔËÐС£±ÈÈçÎÒÃÇÒªÔËÐÐmysqlÔÚºǫ́£º
¡¡¡¡/usr/local/mysql/bin/mysqld_safe –user=mysql &
¡¡¡¡µ«ÊÇÎÒÃǺܶà³ÌÐò²¢²»ÏómysqldÒ»Ñù¿ÉÒÔ×ö³ÉÊØ»¤½ø³Ì£¬¿ÉÄÜÎÒÃǵijÌÐòÖ»ÊÇÆÕͨ³ÌÐò¶øÒÑ£¬Ò»°ãÕâÖÖ³ÌÐò¼´Ê¹Ê¹Óà & ½á⣬Èç¹ ......

Linux sockaddr_in¸³Öµ

serv_addr.sin_family=AF_INET;
serv_addr.sin_port=htons(SERVPORT);
inet_pton(AF_INET,"127.0.0.1",&serv_addr.sin_addr);
IPµØַת»»º¯ÊýÓУºinet_pton,inet_addr,inet_aton,inet_ntoa£¬inet_ntop
Ç°Èý¸öÊǽ«ASCII×Ö·ûת»»³ÉÍøÂç×Ö½ÚÐò£»
×îºóÁ½¸öÊǽ«ÍøÂç×Ö½ÚÐòת»»³ÉASCII×Ö·û¡£
ÏÖÔÚÍƼöʹÓÃine ......

Linux±¾µØrootÃÜÂëÆƽⷽ·¨


£¨Ò»£©RedHat/CentOS/Fedora ϵͳÃÜÂëÆƽâ
¡¡¡¡1.ÔÚgrubÑ¡Ïî²Ëµ¥°´E½øÈë±à¼­Ä£Ê½¡£
¡¡¡¡2.±à¼­kernel ÄÇÐÐ×îºó¼ÓÉÏS£¨»òÕßSingle£©¡£
¡¡¡¡3.°´B£¬Æô¶¯µ½single-user mode¡£
¡¡¡¡4.½øÈëºóÖ´ÐÐÏÂÁÐÃüÁ
¡¡¡¡# mount -t proc proc /proc
¡¡¡¡# mount -o remount,rw /
¡¡¡¡#passwd
¡¡¡¡#sync
¡¡¡¡#reboot
£¨¶þ£©D ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ