linuxÁ½¸ö³ÌÐòͨ¹ý¹²ÏíÄÚ´æÍ¨ÐŵÄÒ»¸ö¼òµ¥Àý×Ó
д¹²ÏíÄÚ´æ³ÌÐò£º
/*
* File: server.cpp
* Author: centos
*˵Ã÷£º´Ó¼üÅ̶ÁÈëÊý¾Ý£¬´æ·ÅÔÚ¹²ÏíÄÚ´æÖС£
* Created on 2010Äê3ÔÂ1ÈÕ, ÏÂÎç3:44
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#define BUF_SIZE 1024
#define MYKEY 114
int main(int argc, char** argv)
{
int shmid;
char *shmptr;
struct shmid_ds shmbuf;
system("ipcrm -M114"); //µ÷ÊÔ³ÌÐòʱÓÃ
shmid = shmget(MYKEY, BUF_SIZE, (IPC_CREAT |0777) );
if ( -1 == shmid )
{
printf("server shmget error!\n");
fprintf(stderr, "Error: %d - %s\n", errno, strerror(errno));
exit(1);
}
shmptr = (char *) (shmat(shmid, 0, 0)) ;
if ( -1 == (int) shmptr )
{
printf("server shmat error!\n");
fprintf(stderr, "Error: %d - %s\n", errno, strerror(errno));
if(shmctl(shmid,IPC_RMID,&shmbuf) < 0)
{
perror("shmctl error");
fprintf(stderr, "Error: %d - %s\n", errno, strerror(errno));
}
exit(1);
}
strcpy(shmptr,"this is a test. \n");
while(1)
{
printf("Please input:");
scanf("%s",shmptr) ;
while ('\n' != getchar() );
// fflush(stdin);
// printf("your input: %s\n", shmptr);
if (! strcmp(shmptr,"quit")) break;
}
shmdt(shmptr);
if(shmctl(shmid,IPC_RMID,&shmbuf) < 0) perror("shmctl error");
return (EXIT_SUCCESS);
}
¶Á¹²ÏíÄÚ´æµÄ³ÌÐò£º
/*
* File: main.cpp
* Author: centos
*
˵Ã÷£º´Ó¹²ÏíÄÚ´æÖжÁÈ¡Êý¾Ý£¬ÏÔʾµ½ÆÁÄ»ÉÏ¡£
* Created on 2010Äê3ÔÂ2ÈÕ, ÉÏÎç10:47
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#define BUF_SIZE 1024
#define M
Ïà¹ØÎĵµ£º
Linuxϲ鿴֧³ÖµÄÐźÅÁбí:
~$ kill -l
1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL
5) SIGTRAP 6) SIGABRT 7) SIGBUS 8) SIGFPE
9) SIGKILL 10) SIGUSR1 11) SIGSEGV 12) SIGUSR2
13) SIGPIPE 14) SIGALRM 15) SIGTERM 17) SIGCHLD
18) SIGCONT 19) SIGSTOP 20) SIGTSTP 21) SIGTTIN
22) SIGTTOU 23) SIGUR ......
LinuxϼӹÒÎļþϵͳµÄС½á
ѧϰ²Ù×÷ϵͳʱÎÒÃǶ¼Á˽⵽ÎļþϵͳÊDzÙ×÷ϵͳµÄÖØÒª×é³É²¿·ÖÖ®Ò»¡£ÎļþϵͳÓкܶàÖÖÀàÐÍ£¬±È
windowsµÄfat¡¢fat32£»LinuxµÄext¡¢ext2»òext3£»FreeBSDµÄufsµÈµÈ¡£ÔÚʹÓÃLinuxµÄ¹ý³Ì£¬Ò²³£³£Linux
²Ù×÷ϵͳʹÓÃÐéÄâÎļþϵͳVFS£¬Í¨¹ýVFS¿ÉÒÔÖ±½Ó´æÈ¡ÆäËüÒѱ»ÄÚºËÖ§³ÖµÄ¸÷ÖÖÎļþϵͳ£¬ÓÃÆðÀ´¾Í ......
ÔÚ³ÌÐò²»Ñ°³£Í˳öʱ£¬Äں˻áÔÚµ±Ç°¹¤×÷Ŀ¼ÏÂÉú³ÉÒ»¸öcoreÎļþ£¨ÊÇÒ»¸öÄÚ´æÓ³Ïñ£¬Í¬Ê±¼ÓÉϵ÷ÊÔÐÅÏ¢£©¡£Ê¹ÓÃgdbÀ´²é¿´coreÎļþ£¬¿ÉÒÔָʾ³öµ¼Ö³ÌÐò³ö´íµÄ´úÂëËùÔÚÎļþºÍÐÐÊý¡£
1.coreÎļþµÄÉú³É¿ª¹ØºÍ´óСÏÞÖÆ
1£©Ê¹ÓÃulimit -cÃüÁî¿É²é¿´coreÎļþµÄÉú³É¿ª¹Ø¡£Èô½á¹ûΪ0£¬Ôò±íʾ¹Ø±ÕÁ˴˹¦ÄÜ£¬²»»áÉú³ÉcoreÎļþ¡£
......
LinuxÏÂÈí¼þ¡¢PHPºÍPerlµÄÄ£¿éµÈ¶¼ÊµÏÖÁË×Ô¶¯°²×°£¬ÕæµÄºÜ·½±ã£¬±¾Îļòµ¥½éÉÜһϡ£
linuxÏ¿ÉÒÔʹÓÃyum¹¤¾ß£¬RedhatÏÂ×Ô¶¯´øÓУº
yum list php* //¿ÉÒԲ鿴phpµÄÏà¹ØÄ£¿é
yum install php //°²×°phpÕâ¸öÄ£¿é
phpÄ£¿éµÄ×Ô¶¯°²×°(ÀûÓÃpecl.php.netºÍpear.php.netÔÚÏß°²×°)£º
ÀûÓÃpearºÍpecl¹¤¾ß£¬Ê×ÏÈÐèÒª° ......
1.±àÒë°²×°libevent
2.±àÒë°²×°Memcached
ÔÚÎÒдÕâÆªÎÄÕµÄʱºò£¬libeventÒѾÓÐ1.4.8Îȶ¨°æ
£¬Memcached ServerÒѾÓÐ1.3.0°æ±¾
¡£±¾ÎľÍÒÔÕâÁ½¸ö°æ±¾ÎªÀý£¬ÎÒµÄgccÊÇgcc version 3.3.4 (Debian 1:3.3.4-7)¡£
Ê×ÏȰ²×°libevent
wget http://www.monkey.org/~provos/libevent-1.4.8-stable.tar.gz
tar zxvf libeven ......