CS241I/O RevisitedLawrence AngraveDMA, Polling, Disk CharacteristicsToday• Networking Quiz• DMA vs Polling• Disk Characteristics• AnnouncementsDMA & I/O• What is DMA?• Why is useful?• How does it work?• Compare it Polling?DMA• Direct Memory Access• DMA controls exchange of databetween main memory and I/O module• Processor issues a request for transferof block data• Process is interrupted when DMArequest completesMain Advantages?Processor can perform useful work (does notneed to wait for I/O device to be ready)Optimal use of memory bus:– Efficient block transfer– Use main system bus once per word (In somearchitectures)Cycle stealing• DMA takes control of system bus towrite to main memory• CPU can not use bus at the same time• DMA has stolen cycles from the CPU!Compare to Polling• CPU continually checks I/O device tosee if it is ready• Wastes CPU (and bus) cycles• So when would Polling be useful?Polling vs DMADMA overhead: Issuing commands toDMADMA shared resource: Requests arequeuedDMA efficient for block reads to memory.Interrupt overhead.Reasons for polling• Want small amount of data to beprocessed by CPU as soon as it isavailable.• Interrupt-driven I/O not available.• Not all devices, architectures supportDMA transfer (or have a DMA)Speed of I/O transfer• Limitations of physical device• Limitations of I/O bus• Limitations of system bus• Limitations of read/write speed ofmemorySpeed of I/O transfer• Limitations of physical device• Limitations of I/O bus• Limitations of system bus• Limitations of read/write speed ofmemoryIn practice• Physical device is a shared resource• So is memory, I/O bus, system bus,memory & CPUPhysical device• Rotation speed• Seek time to correct track(move head to correct track)To use these• # Sectors per track• # Bytes per sectorRotation• How long before first byte is under thehead?• How many milliseconds before all bytesare read from that track?HW Problem• rotational speed of 15,000 rpm,• 512 bytes per sector,• 400 sectors per track and• 1000 tracks on the disk,• average seek time is 4ms.• What is the transfer time for this file?• What is the average access time for thisfile?• What is the rotational delay in thiscase?• What is the total time to read 1 sector?What is the total time to read 1 track?rpm=revolutions per minute• Transfer rate= Bytes per 360 degrees xRotational speed (60 x rpm)• Avg Access Time for 1 sector=seek time + avg. rotational delay +transfer time for 1 sectorExamplesb=number of bytes to transfer, r=rotationspeed, and N = number of bytes on a trackTt=transfer time = b/(rN)Ta=average access time of the whole file =Tseek+ 1/(2r)+TAverage Rotational delay = 0.5/rAnnoucements• HW2 due Wednesday 05/02/2007• Newsgroup request for review
View Full Document