home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / volume.11 / text0067.txt < prev    next >
Encoding:
Internet Message Format  |  1987-07-18  |  1.6 KB

  1. From: johnl@ima.ISC.COM (John R. Levine)
  2.  
  3. In article <8250@ut-sally.UUCP> boba@iscuva.ISCS.COM (Bob Alexander) writes:
  4. >[interpretive languages would work better if they could page their data
  5. >memory like compiled languages do, so how about a vread() call that maps
  6. >instead of reading?]
  7.  
  8. When we were designing AIX, the Sys V port for the RT PC, the same question
  9. of file mapping came up, this time in the context of doing data base work.
  10. The original proposal was for something like the vread() call, but we
  11. eventually decided on, essentially:
  12.  
  13.     pointer = filemap(fd);
  14.  
  15. where fd is an open file descriptor.  It maps the entire file into the
  16. address space, somewhere, and gives you a pointer to it.  It fails if there
  17. isn't enough address space.  This had the advantage over the vread() approach
  18. that it generalizes better for file writing -- if the file is mapped
  19. read/write, anything you write to the segment goes into the file, adding
  20. new blocks into the file if need be.  If you don't want the file's size to be a
  21. multiple of a page, use ftruncate() to set its length.
  22.  
  23. Notice that vread() can easily be simulated by this scheme, but not vice
  24. versa.  I agree that this scheme fails dismally if you don't actually have
  25. paged memory, but I'd rather have this as the underlying call and vread() as
  26. a library routine that maps on systems where it can and reads on systems
  27. where it can't.
  28.  
  29. John Levine, ima!johnl or Levine@YALE.somethingorother
  30. ---
  31. John R. Levine, Javelin Software Corp., Cambridge MA +1 617 494 1400
  32. { ihnp4 | decvax | cbosgd | harvard | yale }!ima!johnl, Levine@YALE.something
  33. U.S. out of New Mexico!
  34.  
  35. Volume-Number: Volume 11, Number 68
  36.  
  37.