CPS 310 Lecture 6: Direct Memory Access

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

In the context of I/O handling, what does 'polling' refer to?

  • A method where the CPU dedicates its entire processing power to manage I/O operations, ensuring their timely execution.
  • A process where I/O devices automatically send data to the CPU without any prior request, optimizing CPU usage.
  • A technique where the CPU periodically checks I/O devices for their status, potentially wasting time if no data is ready. (correct)
  • A hardware mechanism that halts CPU execution until I/O operations have completed, preventing data corruption.

Which of the following best describes the primary advantage of interrupt-driven I/O over programmed I/O?

  • Interrupt-driven I/O reduces CPU overhead by allowing devices to signal when they need attention, rather than the CPU constantly checking their status. (correct)
  • Interrupt-driven I/O ensures that I/O operations have higher priority than other system processes, preventing delays.
  • Interrupt-driven I/O utilizes a dedicated hardware component to manage all I/O requests, freeing up the CPU for other tasks.
  • Interrupt-driven I/O allows data to be transferred directly between I/O devices and memory, bypassing the CPU for increased efficiency.

What is the main drawback of interrupt-driven I/O when transferring large amounts of data?

  • The CPU is involved in transferring all the data. (correct)
  • It is more susceptible to data corruption due to frequent context switches.
  • It consumes more power compared to programmed I/O.
  • It requires specialized hardware interfaces for each device.

In the context of Direct Memory Access (DMA), what is the role of the CPU?

<p>The CPU initiates the DMA transfer by providing necessary information and is then free to perform other tasks while the DMA module handles the data transfer. (A)</p> Signup and view all the answers

How does Direct Memory Access (DMA) improve system performance?

<p>By transferring data directly between memory and I/O devices without CPU intervention, freeing up the CPU for other tasks. (A)</p> Signup and view all the answers

What is a potential drawback of using Direct Memory Access (DMA) in a computer system?

<p>The CPU might be slowed down during a DMA transfer if it needs to access the system bus. (C)</p> Signup and view all the answers

What does 'cycle stealing' refer to in the context of DMA?

<p>A type of DMA where the DMA module relinquishes the bus after transferring a unit of data. (D)</p> Signup and view all the answers

What is the typical bus speed range in modern computer systems?

<p>66-800 MHz (A)</p> Signup and view all the answers

How does a high cache hit ratio affect DMA's impact on system performance?

<p>A high cache hit ratio reduces the CPU's need to access main memory, thus minimizing the performance impact of DMA transfers on the CPU. (C)</p> Signup and view all the answers

In the context of I/O interfaces, what does 'memory-mapped I/O' refer to?

<p>A scheme where I/O devices are accessed using the same instructions that are used to access memory locations. (C)</p> Signup and view all the answers

What is a key difference between parallel and serial bus architectures?

<p>Parallel buses transmit multiple bits simultaneously, while serial buses transmit one bit at a time. (A)</p> Signup and view all the answers

Why are serial interfaces often preferred over parallel interfaces for external devices?

<p>Serial cables can be thinner and cheaper, and the interfaces take up less space. (A)</p> Signup and view all the answers

Which of the following is a characteristic of Recommended Standard 232 (RS-232)?

<p>Common use in low-bit-rate devices like mice and keyboards. (A)</p> Signup and view all the answers

What does the term 'hot-swappable' mean in the context of SATA devices?

<p>Devices can be added or removed while the system is running. (B)</p> Signup and view all the answers

Which interface is most commonly used to connect graphics processing units (GPUs) in modern computers?

<p>PCIe (D)</p> Signup and view all the answers

In modern computer architecture, what is the primary function of the GPU?

<p>Performing highly parallel graphics rendering, enabling the display of complex visuals and running graphics-intensive applications. (A)</p> Signup and view all the answers

What is the key architectural difference between a CPU and a GPU that makes GPUs suitable for graphics rendering?

<p>GPUs have more cores that are less powerful but highly parallelizable. (D)</p> Signup and view all the answers

How does multiprocessing enhance the performance of a computer system?

<p>By enabling parallel execution of tasks, allowing multiple processing elements to work simultaneously on different parts of a program. (C)</p> Signup and view all the answers

What is the limitation of simply increasing the clock speed to improve processing speed?

<p>Clock speed increase is limited as the heat generated must be dissipated or the CPU melts. (C)</p> Signup and view all the answers

In Amdahl's Law, what does the variable 'f' represent?

<p>The fraction of code that must be performed sequentially and cannot be parallelized. (D)</p> Signup and view all the answers

According to Amdahl's Law, what happens to the speedup achieved by adding more processors if there is even a small fraction of code that cannot be parallelized?

