Newsgroups: comp.os.os2.apps
From: des@inmos.co.uk (David Shepherd)
Subject: Re: better vdisk
X-Newsreader: TIN [version 1.1 PL8]
Date: Wed, 6 Jan 93 11:21:10 GMT

Eric Trepanier (eric@tgm.CAM.ORG) wrote:
: In article <1993Jan5.144041.15093@wraxall.inmos.co.uk> des@inmos.co.uk writes:
:  > Jussi M Peltoniemi (jpeltoni@niksula.hut.fi) wrote:
:  > : Is there better vdisk than the one that comes with os/2 2.0?
:  > : I mean vdisk that is swappable
:  > isn't this counter-productive. the whole idea of a vdisk is that the
:  > files are in memory and not on a (slow) disk. making it swapable will
:  > just chuck the files back out to disk.
: Uh-uh.  I've seen this on the Amiga and it is brilliant.  Most of the time,
: a virtual disk is empty -- it is best used to hold temporary files.  Thus,
: when the disk is particulary big (4Mb+), and empty, you litteraly end up
: wasting that precious memory.  Now, an intelligent RAM disk (like those
: found on the Amiga) will only "dynamically" allocate  memory as it needs
: it.  This can be real-RAM memory (as opposed to swappable disk memory).
: When the files are deleted from the RAM disk, the memory is released thus
: the RAM disk never wastes more system (RAM) memory then is needed to hold
: all its files, i.e. 0Kb when it's empty.  I've never seen such a RAM disk
: on a PC-based system though, whether DOS-based or OS/2-based.

Thinking about, i can see what you mean and that it would be useful ... 
What you describe sort of sounds like the TMPFS filing system under
SUNOS where the /tmp directory dynamically takes space out of the
swap partition. (so that occasional big temporary files don't need
a large amount of rarely used space on disk).

A dynamic vdisk could be useful. However it wouldn't be as fast as a
dedicated vdisk as when data was written to it there would always be
the possibility that something would have to be swapped out of physical
memory to make space for an expansion in the vdisk - This could lead to
major thrashing problems if an app writing data to a swap file was
constantly being swapped out by each write! However, using a sensible
quantisation of the space claimed when it was needed (i.e. if the vdisk
gets full claim an extra 500k) then this could be ok. Some similar
mechanism to the swapper file could be used to slowly shrink the
vdisk as space becomes available (again with a rule to always leave
say 500k free).

Using this you could have a vdisk that was no slower than a physical
disk and which would, probably, be much quicker.

One concern with this, though, is that we can end up with vast levels
of caching which may not all interact together well as 

writing to 
1) the dynamic vdisk which may write to 
2) the swap file which may put data in
3) the OS/2 disk cache which may write data to disk which goes into
4) the smart disk controller board cache which eventually goes into
5) the disk drives cache which eventually goes into
6) the disk

I think 3) doesn't apply as I've read that OS/2 doesn't cache the swap file
and 5) probably doesn't as I think disk drives only cache read data, but
who knows what people will think of next.

--------------------------------------------------------------------------
david shepherd: des@inmos.co.uk                     tel: 0454-616616 x 625
                inmos ltd, 1000 aztec west, almondsbury, bristol, bs12 4sq
                New Year Resolution for 1993: Start using capital letters.