Question-1 Explain Device Independent I/O Software.
Exact boundary between the drivers and the device independent I/O software is system dependent.
Function of device independent I/O Software
o Uniform interfacing for device drivers.
o Error Reporting.
o Allocating and releasing dedicated devices.
o Providing a device-independent block size.
Uniform interfacing for device drivers
o A major issue of an OS is how to make all I/O devices and drivers look more or less the same.
o One aspect of this issue is the interface between the device drivers and the rest of the OS.
o Fig below (a) shows situation in which each device driver has a different interface to OS, it means that interfacing each new driver requires a lot of new programming effort.
o Fig below (b) shows a different design in which all drivers have the same interface.
o Now it becomes much easier to plug in a new driver
Figure – (a) Without a standard driver interface. (b) With a standard driver interface.
o Another aspect of having a uniform interface is how I/O devices are named.
o The device independent software takes care of mapping symbolic device names onto the proper driver.
o Protection is one more aspect which is closely related to naming.
o In UNIX and Windows, devices appear in the file system as named objects, so that the usual protection rules for the file are also applied to I/O devices.
o Buffering is also issue, both for block and character devices.
o In case of a process, which reads the data from the modem, without buffering the user process has to be started up for every incoming character.
o Allowing a process to run many times for short runs is inefficient, so this design is not a good one. (figure below(a))
o Buffer in users pace: here user process provides an n-character buffer in user space and does a read of n-characters. (figure below (b))
o Buffer inside kernel: to create the buffer inside the kernel and interrupt handler is responsible to put the character there. (figure below(c))
o Two buffers in kernel: the first buffer is used to store characters. When it is full, it is being copied to user space. During that time the second buffer is used.
o In this way, two buffers take turns.
o This is called double buffering scheme. (figure below(d))
Figure (a) Unbuffered input. (b) Buffering in user space. (c) Buffering in the kernel followed by copying to user space. (d) Double buffering in the kernel.
o Errors are far more common in the context of I/O than in other context. When they occur, the OS must handle them as best it can.
o One class of I/O errors is programming errors. These occur when a process asks for something impossible, such as writing to an input device or reading from an output device.
o The action taken for these errors is, to report an error code back to the caller.
o Another class of error is the class of actual I/O errors, for example trying to write a disk block that has been damaged.
o In this case, driver determines what to do and if it does not know the solution then the problem may be passed to the device independent software.
Allocating and releasing dedicated devices
o Some devices such as CD-ROM recorders can be used only by a single process at any given moment.
o A mechanism for requesting and releasing dedicated devices is required.
o An attempt to acquire a device that is not available blocks the caller instead of failing.
o Blocked processes are put on a queue, sooner or later the requested device becomes available and the first process on the queue is allowed to acquire it and continue execution.
Device-independent block size
o Different disks may have different sector sizes.
o It is up to the device independent I/O software to hide this fact and provide a uniform block size to higher layers.
You may be interested in:
Operating System Short Descriptive Questions and Answers