Shared memory in Linux: B-TREE of structures
Hello,
Anyone worked with shared memory in linux? I want to share a B-TREE of structures.
Does anyone have any idea?
Root or one user can give access to his/her data in memory for others.
Can you provide me a sample of few lines? Just two node of a simple structure.
What will be the client program, and what change need in server program.
Server:
#include<stdio.h>
int main()
{
struct NAME {
char name[30];
int id;
struct NAME *top;
struct NAME *down;
} *tm, *hd;
tm=(struct NAME *)malloc(sizeof(struct NAME));
tm->top=NULL;
strcpy(tm->name,"Zahid Hossain");
tm->id=1999;
hd=tm;
tm=(struct NAME *)malloc(sizeof(struct NAME));
tm->top=hd;
tm->down=NULL;
strcpy(tm->name,"Glynn Clements");
tm->id=2001;
hd->down=tm;
while(1)
{
printf("%s %d\n",hd->name, hd->id);
printf("[email protected] %s %d\n",hd->down->name, hd->down->id);
sleep(12);
}
}
Note: Once I have tried for string but did not work for structure or BTREE. Or I don't know how to implement it. Last time xmdvp helped me on the problem.
Alternative of shared memory.
Is there any alternative of shared memory?