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

6)Linux³ÌÐòÉè¼ÆÈëÃÅ

6)Linux³ÌÐòÉè¼ÆÈëÃÅ--ÏûÏ¢¹ÜÀí
Ç°ÑÔ:LinuxϵĽø³ÌͨÐÅ(IPC)
LinuxϵĽø³ÌͨÐÅ(IPC)
POSIXÎÞÃûÐźÅÁ¿
System VÐźÅÁ¿
System VÏûÏ¢¶ÓÁÐ
System V¹²ÏíÄÚ´æ
1¡£POSIXÎÞÃûÐźÅÁ¿ Èç¹ûÄãѧϰ¹ý²Ù×÷ϵͳ,ÄÇô¿Ï¶¨ÊìϤPV²Ù×÷ÁË.PV²Ù×÷ÊÇÔ­×Ó
²Ù×÷.Ò²¾ÍÊDzÙ×÷ÊDz»¿ÉÒÔÖжϵÄ,ÔÚÒ»¶¨µÄʱ¼äÄÚ,Ö»Äܹ»ÓÐÒ»¸ö½ø³ÌµÄ´úÂëÔÚCPUÉÏÃæ
Ö´ÐÐ.ÔÚϵͳµ±ÖÐ,ÓÐʱºòΪÁË˳ÀûµÄʹÓúͱ£»¤¹²Ïí×ÊÔ´,´ó¼ÒÌá³öÁËÐźŵĸÅÄî. ¼ÙÉè
ÎÒÃÇҪʹÓÃһ̨´òÓ¡»ú,Èç¹ûÔÚͬһʱ¿ÌÓÐÁ½¸ö½ø³ÌÔÚÏò´òÓ¡»úÊä³ö,ÄÇô×îÖյĽá¹û»á
ÊÇʲôÄØ.ΪÁË´¦ÀíÕâÖÖÇé¿ö,POSIX±ê×¼Ìá³öÁËÓÐÃûÐźÅÁ¿ºÍÎÞÃûÐźÅÁ¿µÄ¸ÅÄî,ÓÉÓÚLi
nuxֻʵÏÖÁËÎÞÃûÐźÅÁ¿,ÎÒÃÇÔÚÕâÀï¾ÍÖ»ÊǽéÉÜÎÞÃûÐźÅÁ¿ÁË. ÐźÅÁ¿µÄʹÓÃÖ÷ÒªÊÇÓÃ
À´±£»¤¹²Ïí×ÊÔ´,ʹµÄ×ÊÔ´ÔÚÒ»¸öʱ¿ÌÖ»ÓÐÒ»¸ö½ø³ÌËùÓµÓÐ.Ϊ´ËÎÒÃÇ¿ÉÒÔʹÓÃÒ»¸öÐźÅ
µÆ.µ±ÐźŵƵÄֵΪij¸öÖµµÄʱºò,¾Í±íÃ÷´Ëʱ×ÊÔ´²»¿ÉÒÔʹÓÃ.·ñÔò¾Í±í>ʾ¿ÉÒÔʹÓÃ.
ΪÁËÌṩЧÂÊ,ϵͳÌṩÁËÏÂÃ漸¸öº¯Êý
POSIXµÄÎÞÃûÐźÅÁ¿µÄº¯ÊýÓÐÒÔϼ¸¸ö:
#include <semaphore.h>
int sem_init(sem_t *sem,int pshared,unsigned int value);
int sem_destroy(sem_t *sem);
int sem_wait(sem_t *sem);
int sem_trywait(sem_t *sem);
int sem_post(sem_t *sem);
int sem_getvalue(sem_t *sem);
sem_init´´½¨Ò»¸öÐźŵÆ,²¢³õʼ»¯ÆäֵΪvalue.pshared¾ö¶¨ÁËÐźÅÁ¿ÄÜ·ñÔÚ¼¸¸ö½ø³Ì
¼ä¹²Ïí.ÓÉÓÚÄ¿Ç°Linux»¹Ã»ÓÐʵÏÖ½ø³Ì¼ä¹²ÏíÐźŵÆ,ËùÒÔÕâ¸öÖµÖ»Äܹ»È¡0. sem_dest
royÊÇÓÃÀ´É¾³ýÐźŵƵÄ.sem_waitµ÷Óý«×èÈû½ø³Ì,Ö±µ½ÐźŵƵÄÖµ´óÓÚ0.Õâ¸öº¯Êý·µ»Ø
µÄʱºò×Ô¶¯µÄ½«ÐźŵƵÄÖµµÄ¼þÒ».sem_postºÍsem_waitÏà·´,Êǽ«ÐźŵƵÄÄÚÈݼÓһͬ
ʱ·¢³öÐźŻ½ÐѵȴýµÄ½ø³Ì..sem_trywaitºÍsem_waitÏàͬ,²»¹ý²»×èÈûµÄ,µ±ÐźŵƵÄÖµ
Ϊ0µÄʱºò·µ»ØEAGAIN,±íʾÒÔºóÖØÊÔ.sem_getvalueµÃµ½ÐźŵƵÄÖµ.
ÓÉÓÚLinux²»Ö§³Ö,ÎÒÃÇûÓа취ÓÃÔ´³ÌÐò½âÊÍÁË.
Õ⼸¸öº¯ÊýµÄʹÓÃÏ൱¼òµ¥µÄ.±ÈÈçÎÒÃÇÓÐÒ»¸ö³ÌÐòÒªÏòÒ»¸öϵͳ´òÓ¡»ú´òÓ¡Á½Ò³.ÎÒÃÇ
Ê×ÏÈ´´½¨Ò»¸öÐźŵÆ,²¢Ê¹Æä³õʼֵΪ1,±íʾÎÒÃÇÓÐÒ»¸ö×ÊÔ´¿ÉÓÃ.È»ºóÒ»¸ö½ø³Ìµ÷ÓÃse
m_waitÓÉÓÚÕâ¸öʱºòÐźŵƵÄֵΪ1,ËùÒÔÕâ¸öº¯Êý·µ»Ø,´òÓ¡»ú¿ªÊ¼´òÓ¡ÁË,ͬʱÐźŵÆ
µÄֵΪ0 ÁË. Èç¹ûµÚ¶þ¸ö½ø³ÌÒª´òÓ¡,µ÷ÓÃsem_waitʱºò,ÓÉÓÚÐźŵƵÄֵΪ0,×ÊÔ´²»¿É
ÓÃ,ÓÚÊDZ»×èÈûÁË.µ±µÚÒ»¸ö½ø³Ì´òÓ¡Íê³ÉÒÔºó,µ÷ÓÃsem_postÐźŵƵÄֵΪ1ÁË,Õâ


