index array, shared in memory
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > index array, shared in memory




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    index array, shared in memory  
b83503104


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-03-04 02:13 AM

I want to create an index and put it in memory, and allow it to be
read by multiple programs (processes).
The index table looks like this:
1  231
2  91
3  147
...

There are million items, each row uses 2 int, so total size about
10MB.  I only know how to create this in memory and use it by the SAME
program which created it.  I have no idea how I could let it stay in
memory and be used by OTHER programs (and more than one at one time).
Thanks





[ Post a follow-up to this message ]



    Re: index array, shared in memory  
Dragan Cvetkovic


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-03-04 02:13 AM

b83503104@yahoo.com (b83503104) writes:

> I want to create an index and put it in memory, and allow it to be
> read by multiple programs (processes).
> The index table looks like this:
> 1  231
> 2  91
> 3  147
> ...
>
> There are million items, each row uses 2 int, so total size about
> 10MB.  I only know how to create this in memory and use it by the SAME
> program which created it.  I have no idea how I could let it stay in
> memory and be used by OTHER programs (and more than one at one time).
> Thanks

Put it into shared memory. Use shmget(), shmat() and friends.

HTH, Dragan


--
Dragan Cvetkovic,

To be or not to be is true. G. Boole      No it isn't.  L. E. J. Brouwer

!!! Sender/From address is bogus. Use reply-to one !!!





[ Post a follow-up to this message ]



    Re: index array, shared in memory  
Andrei Voropaev


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-03-04 02:13 AM

["Followup-To:" header set to comp.unix.programmer.]
On 2004-10-01, Dragan Cvetkovic <me@privacy.net> wrote:
> b83503104@yahoo.com (b83503104) writes:
> 
>
> Put it into shared memory. Use shmget(), shmat() and friends.

Maybe simply put it into file and then mmap it in your applications. man
mmap.

Andrei





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 12:20 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register