www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/06/13/09:33:20

Date: Tue, 13 Jun 1995 08:15:19 -0400
From: kagel AT quasar DOT bloomberg DOT com
To: kwasik AT lodz2 DOT p DOT lodz DOT pl
Cc: DJGPP AT SUN DOT SOE DOT CLARKSON DOT EDU
Subject: Re: Mapping files to memory?
Reply-To: kagel AT ts1 DOT bloomberg DOT com

   Date: Tue, 13 Jun 1995 10:56:06 CET
   From: kwasik AT lodz2 DOT p DOT lodz DOT pl

   From:	MX%"kagel AT ts1 DOT bloomberg DOT com"
   >   Is there a somewhat painless way in djgpp to map a file directly to
   >   memory?  So that a person could do something like this:
[DELETED]
   >
   >Some UNIX flavorsdo, noteably System V.4, do offer a memory mapped I/O
   >facility.  However, this is not a compiler feature but an OS feature.  Such a
   >facility is not available in DJGPP, yet.  Want to write it? :-)


	   I'm not sure I understand well what the first sender wanted to
   do but what about streams ?

For those not familiar with memory mapped I/O: I believe the facility first
appeared on DEC10 and DEC20 systems under TOPS10/20.  The idea is to logically
map a file to a block of memory and thereafter treat the file as a large array.
Where full functionality is supported, writing to the array is reflected in the
file.  The OS handles page faulting accessed portions of the file on a demand
basis and forcing writes of modified pages back to disk when accessed by other
processes.  It is a neat facility and can allow code to become simpler as you
treat with a (potentially) huge array which is really demand paged virtual
memory read from the file as if being re-read from a swap disk.

I used it mapped I/O in DEC20s (here I expose my age) map a very large database
which had to be accessed sometimes row-wise and sometimes column-wise.  This
would have entailed either two copies of the data in different formats (with
all the problems attach to data duplication) or VERY complex and inefficient
code to read the database and reformat in memory manually.  The mapping
facility kept the code manageable.

-- 
Art S. Kagel, kagel AT ts1 DOT bloomberg DOT com

Variety is the soul of pleasure.  --  Aphra Behn

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019