You are on page 1of 8
9 Input/Output Management earnin| wer reading this chapter, you will be able to: piscuss principles of I/O hardware including /O devi i y i é ja diferent goals of the VO software, ee ae Ff gxplore different ways to perform I/O operations. -ibe the functions of each layer in the /O software. 9A e techniques: Most I/O devices are connected to Ports» ‘es or devi ierthe kernel use = 9.2 PRINCIPLES OF 1/0 HARDWARE However, one needs to digest only 2 few concepts to un 9.2.1 10 Devices As stated earlier, f All these VO” devices can be roug Some commonly used block devices incluc an interact with the block devices throu ‘ich supports the following basic system call: - * read(); To read from the device. “writeQ: To write to the device. "seek(): To specify the next block to be accessed. IMPsOMpAL May is gem, ces.ast On the other hand, character deviceiigitheronethataccepts and produ SADC e-not addressable, The data transfer tovfeomy Unlike block devices, character devices are aa suraciendevicesncTudc tame tis Performed inuniteofbytes. Some commonly used charact Keyboards, my, ei h the character-stream jn, <2"! printers. Appl any interact with a character device througl “taracter-stream intertac Which supports the following basic system calls. , * get(): To read a character from the device. 1 PatO: To write a character to the device, In addition to block and character devices, there are certain devices that ne a HOF thes. Sategories. For exavaple, clocks and timers are such devices. They are neither block ac Tessable no, >* $* they accept or produce character streams; rafhenthey,are onlyitised ta generate interrupts after or” SS egpecitiea interval Note: Though block devices allow random access, some applications (for example, DBMS) may acces the block device as a sequential array of blocks. This type of access is referred to as raw Y/O, An UO device is attached with the computerssystem via a connection point knowmas-a/o P 10r9 (ike Sesial or parallel port). After Being attached, the device communicates with the computer Y Setiding signals over a bus, is a group of wires that specifies : a set of messages that can be Sent oye; it, Recall that Figure 1.2 of Chapter 01 shows the interconnection of various components to the ‘computer system via a bus, Note that the connection of some devices t0 the common bus is vis device controllers, ° ‘ iced Kelestsornie tyup,s \/222 Device Controllers tle units awaits Of @ rntelemi cod (device ise) Coeviced riven) \_Aldevice controller (or adapter) is an electronic component {hat can control One or more identical Sevices, depending on the type of device controller. For example, a serial-port controller is simple and controls the signals sent to the seal port. On the other hand, an SCSI controller is a complex device that can control multiple devices, ye Han baxeach) Cevice controlIe) includes one.or more tegisters. that play an important role in, = communication with processor. The processor writes data in these registers to.Jet the devie levice take ‘Ravasy Somevaction, and reads data fom’ these:registers to Know the status ef te device. There'are two clcart “approaches to let the communication b ‘een processor and controller occur. cun be, tnsertef In the firstapproach, speci {0 instructions arelused, which Specify the read or write signal, /O onespassion port address, and CPU register. The 1/0 port a idress helps in the selection of correct device a = & 0 yotectaet NOS a es ep ex di Input/Output Management Also, when hardware vendors it several available device \e er exporting one of the several standard interfaces. ‘Another aspect related to uniform interfacing is how /O devices are named. Itis the responsibility of the device-independent software to map the symbolic device names onto the appropriate device drivers, For instance, in Linux, devices appear as named objects in the file system. Each /O device is uniquely identified by the combination of mber and minor device number. The je us ile the minor a indicat 1e accessed. ‘An important issue related to device naming isthe protection of /O devices against uncontrolled access. The users should be able to access only those devices for which they have been permitted. iin UNIX, access to each device is controlled through rwx bits, which indicate the For example, permissions for that device. (b) Buffering Iding streams of data during data transfer between an Buffering serves the following purposes in a system : tea Se A a /) RE » 168 Inp/Ouput Managernen, * The speed of producer and consumer of data streams may differ, If the producer prody.., items at a faster speed than the consumer can consume or vice-versa, oe the producer 5, consumer would, respectively, be in waiting state for most of the time. To compensate f,, is speed mismatch between producer and se camel a eae Seneca Se : fer i mpty i r F pty buffer respectively. To resolve this, double buffering may be used, which allows sharing of two buffers between producer and consumer, thereby relaxing the timing requirement, between them. * The sender and receiver may have different data transfer sizes, Here again, buffers are used ty ‘cope with such disparities,. At the sender’s side, large data is fragmented into small packets, Which are then sent to the receiver, At the receiver's side, these packets are placed in a reassembly buffer to produce the source data. . (©) Error Handling Many kinds of hardware and application errors may occur in the system during example, a device may stop working or some /O transfer call may fail. The failures either due to transient reasons (such as overloaded network) or permanent (such as disk c failure), The /O subsystem protects against transi result. For instance, an /O system call returns one bit that operation. . ion. For may be ‘ontroller icates the success or failure of the

You might also like