Understanding Direct Memory Access (DMA)

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson
Download our mobile app to listen on the go
Get App

Questions and Answers

What is the primary purpose of DMA (Direct Memory Access)?

  • To simplify CPU instruction sets
  • To increase CPU clock speed
  • To allow peripheral devices to directly manage memory bus (correct)
  • To reduce the size of the main memory

The CPU continues to execute instructions when a DMA controller requests control of the system buses.

False (B)

What is the role of the 'Bus Grant' signal in a DMA transfer?

Indicates that the CPU has relinquished control of the buses.

In the context of DMA, the signal from the DMA controller to the CPU requesting control of the buses is known as ______.

<p>bus request</p>
Signup and view all the answers

Match the DMA transfer modes with their descriptions.

<p>Burst Transfer = Transfers a block of data in a continuous sequence. Cycle Stealing = Transfers one data word at a time, 'stealing' memory cycles from the CPU.</p>
Signup and view all the answers

Which of the following best describes the 'Burst Transfer' mode in DMA?

<p>Transferring a block of data in a continuous sequence. (B)</p>
Signup and view all the answers

In 'Cycle Stealing' mode, the DMA controller maintains exclusive control of the system buses throughout the entire data transfer process.

<p>False (B)</p>
Signup and view all the answers

What role does the DMA controller play in the management of memory addresses during a DMA transfer?

<p>Specifies the memory location to read from or write to.</p>
Signup and view all the answers

The DMA controller uses a ______ register to keep track of the number of words to be transferred.

<p>word count</p>
Signup and view all the answers

What is the purpose of the 'Control Register' within a DMA controller?

<p>To specify the mode of transfer (read or write). (A)</p>
Signup and view all the answers

The CPU directly initiates and manages each data transfer in a DMA operation.

<p>False (B)</p>
Signup and view all the answers

What information does the CPU initially provide to the DMA controller to set up a DMA transfer?

<p>Starting address, word count, and mode of transfer.</p>
Signup and view all the answers

After DMA initialization, the CPU ______ communicating with the DMA controller until the transfer is complete.

<p>stops</p>
Signup and view all the answers

Which of the following signals does the DMA controller activate to inform the CPU that it requires control of the system buses?

<p>BR (Bus Request) (D)</p>
Signup and view all the answers

The DMA controller's address is activated through the AB line.

<p>False (B)</p>
Signup and view all the answers

After each word is transferred during DMA, what two registers within the DMA controller are updated?

<p>Address register and word count register</p>
Signup and view all the answers

When the ______ register reaches zero, the DMA transfer stops.

<p>word count</p>
Signup and view all the answers

Which of the following is an application of DMA?

<p>Fast transfer of information between magnetic disks and memory (B)</p>
Signup and view all the answers

In scenarios where the peripheral device is slow, DMA disables the BR line to CPU, allowing it to continue running it's program.

<p>True (A)</p>
Signup and view all the answers

Provide two examples of devices that commonly utilize DMA for data transfer.

<p>Hard drives and graphic cards.</p>
Signup and view all the answers

Flashcards

Direct Memory Access (DMA)

Peripheral devices manage the memory bus directly, improving transfer speed between peripheral device and memory without CPU intervention.

BUS REQUEST

A signal from the DMA controller to the CPU requesting the CPU to relinquish control of the buses.

BUS GRANT

A signal from the CPU to the DMA controller indicating that the CPU is relinquishing control of the buses.

BURST TRANSFER

A DMA transfer mode where a block of data consisting of a number of words is transferred in a continuous burst.

Signup and view all the flashcards

CYCLE STEALING

A DMA transfer mode where one data word is transferred at a time, after which control of the buses is returned to the CPU.

Signup and view all the flashcards

DMA Controller

An interface used to communicate with the CPU and I/O devices, containing address, word count, and control registers.

Signup and view all the flashcards

Address Register

Contains the address to specify the desired location in memory; it is incremented after each word is transferred.

Signup and view all the flashcards

Word Count Register

Holds the number of words to be transferred and is decremented after each transfer, then tested for zero.

Signup and view all the flashcards

Control Register

Specifies the mode of transfer for the DMA operation.

Signup and view all the flashcards

DMA Initialization

The CPU initializes the DMA by sending the starting address of the memory block, word count, and control information to the DMA controller.

Signup and view all the flashcards

Handshaking Process

DMA controller activates BR (Bus Request), informing the CPU to relinquish the buses, and the CPU responds with BG (Bus Grant).

Signup and view all the flashcards

Address Transfer

DMA transfers the value of the address register to the address bus and enables DMA Acknowledge.

Signup and view all the flashcards

Post-Transfer Updates

After each word transfer, DMA increments the address register and decrements the word count register.

Signup and view all the flashcards

Transfer Completion

DMA stops the transfer and removes the BR to the CPU, returning control once the word count reaches zero.

Signup and view all the flashcards

Delayed CPU Operation

Cycle Stealing is used to allow the direct memory transfer to steal one memory cycle.

Signup and view all the flashcards

DMA Controller with Multiple Channels

One channel for each peripheral device, has its own address register and word count register.

Signup and view all the flashcards

Application of DMA

Fast transfer of information between magnetic disks and memory.

Signup and view all the flashcards

Study Notes

Direct Memory Access (DMA)

  • Enables peripheral devices to directly manage the memory bus.
  • Improves data transfer speed between peripherals and memory.
  • Achieves this without constant CPU intervention.

Need for DMA

  • Peripheral devices manage the memory bus directly.
  • Increases the speed of data transfer between a peripheral device and memory.
  • Decreases intervention from the CPU.

