Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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ÃüÁîÐÐÐÞ¸ÄIP¡¢Íø¹Ø¡¢DNSµÄ·½·¨

·½Ê½Ò»£º
ifconfig eth0 192.168.1.18 netmask 255.255.255.0
˵Ã÷£º¸ÃÖÖ·½Ê½¿ÉÒÔʹ¸Ä±ä¼´Ê±ÉúЧ£¬ÖØÆôºó»á»Ö¸´ÎªÔ­À´µÄIP
·½Ê½¶þ£º
vi /etc/sysconfig/network-scripts/ifcfg-eth0
˵Ã÷£º¸Ã·½Ê½ÒªÖØÆôºóÉúЧ£¬ÇÒÊÇÓÀ¾ÃµÄ
Èç¹ûÒªÁ¢¼´¸ü¸ÄÇÒÓÀ¾ÃÉúЧ£¬¾ÍÖ»ÄÜÒÔÉÏÁ½ÖÖ·½Ê½Í¬Ê±Ê¹ÓÃÁË¡£
ÒÔÉÏÊÇͨ¹ýlinuxÃüÁîÐÐÐÞ¸ÄIPµÄ· ......

Linux´ÅÅÌ´æ´¢Çø¹ÜÀíµÄÉîÈë½âÎö

Linux´ÅÅÌ´æ´¢Çø¹ÜÀíËãµÄÉÏÒ»¸ö¼¼ÇÉ£¬ºÜ¶àÅóÓÑÔÚÕâÉÏÃæ³£³£ÎÊÎÒ£¬½ñÌìÎҾͰÑÕâ·½ÃæµÄ¶«Î÷»ã×Üһϣ¬´ÓLinuxÌØÓеĽ»»»·ÖÇøµÄÔ­Àí¿ªÊ¼½éÉÜLinux´ÅÅÌ´æ´¢Çø¹ÜÀíµÄÔ­Àí¼°¼¼ÇÉ¡£
Linux´ÅÅÌ´æ´¢Çø¹ÜÀíÔ­Àíƪ
1. ½»»»¿Õ¼äÊÇʲô
Linux ÖÐµÄ ½»»»¿Õ¼ä£¨Swap space£© ÔÚÎïÀíÄڴ棨RAM£©±»³äÂúʱ±»Ê¹Óá£Èç¹ûϵͳÐèÒª¸ü¶àµÄÄÚ´æ×Ê ......

LINUXÈýÖÖÉÏÍø·½Ê½×ܽá

netmask ipµØÖ· broadcast ×ÓÍøÑÚÂë gateway Íø¹Ø dns DNS·þÎñÆ÷ 
vmwareÈýÖÖÍøÂçÁ¬½ÓÉÏÍøÉèÖ㺠
²é¿´VMNET1ºÍVMNET8µÄIP£¬Íø¹ØÐÅÏ¢£¬¿ÉÒÔipconfigÃüÁî
1
.ÇŽӷ½Ê½(bridge) : 
ĬÈÏʹÓÃvmnet0 
½«ÐéÄâ»úµÄipÉèÖÃÓëÖ÷»úͬÍø¶ÎδʹÓÃip,ÆäÓàÓëÖ÷»úÏàͬ: 
ipµØÖ·ÓëÖ÷»úͬ¶ÎÏàÒì, 
×ÓÍ ......

linuxϵÄdeamon½ø³Ì

Éè¼ÆÒ»¸ölinuxϵÄdeamon½ø³Ì£¬¹Ø¼üÖ»Óм¸¸ö£º
1.forkÁ½´Î¡£
2.forkµÚÒ»´ÎºÍµÚ¶þ´ÎÖ®¼ä³ÉΪ½ø³Ì×éÍ·¡£
3.¸Ä±ä¹¤×÷Ŀ¼¡£
4.ºöÂÔÐźš£
5.ÉèÖöÁдÑÚÂë¡£
Ò»ÏÂÊÇÒ»¸ö´ÓÍøÂçËѼ¯µ½µÄÀý³Ì£¬·Ç³£ºÃµÄÑÝʾÁËÉÏÊöÒªµã£¬´æ´Ë±¸Íü¡£
#include
#include
#include
#include
void main(int argc, char ** argv)
{
tim ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