Re: [PARPORT] DMA and the parallel port

From: Blaise Gassend (blaise@gassend.com)
Date: Fri May 02 2003 - 18:38:23 EDT

  • Next message: Bob Tanner: "Re: [PARPORT] DMA and the parallel port"

    I'm not sure about a general introductory guide, but I can certainly
    give you a vague idea.

    Without DMA, any data that goes to or from memory has to be put there by
    the processor. If you read from the hard disk, data going from disk to
    the processor has to be read from the disk controller and written to
    memory. When you write to the hard disk, the processor reads data from
    memory and sends it to the memory controller. The same thing applies to
    data coming in or going out of the network card. Similarly, if you are
    printing, the processor is copying data from memory to the printer. If
    you have a webcam on your parallel port, the processor has to spend time
    reading data from the parallel port and putting it into memory.

    By this time you must be getting the general idea. If your program is
    donig a lot of IO (input from and output to peripherals), it is going to
    spend a lot of time simply copying data. In the case of the parallel
    port things are even worse because each access the parallel port takes
    about a microsecond. So each time you access it, your fancy gigahertz
    processor is waiting 1000 cycles for the access to take place.

    What is particularly frustrating, is that copying data from one place to
    another is a pretty brain dead activity that completely under-utilizes
    your processor (because it spends all its time waiting for data to come
    from memory or a peripheral). The activity is so simple, that it is
    possible for a much simpler component to take care of it, leaving the
    processor to its more important business. That much simpler component is
    the DMA (though it isn't really a standalone component anymore).

    The DMA's job in life is to copy data back and forth between memory and
    peripherals (it also sometimes does other things like helping refresh
    dynamic memory). It is a relatively small piece of hardware, unlike the
    processor, so it doesn't cost much to have it occupied by such a mundane
    task. So now when your processor wants to send data from memory to disk,
    it simply tells the DMA where to get the data and where to send it, and
    the DMA does all the tedious work. In the meantime, the processor is
    free to take care of all the other important tasks that you have for it
    to do.

    Does this answer your questions, or did you want something more
    technical?

    Quoted from Bob Tanner on Fri, May 02, 2003 at 04:23:18PM -0500.
    > Can someone point me to more information on what dma does?
    >
    > Prefer it to be in relationship to the parallel port, but a newbies guide to
    > dma (in general) would be acceptable too.
    >
    > I have to admit, I do not fully understand what dma does or what it's
    > important.
    > --
    > Bob Tanner <tanner@real-time.com> | Phone : (952)943-8700
    > http://www.mn-linux.org, Minnesota, Linux | Fax : (952)943-8500
    > Key fingerprint = AB15 0BDF BCDE 4369 5B42 1973 7CF1 A709 2CC1 B288
    >
    > -- To unsubscribe, send mail to: linux-parport-request@torque.net --
    > -- with the single word "unsubscribe" in the body of the message. --
    >

    -- To unsubscribe, send mail to: linux-parport-request@torque.net --
    -- with the single word "unsubscribe" in the body of the message. --



    This archive was generated by hypermail 2b29 : Fri May 02 2003 - 18:44:30 EDT