0% found this document useful (0 votes)
23 views

Unix Programming SHM

This C program creates a shared memory segment to share data between processes. It includes the header files for standard input/output and shared memory. The program gets a shared memory identifier and allocates 4096 bytes of shared memory, printing the identifier if successful. It then returns 0 to indicate the program completed.

Uploaded by

manish 123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Unix Programming SHM

This C program creates a shared memory segment to share data between processes. It includes the header files for standard input/output and shared memory. The program gets a shared memory identifier and allocates 4096 bytes of shared memory, printing the identifier if successful. It then returns 0 to indicate the program completed.

Uploaded by

manish 123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

#include<stdio.

h>
#include<sys/shm.h>
int main()
{
int shmid;
shmid = shmget(MY_SHM_ID, 4096,0666 | IPC_CREAT);
if(shmid>= 0 )
{
printf("\nCreated a shared memory segment %d\n",shmid);
}
return 0;
}

You might also like