Bài giảng Operating System Concepts - Module 12: I/O Systems

Tài liệu Bài giảng Operating System Concepts - Module 12: I/O Systems: Module 12: I/O SystemsI/O hardwaredApplication I/O InterfaceKernel I/O SubsystemTransforming I/O Requests to Hardware OperationsPerformanceOperating System ConceptsI/O HardwareIncredible variety of I/O devicesCommon conceptsPort Bus (daisy chain or shared direct access)Controller (host adapter)I/O instructions control devicesDevices have addresses, used by Direct I/O instructionsMemory-mapped I/OOperating System ConceptsPollingDetermines state of device command-readybusyerrorBusy-wait cycle to wait for I/O from deviceOperating System ConceptsInterruptsCPU Interrupt request line triggered by I/O deviceInterrupt handler receives interruptsMaskable to ignore or delay some interruptsInterrupt vector to dispatch interrupt to correct handlerBased on prioritySome unmaskableInterrupt mechanism also used for exceptionsOperating System ConceptsInterrupt-drive I/O CycleOperating System ConceptsDirect Memory AccessUsed to avoid programmed I/O for large data movement Requires DMA controllerBypasses...

ppt21 trang | Chia sẻ: honghanh66 | Lượt xem: 1277 | Lượt tải: 0download
Bạn đang xem trước 20 trang mẫu tài liệu Bài giảng Operating System Concepts - Module 12: I/O Systems, để tải tài liệu gốc về máy bạn click vào nút DOWNLOAD ở trên
Module 12: I/O SystemsI/O hardwaredApplication I/O InterfaceKernel I/O SubsystemTransforming I/O Requests to Hardware OperationsPerformanceOperating System ConceptsI/O HardwareIncredible variety of I/O devicesCommon conceptsPort Bus (daisy chain or shared direct access)Controller (host adapter)I/O instructions control devicesDevices have addresses, used by Direct I/O instructionsMemory-mapped I/OOperating System ConceptsPollingDetermines state of device command-readybusyerrorBusy-wait cycle to wait for I/O from deviceOperating System ConceptsInterruptsCPU Interrupt request line triggered by I/O deviceInterrupt handler receives interruptsMaskable to ignore or delay some interruptsInterrupt vector to dispatch interrupt to correct handlerBased on prioritySome unmaskableInterrupt mechanism also used for exceptionsOperating System ConceptsInterrupt-drive I/O CycleOperating System ConceptsDirect Memory AccessUsed to avoid programmed I/O for large data movement Requires DMA controllerBypasses CPU to transfer data directly between I/O device and memory Operating System ConceptsSix step process to perform DMA transferOperating System ConceptsApplication I/O InterfaceI/O system calls encapsulate device behaviors in generic classesDevice-driver layer hides differences among I/O controllers from kernelDevices vary in many dimensionsCharacter-stream or blockSequential or random-accessSharable or dedicatedSpeed of operationread-write, read only, or write onlyOperating System ConceptsBlock and Character DevicesBlock devices include disk drivesCommands include read, write, seek Raw I/O or file-system accessMemory-mapped file access possibleCharacter devices include keyboards, mice, serial portsCommands include get, putLibraries layered on top allow line editingOperating System ConceptsNetwork DevicesVarying enough from block and character to have own interfaceUnix and Windows/NT include socket interfaceSeparates network protocol from network operationIncludes select functionalityApproaches vary widely (pipes, FIFOs, streams, queues, mailboxes)Operating System ConceptsClocks and TimersProvide current time, elapsed time, timerif programmable interval time used for timings, periodic interruptsioctl (on UNIX) covers odd aspects of I/O such as clocks and timersOperating System ConceptsBlocking and Nonblocking I/OBlocking - process suspended until I/O completedEasy to use and understandInsufficient for some needsNonblocking - I/O call returns as much as availableUser interface, data copy (buffered I/O)Implemented via multi-threadingReturns quickly with count of bytes read or writtenAsynchronous - process runs while I/O executesDifficult to useI/O subsystem signals process when I/O completedOperating System ConceptsKernel I/O SubsystemSchedulingSome I/O request ordering via per-device queueSome OSs try fairnessBuffering - store data in memory while transferring between devicesTo cope with device speed mismatchTo cope with device transfer size mismatchTo maintain “copy semantics”Operating System ConceptsKernel I/O SubsystemCaching - fast memory holding copy of dataAlways just a copyKey to performanceSpooling - hold output for a deviceIf device can serve only one request at a time i.e., PrintingDevice reservation - provides exclusive access to a deviceSystem calls for allocation and deallocationWatch out for deadlockOperating System ConceptsError HandlingOS can recover from disk read, device unavailable, transient write failuresMost return an error number or code when I/O request fails System error logs hold problem reportsOperating System ConceptsKernel Data StructuresKernel keeps state info for I/O components, including open file tables, network connections, character device stateMany, many complex data structures to track buffers, memory allocation, “dirty” blocksSome use object-oriented methods and message passing to implement I/OOperating System ConceptsI/O Requests to Hardware OperationsConsider reading a file from disk for a process Determine device holding file Translate name to device representationPhysically read data from disk into bufferMake data available to requesting processReturn control to processOperating System ConceptsLife Cycle of an I/O RequestOperating System ConceptsPerformanceI/O a major factor in system performanceDemands CPU to execute device driver, kernel I/O codeContext switches due to interruptsData copyingNetwork traffic especially stressfulOperating System ConceptsIntercomputer communicationsOperating System ConceptsImproving PerformanceReduce number of context switchesReduce data copying Reduce interrupts by using large transfers, smart controllers, polling Use DMABalance CPU, memory, bus, and I/O performance for highest throughputOperating System Concepts

Các file đính kèm theo tài liệu này:

  • pptch12_8131.ppt
Tài liệu liên quan