<p>The speedup reaches a plateau, and adding more processors yields diminishing returns. (A)</p> Signup and view all the answers

What is the relative prevalence of parallel interconnects and serial interconnects inside a computer?

<p>Parallel interconnects are used inside, serial outside. (A)</p> Signup and view all the answers

Which of the following is a typical example of where modern GPUs are extensively used today?

<p>Real-time 3D rendering. Modern GPUs are the backbone of real images. (B)</p> Signup and view all the answers

What was the original purpose for the common, but inefficient, QWERTY keyboard format?

<p>To avoid the physical jamming of mechanical mechanisms. (D)</p> Signup and view all the answers

How modern keyboards work?

<p>Keypresses close a circuit in the matrix, and this is mapped against a character map that the buffer relays. (B)</p> Signup and view all the answers

Which of these is a good summary for USBs?

<p>Standardized protocol used by many peripherals managed by an HCI. (A)</p> Signup and view all the answers

What is the main function of the South Bridge in a computer's chipset?

<p>To connect slower peripherals such as USB, audio, and SATA. (C)</p> Signup and view all the answers

Are hard drives always SATA?

<p>M.2 SSDs can come in many forms and do not have to be attached to SATA. (A)</p> Signup and view all the answers

Which of these is the best summary of SATA?

<p>Can add/remove SATA devices, hot-swappable, part of SATA standard. (C)</p> Signup and view all the answers

If a computer chip is commonly part of a motherboard chipset and is added alongside USB via a PCIe card, what is it commonly part of?

<p>AHCI commonly is the choice here. (C)</p> Signup and view all the answers

Which of these components might now be defunct?

<p>North Bridge. (A)</p> Signup and view all the answers

What are Bridges primarily used for?

<p>To manage and connect various buses. (D)</p> Signup and view all the answers

Which of these is the most accurate statement about the benefits of GPUs?

<p>GPU is a specialized component meant for graphics rendering to free up CPUs. (D)</p> Signup and view all the answers

What is a key fact about Graphics Processing Units?

<p>GPUs have more cores that are less powerful but highly parallelizable. (C)</p> Signup and view all the answers

Within the context of multiprocessors and performance, what does Amdahl's Law describe?

<p>How a fraction of code must be performed sequentially. (D)</p> Signup and view all the answers

Which statement is most true of this formula? $Speedup = \frac{time \space to \space execute \space on \space single \space processor}{time \space to \space execute \space on \space p \space parallel \space processors} = \frac{1}{f + \frac{1-f}{p}}$

<p>As processors increase, it causes speed up to plateau. (C)</p> Signup and view all the answers

Which of the following are benefits of the bus system?

<p>The parts of the computer are in connection. (A)</p> Signup and view all the answers

How software engineers are working hard on solving the current software issues that limit scaling and are incompatible with hardware?

<p>Great care is placed on reducing the proportion of serial code. (D)</p> Signup and view all the answers

Which component is needed to manage USB connections?

<p>xHCI. (D)</p> Signup and view all the answers

Flashcards

Programmed I/O

A method where the CPU actively checks I/O devices, which can waste processing time.

Interrupt-Driven I/O

An I/O handling method where devices alert the CPU only when ready, reducing polling.

Direct Memory Access (DMA)

A module that transfers data directly to/from memory, bypassing the CPU for bulk transfers.

DMA transfer

CPU issues command to DMA module, and DMA module handles data transfer without CPU

Signup and view all the flashcards

Cycle-Stealing DMA

A direct memory Access method where the DMA module releases the bus after each word transfer.

Signup and view all the flashcards

Serial Communication

A type of connection protocol that transmits data one bit at a time

Signup and view all the flashcards

Parallel Communication

A type of connection protocol that transmits multiple bits simultaneously

Signup and view all the flashcards

RS-232

A protocol used for connecting devices like mice and keyboards before USB became popular

Signup and view all the flashcards

Universal Serial Bus (USB)

A common interface used for connecting various peripherals to a computer.

Signup and view all the flashcards

Host Controller Interface (HCI)

Manages USB devices and handles power distribution, communication

Signup and view all the flashcards

Serial ATA (SATA)

A common interface for connecting storage devices, can be internal or external.

Signup and view all the flashcards

Parallel ATA (PATA)

An interface that's largely been replaced by SATA.

Signup and view all the flashcards

Advanced Host Controller Interface (AHCI)

A common controller interface used with SATA devices

Signup and view all the flashcards

South bridge and Norh Bridge

Chips on the motherboard that manage and connect the various buses

Signup and view all the flashcards

Peripheral Component Interconnect Express (PCIe)

A connector used to connect graphics cards and provide high-speed data transfer.

