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

Linux½ø³Ì¼äͨѶ֮ÐźÅÁ¿

Ò». ʲôÊÇÐźÅÁ¿
ÐźÅÁ¿(Semaphore)-- Ï൱һ¸öÐźŵƣ¬³ÌÐòÀïÊÇÒ»¸ö·Ç¸ºÕûÊý£¬±íʾ״̬.
¿ÉÒÔÓÃÀ´±£»¤Á½¸ö»ò¶à¸ö¹Ø¼ü´úÂë¶Î£¬ÕâЩ¹Ø¼ü´úÂë¶Î²»Äܲ¢·¢µ÷Óá£ÔÚ½øÈëÒ»¸ö¹Ø¼ü´úÂë¶Î֮ǰ£¬Ï̱߳ØÐë»ñÈ¡Ò»¸öÐźÅÁ¿¡£
Èç¹û¹Ø¼ü´úÂë¶ÎÖÐûÓÐÈκÎỊ̈߳¬ÄÇôÏ̻߳áÁ¢¼´½øÈë¸Ã¿òͼÖеÄÄǸö²¿·Ö¡£Ò»µ©¸Ã¹Ø¼ü´úÂë¶ÎÍê³ÉÁË£¬ÄÇô¸ÃÏ̱߳ØÐëÊÍ·ÅÐźÅÁ¿¡£
ÆäËüÏë½øÈë¸Ã¹Ø¼ü´úÂë¶ÎµÄÏ̱߳ØÐëµÈ´ýÖ±µ½µÚÒ»¸öÏß³ÌÊÍ·ÅÐźÅÁ¿¡£ÎªÁËÍê³ÉÕâ¸ö¹ý³Ì£¬ÐèÒª´´½¨Ò»¸öÐźÅÁ¿£¬
È»ºó½«Acquire Semaphore ÒÔ¼°Release Semaphore ·Ö±ð·ÅÖÃÔÚÿ¸ö¹Ø¼ü´úÂë¶ÎµÄÊ×Ä©¶Ë¡£È·ÈÏÕâЩÐźÅÁ¿ÒýÓõÄÊdzõʼ´´½¨µÄÐźÅÁ¿¡£
ÐźÅÁ¿£ºÒ»¸öÕûÊý£»
´óÓÚ»òµÈÓÚ0ʱ´ú±í¿É¹©²¢·¢½ø³ÌʹÓõÄ×ÊԴʵÌåÊý£»
СÓÚ0ʱ´ú±íÕýÔڵȴýʹÓÃÁÙ½çÇøµÄ½ø³ÌÊý£»
ÓÃÓÚ»¥³âµÄÐźÅÁ¿³õʼֵӦ´óÓÚ0£»
Ö»ÄÜͨ¹ýP¡¢VÔ­Óï²Ù×÷¶ø¸Ä±ä£»
ÐźÅÁ¿ÔªËØ×é³É£º
1¡¢±íʾÐźÅÁ¿ÔªËصÄÖµ£»
2¡¢×îºó²Ù×÷ÐźÅÁ¿ÔªËصĽø³ÌID
3¡¢µÈ´ýÐźÅÁ¿ÔªËØÖµ+1µÄ½ø³ÌÊý£»
4¡¢µÈ´ýÐźÅÁ¿ÔªËØֵΪ0µÄ½ø³ÌÊý£»
¶þ¡¢Ö÷Òªº¯Êý
1.1 ´´½¨ÐźÅÁ¿
int semget(
key_t key,  //±êʶÐźÅÁ¿µÄ¹Ø¼ü×Ö£¬ÓÐÈýÖÖ·½·¨£º1¡¢Ê¹ÓÃIPC——PRIVATEÈÃϵͳ²úÉú£¬ 2¡¢ÌôÑ¡Ò»¸öËæ»úÊý£¬3¡¢Ê¹ÓÃftok´ÓÎļþ·¾¶ÃûÖвúÉú
int nSemes, //ÐźÅÁ¿¼¯ÖÐÔªËظöÊý
int flag    //IPC_CREAT£»IPC_EXCL Ö»ÓÐÔÚÐźÅÁ¿¼¯²»´æÔÚʱ´´½¨
)
³É¹¦£º·µ»ØÐźÅÁ¿¾ä±ú
ʧ°Ü£º·µ»Ø-1
1.2 ʹÓÃftokº¯Êý¸ù¾ÝÎļþ·¾¶Ãû²úÉúÒ»¸ö¹Ø¼ü×Ö
key_t ftok(const char *pathname,int proj_id);
·¾¶Ãû³Æ±ØÐëÓÐÏàӦȨÏÞ
1.3 ¿ØÖÆÐźÅÁ¿
int semctl(
int semid, //ÐźÅÁ¿¼¯µÄ¾ä±ú
int semnum, //ÐźÅÁ¿¼¯µÄÔªËØÊý
int cmd, //ÃüÁî
/*union senum arg */... //
)
³É¹¦£º·µ»ØÏàÓ¦µÄÖµ
ʧ°Ü£º·µ»Ø-1
ÃüÁîÏêϸ˵Ã÷:
cmd: IPC_RMID ɾ³ýÒ»¸öÐźÅÁ¿
IPC_EXCL Ö»ÓÐÔÚÐźÅÁ¿¼¯²»´æÔÚʱ´´½¨
IPC_SET ÉèÖÃÐźÅÁ¿µÄÐí¿ÉȨ
SETVAL ÉèÖÃÖ¸¶¨ÐźÅÁ¿µÄÔªËصÄֵΪ agc.val
GETVAL »ñµÃÒ»¸öÖ¸¶¨ÐźÅÁ¿µÄÖµ
GETPID »ñµÃ×îºó²Ù×Ý´ËÔªËصÄ×îºó½ø³ÌID
GETNCNT »ñµÃµÈ´ýÔªËرäΪ1µÄ½ø³ÌÊý
GETZCNT »ñµÃµÈ´ýÔªËرäΪ0µÄ½ø³ÌÊý
union senum ¶¨ÒåÈçÏ£º
union senum{
int val;
struct semid_ds *buf;
unsigned short * array;
}agc;
ÆäÖÐ semid_ds ¶¨ÒåÈçÏ£º
struct semid_ds{
struct ipc_pem sem_pem; /


Ïà¹ØÎĵµ£º

Linux mysql ·þÎñÆ÷ÂýµÄÔ­Òò

Õ⼸ÌìLinux·þÎñÆ÷ºÜÂý,ºÜ׿±ÕÒ²»µ½½â¾ö°ì·¨!ºó°Ù¶ÈÏà¹Ø×ÖÑÛ,²éÕÒµ½ÊÇMySQLµÄÎÊÌâ,
ÈçÏÂΪ½â¾ö·½°¸
:
Á¬½ÓMySQLËÙ¶ÈÂýµÄ½â¾ö·½·¨.
PHPÔ¶³ÌÁ¬½ÓMYSQLËÙ¶ÈÂý,ÓÐʱԶ³ÌÁ¬½Óµ½MYSQLÓÃʱ4-20Ãë²»µÈ,±¾µØÁ¬½ÓMYSQLÕý³£,³öÏÖÕâÖÖÎÊÌâµÄÖ÷ÒªÔ­ÒòÊÇ,ĬÈÏ°²×°µÄ
MYSQL¿ªÆôÁËDNSµÄ·´Ïò½âÎö,ÔÚMY.CNF(UNIX»òLINUXϵͳÏÂ)»òMY.INI ......

LinuxÏ¿ÉÒÔÌæ»»ÔËÐÐÖеijÌÐòô?

½ñÌì±»ÅóÓÑÎʼ°“LinuxÏ¿ÉÒÔÌæ»»ÔËÐÐÖеijÌÐòô£¿”£¬ÒÔÇ°ÒÀÏ¡¼ÇµÃLinuxÏÂÊÇ¿ÉÒԵģ¨¶øWindows¾Í²»Èã©£¬ÓÚÊÇËæ¿Ú´ðµÀ“OK”¡£½á¹ûÅóÓÑ·¢À´Ò»¸öÖ´Ðнá¹û£º£¨testÕýÔÚÔËÐÐÖУ©
# cp test2 test
cp: cannot create regular file `test': Text file busy
¿´ÆðÀ´ÊdzÌÐò±»Õ¼Óã¬ÎÞ·¨¸²¸Ç¡£ÓÚÊÇ×Ô¼ºÓÖÔÙ× ......

LinuxÖ®ÃüÁî

1.date :ÏÔʾÈÕÆÚ
%:::z   ʱÇø
 
2. cal :ÏÔʾÈÕÀú£¨ºáÅÅ£©£¬ncal£¨ÊúÅÅ£©
3. bc :µ÷ÓüÆËãÆ÷
   ÓÃ/×÷³ý·¨ÔËËãʱ£¬¿ÉÏÈÓÃÖ¸Áî scale=number£¨number±íʾÏÔʾµÄСÊýµãλÊý£© ÔÙ×ö³ý·¨ÔËË㣬ʹµÃ¿ÉÒÔÏÔʾСÊýµãºó(number)λ¡££¨bcĬÈÏÖ»ÏÔʾÕûÊý£©
   Í˳ö¼ÆËãÆ÷£º quit
4.[Tab] ......

LinuxÏÂApacheÓëJboss·þÎñÆ÷ÅäÖÃÕûºÏʵÏÖ·½°¸

Ŀ¼
1 ÒýÑÔ... 3
1.1 ±³¾°... 3
1.2 ±àдĿµÄ... 3
1.3 ¶¨Òå... 3
1.4 ²Î¿¼×ÊÁÏ... 3
2. ApacheÓëJBoss·þÎñÆ÷¼ò½é... 3
2.1 Apache·þÎñÆ÷... 3
2.2 JBoss·þÎñÆ÷... 3
3. ApacheÓëJBoss·þÎñÆ÷ÅäÖÃÕûºÏ... 3
3.1 ÈÃApacheÓëJBossÒ»Æð¹¤×÷... 3
3.1.1 ¼ò½é... 3
3.1.2 »·¾³... 3
3.1.3 °²×°... 4
3.1.4 ÅäÖÃ... ......

LinuxÖÐÈçºÎÊÍ·ÅcacheÄÚ´æ free


ÒòΪLINUX
µÄÄÚºË
»úÖÆ£¬Ò»°ãÇé¿öϲ»ÐèÒªÌØÒâÈ¥ÊÍ·ÅÒѾ­Ê¹ÓõÄcache¡£ÕâЩcacheÆðÀ´µÄÄÚÈÝ¿ÉÒÔÔö¼ÓÎļþÒÔ¼°µÄ¶ÁдËٶȡ£
ÏÈ˵ÏÂfreeÃüÁîÔõô¿´ÄÚ´æ
[root@ahsq proc]# free
total used free shared buffers cached
Mem: 515588 295452 220136 0 2060 64040
-/+ buffers/cache: 229352 286236
Swap: 682720 112 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