










































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!











































Operating System Concepts Silberschatz, Galvin and Gagne ©
■ Overview
■ I/O Hardware
■ Application I/O Interface
■ Kernel I/O Subsystem
■ Transforming I/O Requests to Hardware Operations
■ STREAMS
■ Performance
■ I/O management is a major component of operating system design and operation ● Important aspect of computer operation ● I/O devices vary greatly ● Various methods to control them ● Performance management ● New types of devices frequent
■ Ports , busses , device controllers connect to various devices
■ Device drivers encapsulate device details
● Present uniform device-access interface to I/O subsystem
■ Incredible variety of I/O devices
● Storage ● Transmission ● Human-interface
■ Common concepts – signals from I/O devices interface with computer
● Port – connection point for device ● Bus – daisy chain or shared direct access 4 PCI bus common in PCs and servers, e.g., PCI Express (PCIe) 4 Expansion bus connects relatively slow devices 4 Serial-attached SCSI ( SAS ) common disk interface ● Controller (host adapter) – electronics that operate port, bus, device 4 Sometimes integrated, sometimes separate circuit board (host adapter) 4 Contains processor, microcode, private memory, bus controller, etc.
■ Fibre channel ( FC ) is complex controller, usually separate circuit board (host-bus adapter, HBA ) plugging into bus
■ I/O instructions control devices
■ Devices usually have registers where device driver places commands, addresses, and data to write, or read data from registers after command execution ● Data-in register, data-out register, status register, control register ● Typically, data registers are 1-4 bytes in size, and with FIFO buffer
■ Devices have addresses , used by
● Direct I/O instructions ● Memory-mapped I/O 4 Device data and command registers mapped to processor address space 4 Especially for large memory-mapped region (e.g., graphics controller)
■ Polling can happen in 3 instruction cycles
● Read status, logical-and to extract status bit, branch if not zero ● How to be more efficient if non-zero infrequently?
■ CPU Interrupt-request line triggered by I/O device
● Checked by CPU after each instruction
■ Interrupt handler receives interrupts
● Maskable to ignore or delay some interrupts
■ Interrupt vector to dispatch interrupt to correct handler
● Context switch at start and end ● Based on priority ● Some nonmaskable ● Interrupt chaining if more than one device at same interrupt number
■ Stressing interrupt management because even single-user systems manage hundreds or interrupts per second and servers hundreds of thousands
■ For example, a quiet macOS desktop generated 23,000 interrupts over 10 seconds
■ I/O system calls encapsulate device behaviors in generic classes
■ Device-driver layer hides differences among I/O controllers from kernel
■ New devices talking already-implemented protocols need no extra work
■ Each OS has its own I/O subsystem structures and device driver frameworks
■ Devices vary in many dimensions
● Character-stream or block ● Sequential or random-access ● Synchronous or asynchronous (or both) ● Sharable or dedicated ● Speed of operation ● read-write, read only, or write only
■ Subtleties of devices handled by device drivers
■ Broadly I/O devices can be grouped by the OS into
● Block I/O ● Character I/O (Stream) ● Memory-mapped file access ● Network sockets
■ For direct manipulation of I/O device specific characteristics, usually an escape / back door ● Unix ioctl() call to send arbitrary bits to a device control register and data to device data register
■ UNIX and Linux use tuple of “major” and “minor” device numbers to identify type and instance of devices (here major 8 and minors 0-4) % ls –l /dev/sda*