Signup and view all the flashcards

Graphics Processing Units (GPUs)

A specialized electronic circuit that rapidly manipulates and alters memory to accelerate the creation of images in a frame buffer intended for output to a display device

Signup and view all the flashcards

Multiprocessing

Using multiple processors to perform tasks simultaneously.

Signup and view all the flashcards

Amdahl's Law

A formula determining maximum speedup with parallel processors, limited by serial code fraction.

Signup and view all the flashcards

Study Notes

  • CPS 310 Lecture 6 is about Direct Memory Access (DMA), I/O peripherals and multiprocessing, taught by Professor Alex Ufkes
  • Required purchases include the ELEGOO UNO Project Super Starter Kit and the Arduino UNO-3 with Atmega328P microcontroller; a course outline is on Amazon

ARCTools I/O Ports

  • The console data port is at memory address 0xffff0000.
  • The console status port is at memory address 0xffff0004.
  • The keyboard data port is at memory address 0xffff0008.
  • The keyboard status port is at memory address 0xffff000C.

Read & Print all the Characters

  • A code snippet manages input, reads a keystroke, and executes a conditional branch based on the input
  • The input waiting loop remains the same.
  • After reading a keystroke, the code subtracts 27 from register %r31
  • 27 is the ASCII code for the Escape key
  • If the result is zero, it branches to the end of the program
  • An output waiting loop is also present.
  • The program branches back to iwait to repeat the process unless the Escape key is pressed, which branches to end.

Busy-Waiting and Interrupts

  • Busy-waiting is inefficient because the CPU polls I/O devices, wasting time while waiting for input.
  • Interrupts are an alternative where the keyboard signals the processor when a character is ready, avoiding constant polling.
  • The keyboard raises an interrupt to signal readiness
  • Handling interrupts involves updating the fetch-execute cycle to check for interrupts and initiate an interrupt handler.
  • This introduces overhead that is tiny compared to the cost of programmed I/O
  • Different interrupts trigger different handlers called Interrupt Service Routines (ISRs).
  • One ISR might be for the keyboard, another for a hard disk, and another for a system timer.
  • ISRs are subroutines commonly provided by the operating system.

Direct Memory Access (DMA)

  • DMA is performed by a separate module on the system bus.
  • DMA transfers data to or from main memory, initiated by the CPU sending a command to the DMA module.
  • The command specifies the I/O device address, read/write operation, memory address, and number of words to transfer.
  • Once data transfer completes, the DMA module issues an interrupt.
  • The DMA module exists as part of the system bus, not typically of the CPU.
  • During DMA transfer, the processor is free to perform other tasks.
  • DMA transfers an entire block of data directly to and from memory, bypassing the processor.
  • The processor is only involved at the beginning and end of the transfer.
  • After finishing its transfer, the DMA module sends an interrupt to the processor.
  • There is a potential drawback where the processor might execute more slowly if it needs to access the system bus during a DMA transfer.
  • This is because the CPU would have to wait one bus cycle
  • Cycle-Stealing DMA is a technique where the DMA module holds the bus for one word transfer, then relinquishes it and requests bus control for each subsequent word.
  • This prevents DMA from tying up the bus and interfering with other operations
  • Cycle-stealing DMA helps balance bus access

CPU Cycle vs Bus Cycle

  • In practice, DMA has minimal impact on CPU performance because bus speeds typically range from 66 to 800 MHz.
  • It does not saturate the bus because I/O devices are slow
  • The CPU doesn't need the bus when fetching from cache.

Common I/O Interfaces

  • Memory mapped I/O schemes simplify I/O device utilization.
  • The system’s communication intricacies with these devices are hidden.
  • The fact that loading and storing at an I/O mapped address is easy doesn’t mean implementing that mapping is simple too.
  • Every I/O device has unique idiosyncrasies and protocols.
  • Standardized protocols are common among I/O devices.
  • The common I/O devices, SATA, USB, PCI, PCIe, VGA, DVI, and HDMI use standard protocols.

System Bus Architecture

  • The ARC system bus is 32 bits wide.
  • The data bus is 32-bit which enables one to load a full word in a single instruction cycle and facilitates parallel bit transmission
  • The address bus is also 32-bit, with each instruction being 32 bits in length which placed in parallel on the address bus.
  • Serial bus architectures contrast with the parallel system bus.
  • Parallel ports are a common feature on older systems, especially for printers, and transferred data in parallel

Serial Bus Architecture

  • Serial communication offers advantages over parallel, it is more economical at shorter distances.
  • Serial interfaces require higher bit-rates to compensate for the lack of parallelism and offer physical/economic benefits with thinner cables using less space
  • Serial consumes less power due to fewer data pins and simplifies timing management.
  • Parallel interconnects are generally used inside the computer, while serial interconnects are used outside.

