DMA Question
Page 1 of 2 12 LastLast
Results 1 to 15 of 26

Thread: DMA Question

  1. #1
    Join Date
    Apr 2004
    Location
    Essex, UK
    Posts
    3,313

    DMA Question

    Hi all

    Dont worry, this one shouldnt be a brain frizzler like the last one

    Righto: DMA

    Direct Memory Access. The way I understand it, this 'feature' lets devices access the memory directly, without going through the CPU, therefore reducing workload on the CPuU and letting devices access the memory resources quicker...

    Question is, does it really bypass the CPU completely? I thought EVERYTHING had to go through the CPU...

    Here's my theory. Is it that DMA simply 'reserves' a portion of the memery for that device, so that when that devices needs to, it just says to the CPU 'I need to access this address range' instead of 'allocate me a memory range'...thereby making it quicker and less stressful but not bypassin the CPU completely?

    Or is it that simply the device talks with the memory controller directly??

    Sorry guys, and thanks

    Hong

  2. #2
    Join Date
    Apr 2000
    Location
    Sheboygan, WI
    Posts
    53,391
    Well that is about what webopedia says also.
    http://www.webopedia.com/TERM/D/DMA.html

    Short for direct memory access, a technique for transferring data from main memory to a device without passing it through the CPU. Computers that have DMA channels can transfer data to and from devices much more quickly than computers without a DMA channel can. This is useful for making quick backups and for real-time applications.

    Now watch it, as this link may cause a fuse to blow.
    http://cnx.rice.edu/content/m11867/latest/
    And a excerp:
    "Direct memory access is system that can control the memory system without using the CPU. On a specified stimulus, the module will move data from one memory location or region to another memory location or region. While it is limited in its flexibility, there are many situations where automated memory access is much faster than using the CPU to manage the transfers. Systems like the ADC, DAC and PWM capturing all require frequent and regular movements of memory out of their respective systems. The DMA can be configured to handle moving the collected data out of the peripheral module and into more useful memory locations (like arrays). Only memory can be accessed this way, but most peripheral systems, data registers, and control registers are accessed as if they were memory. The DMA is intended to be used in low power mode because it uses the same memory bus as the CPU and only one or the other can use the memory at the same time.
    The DMA system is organized into three largely independent parts. Though the three compete for the same memory bus, they have can be configured for independent triggers and memory regions. "

  3. #3
    Join Date
    Apr 2004
    Location
    Essex, UK
    Posts
    3,313
    Thanks Train!

    But alas...

    The definition from Webopedia makes sense, but lacks detail. The quote (and indeed the link you provided) is a bit too in-depth!! Sorry!! Indeed, I think I just blew another couple of fuses!!

    There are too many terms and acronyms there I dont know.

    To simplify this:

    Or is it that simply the device talks with the memory controller directly??
    Yes or No?

    We can go into detail a little later, if need be!!

  4. #4
    Join Date
    Apr 2000
    Location
    Sheboygan, WI
    Posts
    53,391
    Yes it talks directly.

    All the mumbp jumo means it bypasses the cpu thus speeding things up.

  5. #5
    Join Date
    Apr 2004
    Location
    Essex, UK
    Posts
    3,313
    Yes it talks directly.
    Sorry to be picky train, but does that mean directly with the memory OR the memory controller?

  6. #6
    Join Date
    Apr 2000
    Location
    Sheboygan, WI
    Posts
    53,391
    Originally posted by hongman
    Sorry to be picky train, but does that mean directly with the memory OR the memory controller?
    Yes, it can write dirctly to the ram. To quote "The DMA channel will copy the data from the starting memory location or block to the destination memory location or block. There are many variations on this."

    Hope I did not lose you with that.

  7. #7
    Join Date
    Apr 2004
    Location
    Essex, UK
    Posts
    3,313
    Many Thanks Train

  8. #8
    Join Date
    Apr 2000
    Location
    Sheboygan, WI
    Posts
    53,391

  9. #9
    DrMDJ is offline Virtual PC Specialist!!!
    Join Date
    Apr 2000
    Location
    NJ, USA
    Posts
    8,428
    Well, at least this question doesn't immediately cause one's head to start pounding. Train seems to have pretty much got ya covered, but I'll through in a couple thoughts.

    First, on this issue of "directly communicating with memory"... Nothing, repeat nothing, directly interfaces with the actual memory (the memory sticks, the memory chips on the sticks) without going through the memory controller(s). The controllers provide the only electrical interface to the memory, and they also are the only things that have the built-in logic (code) to actual do the directing of traffic (so to speak) and issue the commands to actual get a piece of data in to the actual memory. So, whether you're talking about memory actually being accessed whether in conjunction with DMA or anything else, the memory controller(s) are in the picture. But, by convention it is common to leave the memory controllers out of the equation when talking about accessing memory. Much the same way we don't talk about some communication flowing throw say the north or south bridges of the chipset, or through the ide cable enroute to a disk drive, etc, etc. Though these things might not be explicitely mentioned as being in the flow of things they by default have to be because they provide an uncircumventable link (piece in the connection) to the piece of hardware. Follow?

    Now, there are actually 2 types of DMA and that sometimes seem to get treated as the same, but they aren't. There's the kind of generic or "regular" or "conventional" DMA, and then there's what's called Bus Mastering DMA.

    Let me stop and make a point here... Both types allow the CPU's involvement in various operations to be greatly reduced, freeing it to devote cycles to other things. Now ultimately the CPU (with few exceptions) is not cut out entirely/totally from an i/o operation, even when DMA is used. But as I say, its involvement is minimized greatly. Basically it can initiate the operation (I/O), turn the execution and management of the operation over to other hardware, and basically say "let me know when you've done what I've asked you to do" (which may then require the cpu to get involved again, such as when it needs to do something with data presented it from, say, a hard drive). Anyway...

    The "regular" DMA (referred to above) is the older, original type DMA, and not really used that much today. Any time you hear/see references to DMA "channels" then what's being talked about is this older DMA. The channels are simply electrical paths, tied to a DMA controller, which has some intelligence to manage the transfers. This type of DMA only is applicable to devices attached through and communicated to via the ISA bus. Examples are parallel port printers, maybe modems, etc. Today's hard drives and such do not use this type of DMA. As said, this type of DMA involves the use of DMA channels, and devices that use this type of DMA get DMA channels (there are 8) assigned to them (another "resource", just like IRQs and I/O address ranges). You will (or can) see these assignments in something like Windows Device Manager. Now this "regular" DMA did/does (as said) remove a lot of burden/involvement from the CPU. But it had/has too many limitations to make it really viable and worthwhile for many devices. Like I said: a) it uses dedicated channels, which are finite in number, b) it only can be used by devices operated through the ISA bus, and c) it (because of things related to a and b and some other related stuff) is a bit cimbersome and does not offer tremendous speed advantages. So that's where Bus Mastering DMA comes in.

    Bus Mastering DMA is what people are using and dealing with most of the time these days. This is the type of DMA invovled when you deal with things like hard drives, optical drives, etc. Bus Mastering DMA uses no channels, no DMA controllers. The communications are directly between the peripherals/devices and memory (subject to my caveat above) where the i/o data and commands are stored related to a read or a write operation. There is no DMA controller sitting in the middle acting as a traffic cop (so to speak) like with conventional DMA. Bus mastering DMA is used with (applies to) devices communicating via the PCI bus (like today's hard drives and their controllers). As a result, bus mastering dma is more streamlined and efficient overall and therefore provides greater speed benefits.

    Alright I'll stop now.
    Please remember to post back whether your problem is resolved or
    not, so that others may gain from the knowledge.

  10. #10
    Join Date
    Apr 2000
    Location
    Sheboygan, WI
    Posts
    53,391
    Kind of goes counter to my learning, but still a point I have pondered over. So, the memory contollers are still in line up.
    Thanks!

  11. #11
    DrMDJ is offline Virtual PC Specialist!!!
    Join Date
    Apr 2000
    Location
    NJ, USA
    Posts
    8,428
    Got to be, there is no other electrical path between the sticks and the "outside world". Like I said.... It's kind of like we say that with say something like DMA (bus mastering) that the communication is directly between the drive and memory. Well forgetting even the memory end, you can't get to the drive without going (electrically) through the (say) drive controller and the ide cable (and a few other things). "Direct" often doesn't and can't truely mean totally one-to-one direct.
    Please remember to post back whether your problem is resolved or
    not, so that others may gain from the knowledge.

  12. #12
    Join Date
    Apr 2004
    Location
    Essex, UK
    Posts
    3,313
    Well, at least this question doesn't immediately cause one's head to start pounding
    Hehe, maybe not yours, but mines started a long time ago!!

    First, on this issue of "directly communicating with memory"... follow?
    Yes!! (thank god)

    Now, there are actually 2 types of DMA and that sometimes seem to get treated as the same, but they aren't. There's the kind of generic or "regular" or "conventional" DMA, and then there's what's called Bus Mastering DMA.
    Now why couldnt they tutor explain this? She made out there were was only one type of DMA, or rather, failed to mention there were 2.

    Alright I'll stop now.
    No, carry on doc!! The more I learn now the better...saves me some hassle along the way!!

    I personally and gratefully thank everyone again...this A+ would have ben a done deal (FAIL) if it weren't for Vdr. At least now I have a fighting chance!!

    Regards

    Hong

  13. #13
    Join Date
    Apr 2000
    Location
    Sheboygan, WI
    Posts
    53,391

    quote:
    --------------------------------------------------------------------------------
    Well, at least this question doesn't immediately cause one's head to start pounding
    --------------------------------------------------------------------------------



    Hehe, maybe not yours, but mines started a long time ago!!
    Well when some one has to use a piledriver

    A+ or no A+ still it is a good learning tool. I APPRECIATE it!
    What better way to learn?
    Helps clear the air so to speak.

  14. #14
    Join Date
    Apr 2004
    Location
    Essex, UK
    Posts
    3,313
    A+ or no A+ still it is a good learning tool. I APPRECIATE it!
    What better way to learn?
    Helps clear the air so to speak.
    Yes, definately!!

  15. #15
    DrMDJ is offline Virtual PC Specialist!!!
    Join Date
    Apr 2000
    Location
    NJ, USA
    Posts
    8,428
    Now why couldnt they tutor explain this? She made out there were was only one type of DMA, or rather, failed to mention there were 2.
    Perhaps because she was speaking of DMA from a conceptual standpoint or from the standpoint of what it fundimentally involves (how it operates) regardless of the actual implementation? Maybe because the older/conventional type of DMA has/is quickly going the way of all flesh? Don't know.
    Please remember to post back whether your problem is resolved or
    not, so that others may gain from the knowledge.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •