OS_io_software
OS_io_software
Interrupts
The CPU hardware uses an interrupt request line wire which helps CPU to sense after executing
every instruction. When the CPU checks that a controller has put a signal on the interrupt request
line, the CPU saves a state, such as the current value of the instruction pointer, and jumps to the
interrupt handler routine at a fixed address. The interrupt handler part determines the cause of
the interrupt, performs the necessary processing and executes a interrupt instruction to return the
CPU to its execution state.
The basic mechanism of interrurpt enables the CPU to respond to an asynchronous event, such as
when a device controller become ready for service. Most CPUs have two interrupt request lines.
non-maskable interrupt - Such kind of interrupts are reserved for events like
unrecoverable memory errors.
maskable interrupt - Such interrupts can be switched off by the CPU before the execution
of critical instructions that must not be interrupted.
The interrupt mechanism accepts an address - a number that selects a specific interrupt handling
routine/function from a small set.In most architectures, this address is an offset stored in a table
called the interrupt vector table. This vector contains the memory addresses of specialized
interrupt handlers.
Speed of operation - Device speeds may range from a few bytes per second to a few
gigabytes per second.
Read-write, read only, or write only - Some devices perform both input and output, but
others support only one data direction that is read only.
Clocks
Clocks are also called timers. The clock software takes the form of a device driver though a clock
is neither a blocking device nor a character based device. The clock software is the clock driver.
The exact function of the clock driver may vary depending on operating system. Generally, the
functions of the clock driver include the following.
4 Providing watchdog timers for parts of the Watchdog timers are the timers set by
system itself certain parts of the system. For example, to
use a floppy disk, the system must turn on
the motor and then wait about 500msec for
it to comes up to speed.
Scheduling - Kernel schedules a set of I/O requests to determine a good order in which to
execute them. When an application issues a blocking I/O system call, the request is placed on
the queue for that device. The Kernel I/O scheduler rearranges the order of the queue to
improve the overall system efficiency and the average response time experienced by the
applications.
Buffering - Kernel I/O Subsystem maintains a memory area known as buffer that stores data
while they are transferred between two devices or between a device with an application
operation. Buffering is done to cope with a speed mismatch between the producer and
consumer of a data stream or to adapt between devices that have different data transfer
sizes.
Caching - Kernel maintains cache memory which is region of fast memory that holds copies
of data. Access to the cached copy is more efficient than access to the original.
Spooling and Device Reservation A spool is a buffer that holds output for a device, such
as a printer, that cannot accept interleaved data streams. The spooling system copies the
queued spool files to the printer one at a time. In some operating systems, spooling is
managed by a system daemon process. In other operating systems, it is handled by an in
kernel thread.
Error Handling An operating system that uses protected memory can guard against many
kinds of hardware and application errors.
Device driver
Device driver is a program or routine developed for an I/O device. A device driver implements I/O
operations or behaviours on a specific class of devices. For example a system supports one or a
number of multiple brands of terminals, all slightly different terminals may have a single terminal
driver. In the layered structure of I/O system, device driver lies between interrupt handler and
device independent I/O software. The job of a device driver are following.