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

Ò»¸ö¹ØÓÚlinuxµÄÐźÅÁ¿¼¯µÄÎÊÌâ

#include <sys/sem.h>
#include <sys/ipc.h>
#include <stdio.h>
union semun{
int val;
struct semid_ds *buf;
unsigned short *array;
}
main()
{
int semid;
semid=semget(IPC_PRIVATE,2,IPC_CREAT|0666);
union semun sem,sem2;
sem.val=1;
sem2.val=0;
semctl(semid,0,SETVAL,sem);
semctl(semid,1,SETVAL,sem2);
if(fork()==0)
{int i;
struct sembuf sops={0,+1,IPC_NOWAIT},sops2={1,-1,IPC_NOWAIT};
for(i=0;i <1000;i++)
{
semop(semid,&sops,1);
printf("a\n");
semop(semid,&sops2,1);
}
}
else
{
int j;
struct sembuf sops={0,-1,IPC_NOWAIT},sops2={1,+1,IPC_NOWAIT};
for(j=0;j <1000;j++)
{
semop(semid,&sops2,1);
printf("b\n");
semop(semid,&sops,1);
}
}
}
ÏëҪʵÏÖababababµÄÊä³ö£¬¿ÉÊǺÃÏñ²»ÐУ¬½á¹ûÊÇÏÈÊä³öa£¬ÔÚÊä³öb,ÄÄÀï²»¶ÔÂð£¬ÇëÎÊÒ»ÏÂ

²»¼Ó¿ØÖƾÍÊÇËæ»úµÄ

¿ÉÊÇÎÒÒѾ­ÓÃÐźÅÁ¿¼¯À´¿ØÖÆÁË°¡£¬ÊDz»ÊÇÄǼ¸¸öPVº¯ÊýÓôíÁË°¡£¬ÎÒ²»´ó»áÓÃ

#include <sys/sem.h>
#include <sys/ipc.h>
#include <stdio.h>
union semun{
int val;
struct semid_ds *buf;
unsigned short *array;
}
main()
{
int semid;
semid=semget(IPC_PRIVATE,2,IPC_CREAT|0666);
union semun sem,sem2;
sem.val=0;


Ïà¹ØÎÊ´ð£º

linux 2.6 Äں˵ÄÅäÖÃÎļþÔÚÄÄÀï

Á½Ì¨»úÆ÷ÐͺÅÍêÈ«Ò»Ñù

ÏëÒª°Ñһ̨»úÆ÷µÄÄÚºËÅäÖÃÎļþ¿½±´¸øÁíÍâһ̨

RT


3Q
...

.config Òþ²ØµÄ ÔÚÄãÅäÖùýÄں˺ó¾ÍÉú³ÉÁË

lsÕý½â£¬ÔÚkernelÔ´Â붥²ãĿ¼ÖÐÓиö.configÎļþ£¬ÅäÖ ......

linux °²×°xinetdµÄÎÊÌâ

ÒòΪ°²×°cvsÒªÓõ½xinetd·þÎñ£¬·¢ÏÖ»úÆ÷ÉÏûÓС£¡£¾Í´ÓÍøÉÏÏÂÔØÁ˸ö×°ÉÏ£¬
SQL code:
[root@localhost ~]# rpm -qa xinetd
[root@localhost ~]# rpm -qa telnet
telnet-0.17-38.el5
[root@localhost ~]#
¸ ......

php±àдִÐÐlinux shellÃüÁîµÄ´úÂë

ʹÓÃPHPµÄexecº¯Êýµ÷ÓÃlinuxµÄshellÃüÁÈçdateÈ¥ÐÞ¸Äʱ¼ä»òshutdownȥʵÏֹػú/ÖØÆô£¬µ«ÊÇ·µ»ØÖµ¶¼ÊÇʧ°ÜµÄ¡£¾­¹ý¶à´ÎÊÔÑ飬È϶¨ÊÇûÓÐȨÏÞµÄÎÊÌâ¡£
ËùÒÔ£¬Ð¡µÜÔÚ´ËÇë½Ì¸÷룬ÈçºÎ²ÅÄÜÉèÖÃȨÏÞ£¬µ÷ÓÃlinux shellà ......

ÇëÎÊÓÐûÓÐÈ«ÖÐÎĵÄlinuxϵͳ£¿

ÎÒÓùýubuntu8.10°æ±¾£¬´ÓverycdÏÂÔصġ£

ÏÂÔغó£¬ÊÇ°ëÓ¢ÎÄ¡£ÇÒÎÒ¶ÔlinuxϵͳµÄ²Ù×÷Àí½â²»ÉÒò´Ë×°ÖÐÎÄÊäÈë·¨¶¼¸ãÁ˺þá£

È»ºó°´ÕÕÍøÉϵĽ̸̳üÐÂÖÐÎĽçÃ棬µ«ÊǸüÐÂÁË1ÍíÉϺóÌáʾÖжϡ­¡­Àס£
......

Linux Socket HTTPÇëÇóµÄÎÊÌ⣬¸ßÊÖ½ø£¡

СµÜ×î½üÐèÒªÒ»¸öÓÃsocket»ñÈ¡htmlÎĵµµÄ´úÂ룬µ«ÊÇÀÏÊDz»ÄÜ»ñÈ¡ÍêÕûµÄhtmlÔ´Âë¡£Ô­Òò²»Ã÷£¬Íû¸ßÊÖÖ¸µã£¡
C/C++ code:

char *Http_GET(char *host,int port,char *data) //·¢ËÍGETÇëÇó
{
char response[2 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