Skip to contentSkip to conversation

Filesystem like structure in RAM w/o using filesystem (not ramdisk)

QUESTION Indrek Kruusa 4 participants 4 messages Dec 1, 2005 – Dec 5, 2005

lore
Share & tools
lore
#0 lore raw

Hello!

As I have understood the accessing ramdisk goes through the same kernel path which is meant for accessing slow block device (i_nodes caching etc.). Is there any other common way (some API above shared memory?) to create/open/read/write globally accessible hierarchical datablocks in RAM? Could it be possibly faster than ramdisk?

Thanks in advance,
Indrek

#1 lore raw
Quoted 7 lines · Indrek Kruusa

Hello!

As I have understood the accessing ramdisk goes through the same kernel path which is meant for accessing slow block device (i_nodes caching etc.). Is there any other common way (some API above shared memory?) to create/open/read/write globally accessible hierarchical datablocks in RAM? Could it be possibly faster than ramdisk?

You should take a look at tmpfs, I think that is what you search for.

Signature · 1 line
Christian
#2 lore raw
In reply to Indrek Kruusa
Quoted 4 lines · In article <[email protected]> you wrote:

As I have understood the accessing ramdisk goes through the same kernel path which is meant for accessing slow block device (i_nodes caching etc.). Is there any other common way (some API above shared memory?) to create/open/read/write globally accessible hierarchical datablocks in RAM?

SYSV IPC Shared Memory?

Quoted 1 line

Could it be possibly faster than ramdisk?

I think if you mmap tmpfs files it is pretty good, which is what libc is doing for shm emulation.

Gruss
Bernd

#3 lore raw
In reply to Indrek Kruusa
Quoted 7 lines · Indrek Kruusa

Hello!

As I have understood the accessing ramdisk goes through the same kernel path which is meant for accessing slow block device (i_nodes caching etc.). Is there any other common way (some API above shared memory?) to create/open/read/write globally accessible hierarchical datablocks in RAM? Could it be possibly faster than ramdisk?

You can use ramfs which stores data in the page cache (no block device backing it, and no filesystem driver). That's about as simple as you're going to get.

An expanded version of ramfs is tmpfs. This allows you to set size limits (which you need to allow anybody other than root write access to one of these things; otherwise you can fill up memory and trivially bring down the system), and also allows the data to be swapped out (ramfs pins the dirty pages in memory, since there's no backing block device for it to be flushed to it just vetoes all attempts to do so. Tmpfs substitutes the normal swap mechanism, whatever swap partitions or swap files you've set up.)

I have no idea what would happen if you tried to enable a swap file on a tmpfs mount, but since only root could be try that particular bit of peversity, it's almost certainly a "don't do that then"...

Quoted 2 lines

Thanks in advance,
Indrek

Rob

Signature · 2 lines
Steve Ballmer: Innovation!  Inigo Montoya: You keep using that word.
I do not think it means what you think it means.