Subject: Re: can I open RAM?
To: village idiot <village_ldi0t@yahoo.com>
From: Chris Wareham <chris.wareham@iosystems.co.uk>
List: netbsd-help
Date: 05/01/2002 16:19:55
village idiot wrote:
>
> I don't know if this is exactly a NetBSD question,...
>
> I wonder, can I read/write to RAM, like I do a file? I
> am so dense, I don't know how to do this easily. What
> exactly is /dev/mem ?
>
> When I do a "cat /dev/mem" the output is way larger
> than RAM I think.
>
> My problem consists of the following:
>
> I have two applications, one receiver and one sender.
> They are connected through a raw AAL5 connection,
> using sockets. I want to put this to the test, but my
> disks are too slow (I think). Receiver can't write the
> data arriving, to its disk fast enough to keep up with
> the network. This is at least what I believe.
>
> Is there any way I can open and write to RAM like I do
> a file, that way I eliminate the disk as a source of
> noise. I can run as root, if needed.
>
> I would like to do something like fd =
> open("RAM",O_WRONLY|O_CREAT,0666);
>
> Can I swing this? Any help much appreciated.
>
If you're updating a fixed size file, then look at mmap(2)
and friends. I have an application which reads incoming
messages from a socket and updates a bunch of structures
in a mmapped file. This file is also read by a number of
statistics generating programs, and it is blisteringly
fast. This approach may be what you're are looking for.
Chris
--
chris.wareham@iosystems.co.uk (work)
cwareham@btinternet.com (home)