Common I/O Interfaces (cont)

  • Recommended Standard-232 (RS-232) was common before USB for low-bit-rate devices like mice and keyboards, and is still used in embedded systems and industrial applications
  • A RXD pin receives data and a TXD pin sends it and these pins are crossed to allow simultaneous sending and receiving of data.
  • The Universal Serial Bus (USB) replaced RS-232 in modern PC systems.
  • USB has many flavors and connectors, such as Mini-USB, USB Type-B and A, and USB-C.
  • USB-C is reversible
  • USB devices are plug-and-play and define a common communication standard for peripherals.
  • USB evolved from USB 2.0 to USB 3.0, offering 12 Mbps, 480 Mbps, and 5 Gbps, respectively; USB 3.2 with USB-C connectors can reach up to 20 Gbps
  • USB devices are managed by a host controller and data is transferred from a USB device through a host controller managed with drivers into a program.
  • The extensible Host Controller Interface (xHCI) is a computer interface specification for a USB host controller, typically part of a motherboard's chipset and handles power distribution, communication, and other tasks.
  • The operating system uses device drivers to communicate with the HCI.
  • A system call is used to get data into our program in a high-level language.
  • By scanning and calling, in assembly, can specific system subroutines.

Keyboard Functionality

  • In modern systems, the OS maintains software buffers for I/O devices and supplies keystrokes from these buffers.
  • Keyboards have internal buffers and older models could only handle a limited number of simultaneous key presses.
  • Modern keyboards allow to push as many buttons into notepad and their will each be reported

Keyboards In Depth

  • The QWERTY layout was designed to be deliberately inefficient to prevent physical jamming of mechanical mechanisms.
  • ECMA-23 standard uses 7 bits per character for transmission but is insufficient for modifier keys.
  • Modern keyboards use an internal processor called a microcontroller.
  • Keypresses close circuits in the key matrix, where each key indicates one character based on an onboard character map, and then the state of key matrix is transmitted
  • The keyboard's microcontroller analyzes the state of the key matrix.
  • This state is translated into a character, characters are placed into onboard buffer and sent via USB using the according protocol.
  • The HCI receives keyboard data which means that the Operating System then talks to HCI passing to the application which interprets as content or the keystrokes are simply ignored

Serial ATA (SATA)

  • SATA interfaces can connect HDDs, SSDs, or optical drives whereas M.2 SSDs can come in other formats.
  • Parallel ATA (PATA) preceded Serial ATA (SATA)
  • SATA’s cables can have a thinner profile and take up less space.
  • SATA devices are hot-swappable, allow for add/remove of SATA devices without needing to power down the system, the functionality requires OS support however.
  • Windows 95/98 do not support SATA devices as the OS's predate their development
  • AHCI (Advanced Host Controller Interface) is a common theme in storage.
  • AHCI is a storage interface, devices implement existing standards liek USB or SATA.
  • Mass storage devices use SATA, USB, or NVMe (for SSDs).
  • The AHCI works commonly through motherboard's chipset but can also pass through PCIe cards or from a chip on Motherboard
  • South bridges and North bridges manage connections on the motherboard.
  • Bridges are chips on the motherboard that manage and connect the various buses.
  • The North bridge is no longer used with functions incorporated into the CPU.
  • South bridges and North bridges work with chipset which need to work with the CPU

PCI Express

  • Peripheral Component Interconnect Express (PCIe) is typically used for connecting Graphics Processing Units (GPUs).
  • GPUs drive multiple displays and perform parallel graphics rendering
  • PCI components sound and network interface cards(NICs).
  • Nowadays, these parts are integrated into the chipset or motherboard
  • The GPUs has many cores and is used for highly parallelized operations and are less useful for general computing.

Multiprocessing

  • Multiprocessing, or parallel processing, was developed because program's speed is limited by the fetch-execute cycle.
  • This can improve with pipelining, which starts the next instruction before the current one finishes.
  • Higher clock frequencies generate more heat.
  • Amdahl's Law discusses the limits of the performance with a parallel design
  • Speedup= (time to execute on single processor) / (time to execute on p parallel processors) = 1/( f + (1-f)/p) where f is the time of sequential code and p is number of processors
  • Even with small values of Æ’ are added, eventually diminishing the value of parallel design
  • Realistically, performance peaks at 4-6 cores
  • Software engineers are working to apply parallel processing to data management, reducing code needing serial processing.
  • Modern GPUs have thousands of cores, used for tasks like computer vision that is for operating in tandem performing simple operations of thousands of pixels to speed up image processing

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