Ïà¹ØÎĵµ£º

LinuxÏÂÈçºÎ°ÑIO¿Õ¼äÓ³Éäµ½Óû§½ø³Ì¿Õ¼ä£¿


ÆäʵÊǸöÂù¼òµ¥µÄÎÊÌâ¡£ÔÚLDD3µÄµÚ15ÕÂÉÏÓÐд£¨¼û“Remapping Specific I/O Regions”ÕâÒ»½Ú£©¡£²»¹ýµ±Ê±×÷ÕßÑ¡ÔñÁËÒ»¸ö´íÎóµÄ×ö·¨£ºÏÈ°ÑÕâ¿éIO¿Õ¼äÓÃioremapÓ³Éäµ½ÁËÄں˿ռ䣬ȻºóÔÚÓû§½ø³Ì·ÃÎʱ»Ó³ÉäµÄµØÖ·Ëù²ú ÉúµÄȱҳÖжÏÀÓÃvmalloc_to_pageµÃµ½page£¬·µ»Ø¸øÓû§½ø³Ì¡£
È»¶ø£¬vmalloc_to_pageû·¨Óà ......

ÍêÉÆLinuxϵͳ

 
ÍêÉÆLinuxϵͳ
1.¿ª»ú×Ô¶¯¹ÒÔØwindow·ÖÇø
   
fedora10ËäÈ»ÄÜ×Ô¶¯¹ÒÔØ,µ«ÊǹÒÔصķÖÇøÓÐʱ»á²»ÈϺº×ÖÎļþ¼Ð
 
 ´ÓÖÕ¶ËÓÃvi»ògedit´ò¿ª/etc/fstab£¬ÔÚÆäÖÐÌí¼Ó£º
 /dev/sda1 /mnt/1 ntfs default 0 0
 ×¢£ºµÚÒ»ÏîÊÇ·ÖÇøÇý¶¯µØÖ·
   ......

linuxÇý¶¯¿ª·¢Ñ§Ï°±Ê¼Ç£¨¶þ£©

                scull µÄMakefile
Makefile½Å±¾ÈçÏÂËùʾ¡£
--------------------------------------------------------------------------------
KERNEL_MAKE := -C /home/zhoumin/hi3511/Hi3511_VSSDK_V1.1.2.1/pub/kbuild-LESS_REL
PWD := $(shell pwd ......

linuxÏÂʹÓÃthunderbirdÊÕ·¢hotmailºÍgmail

      windowsÏÂʹÓÃfoxmailºÜÈÝÒ×ÉèÖÃhotmailºÍgmail£¬×ªµ½linuxºó£¬·¢ÏÖevolution²»Ì«ºÃʹ£¬ÓʼþÐÅÏ¢µÄ±àÂëû·¨ÉèÖã¬gbk±àÂëµÄÓʼþÖ÷ÌâÏÔʾÂÒÂ룬ֻºÃ»»³Éthunderbird¡£
      thunderbird±¾Éí²»Ö§³ÖhotmailÕâÀàwebmailµÄÊÕ·¢£¬ÐèÒªÏÂÔزå¼þwebmailºÍhotmail£¬ÐèÒª½ÓÊÕyahooµÄ ......

ÉîÈëdz³ö LinuxÉ豸Çý¶¯×èÈûÓë·Ç×èÈû (select poll)


×èÈû²Ù×÷ÊÇÖ¸£¬ÔÚÖ´ÐÐÉ豸²Ù×÷ʱ£¬Èô²»ÄÜ»ñµÃ×ÊÔ´£¬Ôò½ø³Ì¹ÒÆðÖ±µ½Âú×ã¿É²Ù×÷µÄÌõ¼þÔÙ½øÐвÙ×÷¡£·Ç×èÈû²Ù×÷µÄ½ø³ÌÔÚ²»ÄܽøÐÐÉ豸²Ù×÷ʱ£¬²¢²»¹ÒÆð¡£±»¹ÒÆðµÄ½ø³Ì½øÈësleep״̬£¬±»´Óµ÷¶ÈÆ÷µÄÔËÐжÓÁÐÒÆ×ߣ¬Ö±µ½µÈ´ýµÄÌõ¼þ±»Âú×ã¡£
ÔÚLinuxÇý¶¯³ÌÐòÖУ¬ÎÒÃÇ¿ÉÒÔʹÓõȴý¶ÓÁУ¨wait queue£©À´ÊµÏÖ×èÈû²Ù×÷¡£wait queueºÜÔ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