TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: JOE DUNFORD
from: JERRY COFFIN
date: 1997-09-28 12:01:00
subject: read more than 64k

On (27 Sep 97) Joe Dunford wrote to Bob Stout...
 JD> I'm not sure that the basic answer is correct. I admit I've only
 JD> glanced at HUGEREAD.C but it seems to me that it is for shuffling
 JD> around large
 JD> blocks of memory(overcoming the offset limit), and not for "reading"
 JD> from a file.
I'd advise re-reading the code.
 JD> I'm afraid I don't follow you. When you say double buffering do you
 JD> mean some sort of windowing scheme ?
Double buffering means allocating a buffer in DOS memory space, and
doing the reading into that buffer, then copying from it into the user's
buffer, wherever they've specified it.  This accounts (in part) for the
fact that I/O tends to be slower under DOS extenders than under DOS
without the extender.
 JD> If you are using a good compiler that supports good extenders then
 JD> reading a 12-13 Mb file would be as simple as:
 JD> 
 JD> cTemp=malloc (13*1024*1024);
 JD> fread (&cTemp,13*1024*1024,1,FHandle);
The question isn't what the user's code looks like, but how fread is
implemented.  If you're using a full-blown protected OS like Windows NT
or Linux, this happens fairly directly.  However, if you're using a DOS
extender, the read has to be done into DOS memory (in the first meg.)
then copied from there to your buffer.
OS/2 falls about halfway between these two: it uses 16 bit protected
mode code for most device drivers, so device drivers can only address
the bottom 16 meg of RAM.  If you do a read into the bottom 16 meg of
RAM, it can be done directly, but if you do a read above that, double
buffering, or something similar, has to be done there as well.
Some hardware has the same basic limitation as OS/2: anything that does
bus-mastering on an ISA bus (e.g. Adaptect 1542 SCSI controllers) is
limited to reading/writing in the bottom 16 meg of physical memory
because that's all that can be addressed on an ISA bus.  This applies
regardless of the OS running that hardware.
    Later,
    Jerry.
--- PPoint 2.02
---------------
* Origin: Point Pointedly Pointless (1:128/166.5)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.