[comp.unix.wizards] Virtual Memory Filesystem

m5@lynx.UUCP (Mike McNally ) (05/05/88)

Could one of the cognoscenti fill me in on this ``virtual memory file
system'' of ``4.4''BSD?  Is it like the Multics file system (about which I 
know almost nothing)?  How does it handle multiple connections to the 
same file?  Why is it better than open(), close(), read(), and write()?

I'm just curious.

-- 
Mike McNally of Lynx Real-Time Systems

uucp: lynx!m5 (maybe pyramid!voder!lynx!m5 if lynx is unknown)

chris@mimsy.UUCP (Chris Torek) (05/06/88)

In article <3711@lynx.UUCP> m5@lynx.UUCP (Mike McNally ) writes:
>Could one of the cognoscenti

More like Illuminati :-)

>fill me in on this ``virtual memory file system'' of ``4.4''BSD?

It is just a file system (presumably /tmp might be one of these) in
which files are not written to any sort of backing store unless the
system `feels like it', and if and when they *are* written, they are
written in a way that does not recover from crashes.  In particular,
this file system will use free memory pages, unless there are few; then
the pages may get pushed to swap space.

A major reason for the existence of this file system is so that
swap space has a name in the file system:

	fd = new_temp_file();
	res = mmap(addr, len, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, off);

would get what amounts to zero-filled space, a la the existing sbrk().
This obviates the need for a `magic' file descriptor and/or a MAP_SWAP
flag when all you want is blank swap-backed memory.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris@mimsy.umd.edu	Path:	uunet!mimsy!chris

barnett@vdsvax.steinmetz.ge.com (Bruce G. Barnett) (05/06/88)

In article <3711@lynx.UUCP> m5@lynx.UUCP (Mike McNally (Man from Mars)) writes:
|Could one of the cognoscenti fill me in on this ``virtual memory file
|system'' of ``4.4''BSD?

Another 'feature' is that commands like
	cp humongeous-file /dev/null
will take 0 seconds.

Imagine the benchmarks!!! 



-- 
	Bruce G. Barnett 	<barnett@ge-crd.ARPA> <barnett@steinmetz.UUCP>
				uunet!steinmetz!barnett

guy@gorodish.Sun.COM (Guy Harris) (05/07/88)

> Another 'feature' is that commands like
> 	cp humongeous-file /dev/null
> will take 0 seconds.

Almost:

	Script started on Fri May  6 11:49:27 1988
	gorodish$ cat /etc/motd
	SunOS Release 4.0 (GORODISH) #267: Thu May 5 14:49:36 PDT 1988
	gorodish$ time cp /vmunix /dev/null

	real	0m0.13s
	user	0m0.03s
	sys	0m0.08s

You *do* have to spend some time starting up the program, opening the file,
"mmap"ping the pages, etc..