delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/03/01/16:36:30

From: damon AT redshift DOT com (Damon Casale)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Using DMA for hard disk access?
Date: Thu, 01 Mar 2001 21:31:58 GMT
Organization: Posted via Supernews, http://www.supernews.com
Message-ID: <3a9ebeb5.501470@news.redshift.com>
References: <3a9e955b DOT 2750392 AT news DOT redshift DOT com> <3405-Thu01Mar2001215625+0200-eliz AT is DOT elta DOT co DOT il>
X-Newsreader: Forte Free Agent 1.21/32.243
X-Complaints-To: newsabuse AT supernews DOT com
Lines: 46
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

On Thu, 01 Mar 2001 21:56:26 +0200, "Eli Zaretskii"
<eliz AT is DOT elta DOT co DOT il> wrote:

>> I'm trying to squeeze the last ounce of speed out of this compression
>> program, and I'm wondering if switching to direct DMA calls, as
>> opposed to using the INT13h or INT21h disk read-write calls, would
>> help things much.  As far as programming in DJGPP goes, I know that it
>> takes a lot of CPU cycles to switch from protected mode to real mode,
>> and then back again, to make the interrupt calls.  Would I avoid that
>> by doing DMA calls instead?
>
>I'm not sure.  The conventional wisdom is that nowadays DMA doesn't
>gain too much when disks are concerned, but I never did anything like
>that myself, so it's hearsay.
>
>Keep in mind that while DMA moves data from the disk to memory or
>back, the system bus is not available.  Therefore, you will have bus
>contention with any other device that goes through the bus.  VGA, for
>example.

Would plain memory access (regardless of what it is) be going through
the same bus?  I'm guessing yes, so I'm not altogether sure that this
would help much, other than possibly avoiding the need to switch to
real mode and back for disk access.

>What portion of the program's run time does it spend in I/O (i.e. in
>INT 13h and INT 21h calls)?  If it's not 50% at least, it's probably
>not worth it to try to speed it up by switching to DMA.

With compression, it's in the range of 35-50%.  (I'd love to better
that ratio by finding a way to optimize my compression algorithm, but
I can't think of a good way to do that without changing some of the
more critical loops over to assembly.) Without compression, it's
upwards of 95%.

>> I'm not entirely sure how to tell the hard drive what sectors I want
>> to read or write, but I _think_ I know how to use the DMA I/O ports.
>> Where would I look for more detailed info on this?
>
>In case you didn't see it, the DJGPP FAQ has something about using DMA
>in section 18.13.

Yup, saw that already.  Thanks tho.  :-)

Damon Casale, damon AT WRONG DOT redshift DOT com (remove the obvious)
"Blood Money was 'a DMA design game'."

- Raw text -


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