home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!news.acns.nwu.edu!uicvm.uic.edu!u16244
- Organization: University of Illinois at Chicago
- Date: Sunday, 3 Jan 1993 04:05:16 CST
- From: David James Alexander Hanley <U16244@uicvm.uic.edu>
- Message-ID: <93003.040516U16244@uicvm.uic.edu>
- Newsgroups: comp.os.msdos.programmer
- Subject: Simulating virtual RAM in c++
- Lines: 41
-
- There is a project I have had in mind to try for some time but have not
- started on it quite yet. It would give you virtual arrays for data and
- objects in c++ under plain ole MSDOS. Here is the basic idea:
-
- There are some disk memory allocation functions. They can be called on
- to allocate, store, retreive, and free memory off a "disk heap". There is
- a cache that provides the possibility that some of this data will never
- be written to the disk, and will just be allocated and freed. This is
- important.
-
- There are several templates for creating arrays and pointers.
-
- The arrays would work by overloading of the [] operator. Writes to the
- array would be written to the disk. Reads would be read, and forked over.
- I think this could be implemented for arrays, arrays of objects, and
- to a lesser degree, pointers.
-
- example:
-
- #include "diskaray.h>
-
- ...
-
- DISK_ARRAY<CUSTOMER_RECORD> records[ 10000 ];
- CUSTOMER_RECORD record;
- ..
-
- get_new_record( &record )
-
- records[ x ] = record;
- ....
- record = records[ y ];
-
- Unfortunately, you can't access the array directly :
- records[ a ].name;
-
- It isn't as pretty as pure virtual RAM, but this WILL work under ms-dos
- in c++. A similar trick could be written in C, pascal, or other languages,
- I guess, but it (probably) wouldn't be as pretty.
-
- Ya know, this is a good idea. I should do this. When I have time...
-