CPU Bus Signals for DMA

  • Two control signals are used to facilitate DMA transfer: BUS REQUEST and BUS GRANT.
  • BUS REQUEST: A signal from the DMA controller to the CPU.
  • The DMA controller requests the CPU relinquish control of the buses.
  • If the input is high, the CPU ceases instruction execution.
  • The address, data, read, and write lines are set to high impedance.
  • BUS GRANT: A signal from the CPU to the DMA controller.
  • Shows that the CPU to DMA controller to the buses are in a high impedance state.
  • DMA assumes control of buses, which allows memory transfers to occur without the CPU.
  • Once the transfer is done, the bus request line and bus grant signal are disabled and the CPU resumes normal operation.

DMA Transfer Modes

  • There are two main modes: Burst Transfer and Cycle Stealing.
  • Burst Transfer: A block of multiple words is continuously transferred.
  • DMA controller becomes the master of the memory buses.
  • High-speed peripheral devices, magnetic disks use/take advantage of it.
  • Cycle Stealing: Transfers a single data word at a time.
  • Control of the buses returns to the CPU after each word transfer.
  • The CPU delays its operation for one memory cycle.

DMA Controller

  • DMA is similar to an interface and serves as a communication channel between the CPU and I/O devices.
  • Communication with the CPU is established through data and control lines.
  • I/O device communication uses a DMA request and Acknowledge.
  • When BG = 0, the CPU communicates with the DMA register via the data bus for reading or writing.
  • When BG = 1, the CPU relinquishes the buses, allowing DMA to perform memory operations.
  • DMA specifies the memory address in the address bus and enabling read/write signals.
  • Components: address register, word count register, and control register.
  • Address Register: Stores the memory address for data transfer and increments after each transfer.
  • Word Count Register: Holds the number of words to be transferred, decrements after transfer, and tests for zero.
  • Control Register which will specify the mode of transfer.

DMA Initialization

  • The CPU initializes DMA by executing I/O instructions, which include the address to choose DMA registers.
  • The CPU sends the starting memory address for read/write operations.
  • It also transmits the word count (the number of words in the memory block).
  • Lastly, the mode of data transfer (read/write) and a signal to start DMA transfer are sent from the CPU.
  • After DMA is initialized, the CPU stops communicating with DMA, and DMA begins transferring data between memory and the peripheral.

DMA Operation

  • Each DMA has its independent address, activating the DS and RS lines.
  • The CPU initializes the DMA through the data bus.
  • A peripheral device sends a DMA request, the DMA controller activates the BR line to inform the CPU,
  • The CPU allows this by enabling the BG line.
  • DMA transfers the value of the address register to the address bus and enables DMA Acknowledge.
  • The peripheral device transfers the data (write) or receives the data (read) via the data bus.
  • The DMA updates the address and word count registers for each transfer.
  • Should the word count not reach zero, DMA continues to check the request line from the peripheral device.
  • The DMA disables the BR line to the CPU when peripheral speed slows and the CPU continues its program.
  • When the word count reaches zero, DMA stops the transfer and disables the BR line to the CPU.

Additional DMA Features

  • DMA controller can have multiple channels
  • Each has a request and acknowledge pair for separate devices.
  • Each channel has its own address and word count register.
  • Priority is assigned among channels.
  • Higher-priority channels are serviced first.

DMA Applications

  • Fast data transfer between magnetic disks and memory.
  • Updating the display on an interactive terminal.

Example Calculation: I/O Data Transfer Rate with DMA

  • Computer with a CPU and an I/O device connected to main memory.
  • Shared bus with a 16-bit data bus width.
  • The CPU:
  • Executes 10^6 instructions per second.
  • Requires 5 processor cycles per instruction.
  • Reads or writes uses 1 processor cycle.
  • Background programs occupy 95% of the instruction rate.
  • One processor cycle is equal to one bus cycle.
  • DMA module uses all available cycles.
  • Ignores setup/status-checking time.
  • CPU Utilization:
  • Busy 95% of the time.
  • Leaves 5% for non-instruction tasks.
  • DMA During CPU Activity: Uses 0.95 x 3 cycles.
  • DMA During CPU Idle Time: Uses 0.05 x 6 cycles.
  • Total DMA Cycles:
  • (0.05 x 6 + 0.95 x 3) cycles.
  • Calculation:
  • Rate of Transfer = 1,000,000 x (0.05 x 6 + 0.95 x 3) = 3.15 x 10^6 words per second1.

Hard disk with DMA data transfer to Memory running at 300MHZ

  • Takes 300 and 900 clock cycles to initiate and complete DMA transfer respectively.
  • The transfer size is 20 Kbytes.
  • Total Transfer Time = (Total Data) / (Total Transfer Rate)
  • Total Transfer rate=20 MB per second = 20 × 2²⁰ bytes/sec
  • Total Data=20 KB=20 × 2¹⁰ bytes
  • Processor Time = (Cycles for DMA transfer) / (Processor Speed)
  • CPU requires 300+900=1200 cycles
  • Time=1200 cycles/(300 × 10⁶) cycles/sec = 4 ×10 ⁻⁶ sec = .004 ms
  • % Processor Time = (Processor Time/Total Time ) × 100

Hard disk with DMA data transfer to Memory running at 600MHZ

  • Total Transfer rate=10 MB per second = 10 × 2²⁰ bytes/sec
  • Total Data=20 KB=20 × 2¹⁰ bytes
  • Processor Time = (Cycles for DMA transfer) / (Processor Speed)
  • CPU requires 300+900=1200 cycles
  • Time=1200 cycles/(600 × 10⁶) cycles/sec = 2 ×10 ⁻⁶ sec = .002 ms
  • % Processor Time = (Processor Time/Total Time ) × 100

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Related Documents

More Like This

Use Quizgecko on...
Browser
Browser