2005-12-01 11:45:27

by Indrek Kruusa

[permalink] [raw]
Subject: [QUESTION] Filesystem like structure in RAM w/o using filesystem (not ramdisk)

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


2005-12-01 12:20:22

by Christian Hesse

[permalink] [raw]
Subject: Re: [QUESTION] Filesystem like structure in RAM w/o using filesystem (not ramdisk)

On Thursday 01 December 2005 12:45, Indrek Kruusa wrote:
> 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.
--
Christian


Attachments:
(No filename) (493.00 B)
(No filename) (190.00 B)
Download all attachments

2005-12-01 12:57:23

by Bernd Eckenfels

[permalink] [raw]
Subject: Re: [QUESTION] Filesystem like structure in RAM w/o using filesystem (not ramdisk)

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?

> 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

2005-12-05 16:01:25

by Rob Landley

[permalink] [raw]
Subject: Re: [QUESTION] Filesystem like structure in RAM w/o using filesystem (not ramdisk)

On Thursday 01 December 2005 05:45, Indrek Kruusa wrote:
> 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"...

> Thanks in advance,
> Indrek

Rob
--
Steve Ballmer: Innovation! Inigo Montoya: You keep using that word.
I do not think it means what you think it means.