[comp.sys.ibm.pc] paging for text editor or word processor

ted@imsvax.UUCP (04/01/87)

Jim "Jack" Frost: ODO

>In article <475@batcomputer.tn.cornell.edu> rjj@batcomputer.tn.cornell.edu (rjj) writes:

>>I am looking for an algorithm (written in 'C') that
>>would do demand disk paging from within a editor.
>>A language processor we are working on only has enough
>>buffer space available to keep 400 lines of text in
>>memory.  What is needed is a small routine that will
>>update the total document on disk, page out the last
>>least used pages from memory and  then read in more of
>>the text from the disk ( the reason for all this is that
>>the system will be run in language labs that have minimum
>>configuration IBM PC's). As far as I can tell, only
>>a couple of popular word processors can do this so it
>>might be trickier that it seems.  If anybody can point
>>me down a golden-paved path I would be very grateful.
>>	Rich Jaenson

>The simplest method of handling paged memory is to treat all of memory
>as paged (whether on or off disk) and only access it through certain
>routines, which take paging into consideration.  My wordprocessor used
>1K "pages" that were stored in linked lists.  If you came to a section
>in the list that had a flag set to indicate that it was paged, you
>swap out one page (take your pick -- use any algorithm you want to
>figure out which page to swap)...

May I suggest that, rather than lru or mru or any such standard
technique, the natural page to swap out in a text editor or word
processor would be the one containing text furthest from the cursor.
This would be fast also, since it would not involve any fancy
calculations or system time checks and would require comparing only two
pages, the ones on either end of those in memory.

Ted Holden
HT Enterprises