Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!uwm.edu!rpi!crdgw1!uakari.primate.wisc.edu!sdd.hp.com!decwrl!elroy.jpl.nasa.gov!usc!ucsd!hub.ucsb.edu!6600m00n From: 6600m00n@ucsbuxa.ucsb.edu (Jihad 'R US) Newsgroups: comp.os.msdos.programmer Subject: Re: Virtual Memory for the Heap Message-ID: <6017@hub.ucsb.edu> Date: 27 Jul 90 10:39:20 GMT References: <2628@mindlink.UUCP> Sender: news@hub.ucsb.edu Reply-To: 6600m00n@ucsbuxa.ucsb.edu Organization: UCSB, Cell 105a Lines: 43 In-reply-to: a35@mindlink.UUCP's message of 25 Jul 90 16:34:43 GMT In article <2628@mindlink.UUCP> a35@mindlink.UUCP (Bruce Atherton) writes: I'm looking for the best method of implementing virtual memory on 80x86 machines under MSDOS. Specifically, it has to allow swapping of the heap, rather than code. The method that is the simplest to implement and least buggy would be preferable. I just received Turbo C++ and was thinking of using VROOMM, but it appears to only swap overlays of code. Is there any way to allow it to swap from the heap? Do I have to overload the -> operator so that it works with pages, or can VROOMM take care of that for me (and if so, how?). VROOM will not swap data. The main problem with swapping data is that it is accessed 'asyncronously'. i.e. You never know when you will need to be in, since pointers can point anywhere. Code is always accesed with calls, and can be routed through a overlay maneger. ( setjmp, longjmp could cause problems . . .) One way of dealing with this is to only use access to memory through 'handles' ( picked the idea up from _mac_ programing.) and have a byte that says if the info is in main memory ( in which case you use the pointer in the handle structure) or not, in which case you use the (ems|xms|ext|disk) handle you have setup to load the handle into main memory( and load out any needed to make space). You could even put a byte in for 'locking' the pointer so it does not get swapped out. What about using _handle in Zortech C++? It sounds like it would be easy for bugs to creep in, from the description I read. I would also like to hear about any heap manager toolboxes and how they work. Finally, is there a speed advantage to any of these methods over using a disk caching system? Yes: disk caching doesn't do diddly for speeding up writing data. Not so important with code( how often do you write self modifing code) very important with data. I would be grateful for any information on these questions. happy to reply. Rob Blair 6600m00n@ucsbuxa.ucsb.edu 'Yea, brother . . .'