Unformatted text preview:

Lecture 33OutlineI/O Systems 1I/O Systems 2I/O Systems 3I/O Hardware 1I/O Hardware 2I/O Hardware 3I/O Hardware 4Application I/O Interface 1Application I/O Interface 2Application I/O Interface 3Application I/O Interface 4Application I/O Interface 5Application I/O Interface 6Application I/O Interface 7Application I/O Interface 8Kernel I/O Subsystem 1Kernel I/O Subsystem 2Kernel I/O Subsystem 3System Performance 1System Performance 2System Performance 3Monday, April 4 CS 470 Operating Systems - Lecture 33 1Lecture 33Schedule for rest of term posted.Optional project posted. Can be used to replace one project grade.Questions?Monday, April 4 CS 470 Operating Systems - Lecture 33 2OutlineI/O systemsI/O hardwareApplication I/O interfaceKernel I/O subsystemSystem performanceMonday, April 4 CS 470 Operating Systems - Lecture 33 3I/O SystemsMain jobs of a computerProcessingI/OOften the primary job is I/O with incidental processingWeb browsingDocument editingMonday, April 4 CS 470 Operating Systems - Lecture 33 4I/O SystemsI/O devices are diverse - mouse, disk, monitor - so various methods are needed to control them. Collectively, they are known as the I/O subsystem that separates the rest of the kernel form the complexities of managing I/O.Monday, April 4 CS 470 Operating Systems - Lecture 33 5I/O SystemsConflicting trendsIncreasing standardization of software/hardward interfaces makes is easier to incorporate new devicesI/O devices are becoming more diverse, unlike any previous devices.Details and oddities of differing devices are encapsulated in device drivers that allow the OS to provide a uniform device-access interface.Monday, April 4 CS 470 Operating Systems - Lecture 33 6I/O HardwareNot too much detail; covered in CS 320General categories:StorageTransmissionHuman interfaceSpecial I/O - sensors, actuatorsCommunicate with computer via port or busMonday, April 4 CS 470 Operating Systems - Lecture 33 7I/O HardwareController is a piece of electronics that operates a port, bus, or device.Sometimes a separate card, e.g. SCSI host adapter, network interface cardSometimes built into the device, e.g. disk controllerCommunication is through special I/O commands that write to registers at I/O port addresses or through memory-mapped I/O.E.g. PC graphics controller uses I/O ports for basic operations, but maps screen memory for direct writes.Monday, April 4 CS 470 Operating Systems - Lecture 33 8I/O HardwareInteraction (or handshaking) between devices is done through polling or interrupts.Polling is fast (read, mask, branch on 0), but wasted processing if event does not happen often.Interrupts only happen when events happen, but must have fast dispatch and ability to mask interrupts for critical sections or higher-priority interrupts.Monday, April 4 CS 470 Operating Systems - Lecture 33 9I/O HardwareDirect-memory access (DMA) controller is used to handle large transfers to memory so that CPU does not have to watch status bits and/or load data one word at a time.Monday, April 4 CS 470 Operating Systems - Lecture 33 10Application I/O InterfaceAs with other software-engineering problems, approach is to abstract and encapsulate behavior. Drivers provide a standardized set of functions - an interface - for various generic I/O devices.Lots of different classes of drivers.Monday, April 4 CS 470 Operating Systems - Lecture 33 11Application I/O InterfaceKernelKernel I/O SubsystemEIDEdevicedriverEthernetdevicedriverUSBdevicedriverPCI busdevicedrivergraphicsdevicedriverATAPIdevicedriverEIDEdevicecontrollerEthernetdevicecontrollerUSBdevicecontrollerPCI busdevicecontrollergraphicsdevicecontrollerATAPIdevicecontrollerhard disk networkmousekeyboardmemory monitor CD/DVDsoftwarehardware.........Monday, April 4 CS 470 Operating Systems - Lecture 33 12Application I/O InterfaceUnfortunately, each OS has its own standards for device-driver interface, so many devices ship with multiple drivers. Or are usable only with certain OS'sLess so now that many devices use USB for wired and Bluetooth for wireless interaction.Monday, April 4 CS 470 Operating Systems - Lecture 33 13Application I/O InterfaceDevices vary on many dimensionsdata transfer mode: character (e.g. terminal) vs. block (e.g. disk)access method: sequential (e.g. modem) vs. random (e.g. CD-ROM)transfer schedule: synchronous (e.g. tape) vs. asynchronous (e.g. keyboard)device speed: few bytes/sec (e.g. modem) vs. few gigabytes/sec (e.g. Ethernet)I/O direction: read-only (e.g. CD-ROM) vs. write-only (e.g., monitor) vs. read-write (e.g. disk)Monday, April 4 CS 470 Operating Systems - Lecture 33 14Application I/O InterfaceMost OS's support several general categories of devices.Block devices: read/write/seek operations. Sometimes raw I/O with direct access to controller. Sometimes direct I/O with no buffering or locking, but all other services.Character streams: single-character get/put operations. Buffered, concept of a line. Editing is built on top of these.Monday, April 4 CS 470 Operating Systems - Lecture 33 15Application I/O InterfaceNetwork devices use socket interface: create, bind, connect, listen, accept, selectClocks and timers: operations to get current time, get elapsed time, set timer to trigger operation X at time T. Interface is not standardized. Interrupt rates are 18-60 ticks/sec. Heavily used by the OS and real-time applications.Most OS's have an escape (or backdoor) command that will pass arbitrary commands to a device. E.g. Unix ioctl( ) system call.Monday, April 4 CS 470 Operating Systems - Lecture 33 16Application I/O InterfaceBlocking vs. non-blocking I/O. Most physical actions are asynchronous, but most system calls are blocking, since they are easier to understand and use.Some user-level processes need non-blocking I/O to do "simultaneous" I/O operations. E.g. keyboard and display, or video read and display.Monday, April 4 CS 470 Operating Systems - Lecture 33 17Application I/O InterfaceSometimes there is a difference between non-blocking and asynchronousNon-blocking: call attempts to perform an operation and returns in a short amount of time with indication of how far it got.Asynchronous: call returns immediately without waiting for I/O to complete. Notification is given when operation complete. (Event interrupt.)Threads can be used to provide simultaneous


View Full Document
Download Lecture 33
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture 33 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture 33 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?