Dma

12
Direct Memory Access

description

 

Transcript of Dma

Page 1: Dma

Direct Memory Access

Page 2: Dma

Introduction

An important aspect governing the Computer System performance is the transfer of data between memory and I/O devices.

The operation involves loading programs or data files from disk into memory, saving file on disk, and accessing virtual memory pages on any secondary storage medium.

Page 3: Dma

What is Direct Memory Access (DMA) ?

When large volumes of data are to be moved, a more efficient technique is required: Direct Memory Access (DMA)

Blocks of data are transferred between an external device and the main memory, without continuous intervention by the processor.

Page 4: Dma

Implementing DMA in a Computer System

A DMA controller implements direct memory access in a computer system.

It connects directly to the I/O device at one end and to the system buses at the other end. It also interacts with the CPU, both via the system buses and two new direct connections.

It is sometimes referred to as a channel. In an alternate configuration, the DMA controller may be incorporated directly into the I/O device.

Page 5: Dma

DMA Controller

DMA controller is part of the I/O interface.

Performs the functions that would normally be carried out by the processor when access main memory. For each word transferred, it provides the memory address and all the bus signals that control data transfer.

Page 6: Dma

DMA Controller

Although DMAC can transfer data without intervention by the processor, it’s operation must be under the control of a program executed by the processor.

To initiate the transfer of a block of data, the processor sends the starting address, the number of words in the block, and direction of the transfer. Once information is received, the DMAC proceeds to perform the requested operation. When the entire block has been transferred, the controller informs the processor by raising an interrupt signal.

Page 7: Dma
Page 8: Dma

How is OS involved

I/O operations are always performed by the OS in response to a request from an application program.

OS is also responsible for suspending the execution of one program and starting another.

OS puts the program that requested the transfer in the Blocked state,

initiates the DMA operation,

starts execution of another program.

When the transfer is complete, the DMA controller informs the processor by sending an interrupt request.

OS puts suspended program in the Runnable state so that it can be selected by the scheduler to continue execution.

Page 9: Dma

Fig - DMA Block Diagram

Whether a read or write is requested, using the read or write control line between the processor and the DMA moduleThe address of the I/O device involved, communicated on the data linesThe starting location in memory to read from or write to, communicated on the data lines and stored by the DMA module in its address registerThe number of words to be read or written, again communicated via the data lines and stored in the data count register

Page 10: Dma

Steps in a DMA operation

• Processor initiates the DMA controller

• Gives device number, memory buffer pointer, …

• Called channel initialization

• Once initialized, it is ready for data transfer

processor DMA controller

Gives device number

I/O device number

Page 11: Dma

Fig - DMA Configuration a) All modules share the same system bus. The DMA module, acting as a surrogate processor, uses

programmed I/O to exchange data between memory and an I/O module through the DMA.

b) This means that there is a path between the DMA module and one or more I/O modules that does not include the system bus.

c) All modules share the same system bus. The DMA module, acting as a surrogate processor, uses programmed I/O to exchange data between memory and an I/O module through the DMA

Page 12: Dma

Summary

Advantages of DMA Computer system performance is improved by direct

transfer of data between memory and I/O devices, bypassing the CPU.

CPU is free to perform operations that do not use system buses.

Disadvantages of DMA In case of Burst Mode data transfer, the CPU is

rendered inactive for relatively long periods of time.