Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 7b I/O. I/O devices  Device (mechanical hardware)  Device controller (electrical hardware)  Device driver (software)

Similar presentations


Presentation on theme: "Lecture 7b I/O. I/O devices  Device (mechanical hardware)  Device controller (electrical hardware)  Device driver (software)"— Presentation transcript:

1 Lecture 7b I/O

2 I/O devices  Device (mechanical hardware)  Device controller (electrical hardware)  Device driver (software)

3 Devices and their controllers  Components of a simple personal computer Monitor Bus

4 How to communicate with a device?  Hardware supports I/O ports or memory mapped I/O for accessing device controller registers and buffers

5 Wide performance range for I/O

6 Performance challenges: I/O hardware  How to prevent slow devices from slowing down memory  How to identify I/O addresses without interfering with memory performance

7 Hardware view of Pentium Structure of a large Pentium system

8 Performance challenges: I/O software  How to prevent CPU throughput from being limited by I/O device speed  How to prevent I/O throughput from being limited by CPU speed  How to achieve good utilization of CPU and I/O devices  How to meet the real-time requirements of devices

9 Programmed I/O  Polling/busy-waiting approach copy_from_user(buffer,p,count); for(i=0;i<count;i++){ while (*p_stat_reg != READY); *p_data_reg = p[i]; } return();

10 Interrupt driven I/O (b)

11 Interrupt-driven I/O  Asynchronous approach  give device data, do something else!  resume when device interrupts copy_from_user(buffer,p,count); enable_interrupts(); while (*p_stat_reg != READY); *p_data_reg=p[0]; scheduler(); if (count==0){ unblock_user(); } else { *p_data_reg = p[i]; count--; i++; } ack_interrupt(); return_from_interrupt();

12 DMA  Offload all work to a DMA controller  avoids using the CPU to do the transfer  reduces number of interrupts  DMA controller is like a co-processor doing programmed I/O copy_from_user(buffer,p,count); set_up_DMA_controller(); scheduler(); ack_interrupt(); unblock_user(); return_from_interrupt();

13 DMA

14 Software engineering-related challenges  How to remove the complexities of I/O handling from application programs  standard I/O APIs (libraries and system calls)  generic across different device types  How to support a wide range of device types on a wide range of operating systems  standard interfaces for device drivers  standard/published interfaces for access to kernel facilities

15 I/O Software: Device Drivers  Device drivers “connect” devices with the operating system  Typically a nasty assembly-level job Must deal with hardware changes Must deal with O.S. changes  Device drivers are typically given kernel privileges  Can bring down O.S.!

16 I/O Software design issues  Synchronous vs. asynchronous transfers  Blocked transfers vs. interrupt-driven  Buffering  Data coming off a device cannot be stored in final destination  Sharable vs. dedicated devices  Disks are sharable  Tape drives would not be

17 I/O software design issues  Device independence  programs can access any I/O device without specifying device in advance (floppy, hard drive, or CD-ROM)  Uniform naming  Name of a file or device a string or an integer not depending on which machine  Shouldn’t depend upon the device  Error handling  Handle as close to the hardware as possible

18 Devices as files  Before mounting,  files on floppy are inaccessible  After mounting floppy on b,  files on floppy are part of file hierarchy

19 Spare Slides

20 Disks

21 Disk geometry  Disk head, platters, surfaces

22 Disk geometry  CAV & CLV

23 RAID

24

25 CD-ROMs

26 Plastic technology  CDs  Approximately 650 Mbytes of data  Approximately 74 minutes of audio  DVDs  Many types of formats DVD-R, DVD-ROM, DVD-Video  Single layer vs. multi-layer  Single sided vs. double sided  Authoring vs. non-authoring

27 Disk scheduling algorithms  Time required to read or write a disk block determined by 3 factors  Seek time  Rotational delay  Actual transfer time  Seek time dominates  Error checking is done by controllers

28 Disk scheduling algorithms  First-come first serve  Shortest seek time first  Scan  back and forth to ends of disk  C-Scan  only one direction  Look  back and forth to last request  C-Look  only one direction

29 Disk scheduling algorithms

30 Display hardware  PCI graphics card (traditional)  Map frame buffer into memory

31 Display hardware  Intel-based systems

32 Display hardware  Resolution  Determines the amount of pixels displayable and the # of colors that can be used 1024*768*24-bit color  ~2 MBytes 1600*1200*24-bit color  ~6 Mbytes 1600*1200*(16 colors)  ~1 Mbytes  Usually double-buffered  Data rate  Determines refresh rate  Monitor must be greater than what the video card is trying to display

33 X-terminals

34  Long past  X-terminals were great because of limited pixel depth  Good way to share expensive resources  Future  Great way to limit maintenance costs  Great for basic applications  X-terminals are getting killed by multimedia applications DVD  740*480*24-bit color  255 Mbps!!

35 Summary  Mismash of I/O topics  Readings:  5.1 – 5.1.4, 5.2, 5.4 – 5.4.3, 5.7.1  Homework #4 – Due Wed. Dec. 1  Chapter 4: Problem # 23, 29  Chapter 5: Problem # 24


Download ppt "Lecture 7b I/O. I/O devices  Device (mechanical hardware)  Device controller (electrical hardware)  Device driver (software)"

Similar presentations


Ads by Google