Home » NO IDEA » IPC using shared memory

IPC using shared memory

Blog Stats

  • 14,863 hits
April 2013
M T W T F S S
« Mar   Oct »
1234567
891011121314
15161718192021
22232425262728
2930  

#include<sys/types.h>
#include<sys/shm.h>
#include<sys/ipc.h>
#include<stdio.h>
int main()
{
int shmid;
key_t key=0*10;
shmid=shmget(key,100,IPC_CREAT|0666);
if(shmid<0)
printf("\nfirst SHMID failed\n");
else
printf("\n first SHMID succeded id=%d\n",shmid);
shmid=shmget(key,101,IPC_CREAT|0666);
if(shmid<0)
printf("\nsecond SHMID failed\n");
else
printf("\n secondt SHMID succeded id=%d\n",shmid);
shmid=shmget(key,90,IPC_CREAT|0666);
if(shmid<0)
printf("\nthird SHMID failed\n");
else
printf("\n third SHMID succeded id=%d\n",shmid);
return 0;
}

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: