Print Friendly and PDF
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 sig nal on the interrupt request line, the CPU saves a
state, such as the current value ofthe instruction pointer, and j umps to the interrupt handler routine at a fixed
address. The interrupt handler part determines the cause ofthe 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-mask able interrupt
Such kind of interrupts are reserved for events like unrecoverable memory
errors.


mask able 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 ofspecialized interrupt handlers.

Application I/O Interface


Application I/O Interface represents the structuring techniques and interfaces for the operating system to
enable I/O devices to be treated in a standard, uniform way. The actual differences lies kernel level modules
called device drivers which are custom tailored to corresponding devices but show one ofthe standard
interfaces to applications. The purpose ofthe device-driver layer is to hide the differences among device
controllers from the I/O subsystem ofthe kernel, such as the I/O system calls. Following are the characteristics
of I/O interfaces with respected to devices.

Character-stream / block - A character-stream device transfers bytes in one by one fashion,whereas a block device transfers a complete unit of bytes.


Sequential / random-access - A sequential device transfers data in a fixed order determined by the device, random-access device can be instructed to seek position to any of the available data storage locations.
Synchronous / asynchronous - A synchronous device performs data transfers with known
response time where as an asynchronous device shows irregular or unpredictable response time.
Sharable / dedicated - A sharable device can be used concurrently by several processes or threads but a dedicated device cannot be used.

Speed of operation - Device speeds may rang e 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 ofa device driver thoug h a clock is neither a
blocking device nor a character based device. The clock software is the clock driver. The exact function ofthe
clock driver may vary depending on operating system. Generally, the functions ofthe clock driver include the
following .

S.N. Task Description



1  Maintaining the time of the day The clock driver implements the time of day or the
real time clock function.It requires incrementing a
counter at each clock tick.

2  Preventing processes from running too long As a process is started, the scheduler initializes the quantum counter in clock ticks for the process.The clock driver decrements the quantum counter by 1, at every clock interrupt. When the counter gets to zero , clock driver calls the scheduler to set up another process. Thus clock driver helps in preventing processes from running long er than time slice allowed.

3  Accounting for CPU usage Another function performed by clock driver is doing CPU accounting . CPU accounting implies telling how long the process has run.

4  Providing watchdog timers for parts of the system itself Watchdog timers are the timers set by certain 
parts of the system. For example, to use a floppy disk, the system must turn on the motor and then wait about 500 m sec for it to comes up to speed.

Kernel I/O Subsystem


Kernel I/O Subsystem is responsible to provide many services related to I/O. Following are some ofthe
services provided.


Scheduling


Kernel schedules a set ofI/O requests to determine a g ood 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 rearrang es the order ofthe queue to improve the overall system
efficiency and the averag e 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 ofa data stream or to adapt between
devices that have different data transfer sizes.
Caching -

Kernel maintains cache memory which is reg ion offast memory that holds copies ofdata.
Access to the cached copy is more efficient than access to the orig inal.
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 manag ed 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 g uard ag ainst many kinds of
hardware and application errors.

Device driver


Device driver is a prog ram 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 sing le 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 .

To accept request from the device independent software above it.
To see to it that the request is executed.
How a device driver handles a request is as follows: Suppose a request comes to read a block N. 
If the driver is idle at the time a request arrives, it starts carrying out the request immediately. Otherwise, if the driver is already busy with some other request, it places the new request in the queue of pending requests.
zubairsaif

Zubair saif

A passionate writer who loves to write on new technology and programming

Post A Comment:

0 comments: