Hệ điều hành - Chapter 5: Input/ Output
Telling the programs to use less energy
may mean poorer user experience
Examples
change from color output to black and white
speech recognition reduces vocabulary
less resolution or detail in an image
63 trang |
Chia sẻ: nguyenlam99 | Lượt xem: 1014 | Lượt tải: 0
Bạn đang xem trước 20 trang tài liệu Hệ điều hành - Chapter 5: Input/ Output, để xem tài liệu hoàn chỉnh bạn click vào nút DOWNLOAD ở trên
Input/OutputChapter 55.1 Principles of I/O hardware5.2 Principles of I/O software5.3 I/O software layers5.4 Disks5.5 Clocks5.6 Character-oriented terminals5.7 Graphical user interfaces5.8 Network terminals5.9 Power management1Principles of I/O HardwareSome typical device, network, and data base rates2Device ControllersI/O devices have components:mechanical component electronic componentThe electronic component is the device controllermay be able to handle multiple devicesController's tasksconvert serial bit stream to block of bytesperform error correction as necessarymake available to main memory3Memory-Mapped I/O (1)Separate I/O and memory spaceMemory-mapped I/OHybrid4Memory-Mapped I/O (2)(a) A single-bus architecture(b) A dual-bus memory architecture5Direct Memory Access (DMA)Operation of a DMA transfer6Interrupts RevisitedHow interrupts happens. Connections between devices and interrupt controller actually use interrupt lines on the bus rather than dedicated wires7Principles of I/O SoftwareGoals of I/O Software (1)Device independenceprograms can access any I/O device without specifying device in advance (floppy, hard drive, or CD-ROM)Uniform namingname of a file or device a string or an integernot depending on which machineError handlinghandle as close to the hardware as possible8Goals of I/O Software (2)Synchronous vs. asynchronous transfersblocked transfers vs. interrupt-drivenBufferingdata coming off a device cannot be stored in final destinationSharable vs. dedicated devicesdisks are sharabletape drives would not be9Programmed I/O (1)Steps in printing a string10Programmed I/O (2)Writing a string to the printer using programmed I/O11Interrupt-Driven I/OWriting a string to the printer using interrupt-driven I/OCode executed when print system call is madeInterrupt service procedure12I/O Using DMAPrinting a string using DMAcode executed when the print system call is madeinterrupt service procedure13I/O Software LayersLayers of the I/O Software System14Interrupt Handlers (1)Interrupt handlers are best hiddenhave driver starting an I/O operation block until interrupt notifies of completionInterrupt procedure does its taskthen unblocks driver that started itSteps must be performed in software after interrupt completedSave regs not already saved by interrupt hardwareSet up context for interrupt service procedure15Interrupt Handlers (2)Set up stack for interrupt service procedureAck interrupt controller, reenable interruptsCopy registers from where savedRun service procedure Set up MMU context for process to run nextLoad new process' registersStart running the new process16Device DriversLogical position of device drivers is shown hereCommunications between drivers and device controllers goes over the bus17Device-Independent I/O Software (1)Functions of the device-independent I/O softwareUniform interfacing for device driversBufferingError reportingAllocating and releasing dedicate devicesProviding a deice-independent block size18Device-Independent I/O Software (2)(a) Without a standard driver interface(b) With a standard driver interface19Device-Independent I/O Software (3)(a) Unbuffered input(b) Buffering in user space(c) Buffering in the kernel followed by copying to user space(d) Double buffering in the kernel20Device-Independent I/O Software (4)Networking may involve many copies21User-Space I/O Software Layers of the I/O system and the main functions of each layer22DisksDisk Hardware (1)Disk parameters for the original IBM PC floppy disk and a Western Digital WD 18300 hard disk23Disk Hardware (2)Physical geometry of a disk with two zonesA possible virtual geometry for this disk24Disk Hardware (3)Raid levels 0 through 2 Backup and parity drives are shaded25Disk Hardware (4)Raid levels 3 through 5Backup and parity drives are shaded26Disk Hardware (5)Recording structure of a CD or CD-ROM27Disk Hardware (6)Logical data layout on a CD-ROM28Disk Hardware (7)Cross section of a CD-R disk and lasernot to scaleSilver CD-ROM has similar structurewithout dye layerwith pitted aluminum layer instead of gold29Disk Hardware (8)A double sided, dual layer DVD disk30Disk Formatting (1)A disk sector31Disk Formatting (2)An illustration of cylinder skew32Disk Formatting (3)No interleavingSingle interleavingDouble interleaving33Disk Arm Scheduling Algorithms (1)Time required to read or write a disk block determined by 3 factorsSeek timeRotational delayActual transfer timeSeek time dominatesError checking is done by controllers34Disk Arm Scheduling Algorithms (2)Shortest Seek First (SSF) disk scheduling algorithmInitialpositionPendingrequests35Disk Arm Scheduling Algorithms (3)The elevator algorithm for scheduling disk requests36Error HandlingA disk track with a bad sectorSubstituting a spare for the bad sectorShifting all the sectors to bypass the bad one37Stable StorageAnalysis of the influence of crashes on stable writes38ClocksClock HardwareA programmable clock39Clock Software (1)Three ways to maintain the time of day40Clock Software (2)Simulating multiple timers with a single clock41Soft TimersA second clock available for timer interruptsspecified by applicationsno problems if interrupt frequency is lowSoft timers avoid interruptskernel checks for soft timer expiration before it exits to user modehow well this works depends on rate of kernel entries42Character Oriented TerminalsRS-232 Terminal HardwareAn RS-232 terminal communicates with computer 1 bit at a timeCalled a serial line – bits go out in series, 1 bit at a timeWindows uses COM1 and COM2 ports, first to serial linesComputer and terminal are completely independent43Central buffer poolDedicated buffer for each terminalInput Software (1)44Input Software (2)Characters handled specially in canonical mode45Output SoftwareThe ANSI escape sequencesaccepted by terminal driver on outputESC is ASCII character (0x1B)n,m, and s are optional numeric parameters46Display Hardware (1)Memory-mapped displaysdriver writes directly into display's video RAMParallel port47Display Hardware (2)A video RAM image simple monochrome displaycharacter modeCorresponding screenthe xs are attribute bytes48Input SoftwareKeyboard driver delivers a numberdriver converts to charactersuses a ASCII tableExceptions, adaptations needed for other languagesmany OS provide for loadable keymaps or code pages49Output Software for Windows (1)Sample window located at (200,100) on XGA display50Output Software for Windows (2)Skeleton of a Windows main program (part 1)51Output Software for Windows (3)Skeleton of a Windows main program (part 2)52Output Software for Windows (4)An example rectangle drawn using Rectangle53Output Software for Windows (5)Copying bitmaps using BitBlt.beforeafter54Output Software for Windows (6)Examples of character outlines at different point sizes55Network TerminalsX Windows (1)Clients and servers in the M.I.T. X Window System56X Windows (2)Skeleton of an X Windows application program57The SLIM Network Terminal (1)The architecture of the SLIM terminal system58The SLIM Network Terminal (2)Messages used in the SLIM protocol from the server to the terminals59Power Management (1)Power consumption of various parts of a laptop computer60Power management (2)The use of zones for backlighting the display61Power Management (3)Running at full clock speedCutting voltage by two cuts clock speed by two, cuts power by four62Power Management (4)Telling the programs to use less energymay mean poorer user experienceExampleschange from color output to black and whitespeech recognition reduces vocabularyless resolution or detail in an image63
Các file đính kèm theo tài liệu này:
- operating_system_chapter_05_8662.ppt