Educational Blog Sites

Saturday, July 29, 2017

Computer and Operating System Structure

Unit 2 : Computer and Operating System Structure

Lesson 1 : Interrupts and I/O Structure
1.1. Learning Objectives
On completion of this lesson you will know :
i)  what interrupt is
ii)  the causes of occurring interrupt
iii) instruction cycle with interrupt
iv)  I/O structure.

1.2. Interrupts
A method by which other events can cause an interruption of the CPU's normal execution. An Interrupt is a method by which the normal operation of the CPU can be changed. Interrupts are a better solution than polling for handling I/O devices. There are many methods to handle interrupts. Four general classes of interrupts are :
i)  Program, trap instructions, page faults etc.
ii) Timer
iii)  I/O devices and
iv)  Hardware failure.
When an interrupt occurs a register in the CPU will be updated. When the CPU finishes the current execute cycle, and when interrupts are enabled, it will examine the register. If the register indicates that an interrupt has occurred and is enabled the interrupt cycle will begin, Otherwise it will be bypassed. The interrupt cycle will call some form of interrupt handler (usually supplied by the operating system) that will examine the type of interrupt and decide what to do. The interrupt handler will generally call other processes to actually handle the interrupt.

Simple Interrupt Processing
Steps for processing interrupts are shown below where steps 1 to 5 is done by hardware and from 6 to 9 is done by software
1. Interrupt occurs
2. Processor finishes current instruction
3. processor signals acknowledgment of interrupt
4. processor pushes program status word (Program Status Word) and program counter (Program Counter) onto stack
5. processor loads new Program Counter value based on interrupt
6. save remainder of process information
7. process interrupt
8. restore process state information
9. restore Program Status Word and Program Counter.
1.3. I/O Structure
One of the main functions of an OS is to perform all the computer's I/O devices. It issues commands to the devices, catch interrupts and handle errors. It provide an interface between the devices and the rest of the system. We will discuss the I/O hardware and I/O Software..
1.3.1. I/O Hardware
The I/O hardware is classified as
i)  I/O devices
ii)  Device controllers and
iii)  Direct memory access (DMA).

I/O Devices
Normally all input and output operations in operating system are done through two types of devices; block oriented devices and character oriented devices. A block oriented device is one in which information is stored and transferred at some fixed block size (usually some multiple of 512 bytes), each one with its own address. The block oriented device can read or write each block independently of all other ones out or expand.
The character oriented device is one in which information is transferred via a character stream. It has no block structure. It is not addressable. For example, punched cards, terminals, printers, network interfaces, mouse etc.
The above classification scheme is not always true. Some device do not fit in. So, the idea of device driver was introduced. The idea of device driver is to provide a standard interface to all hardware devices. When a program reads or writes a file, OS invokes the corresponding driver in a standardized way, telling it what it wants done, thus decoupling the OS from the details of the hardware.
Device Controller
I/O units consist of mechanical and electronic components. The electronic component is called device controller. It is also called printed circuit card. The operating system deals with the controller.
The controller's job is to convert the serial bit stream into a block of bytes and perform any error connection necessary. The controller for a CRT terminal also works as a bit serial device at an equally low level.
Each controller has a few registers that are used for communicating with the CPU and these registers are part of the regular memory address space. This is a called memory mapped I/O. IBM PC uses a special address space for I/O with each controller allocated a certain portion of it. The following table shows some examples of the controllers and their I/O addresses.
Share:

0 comments:

Post a Comment

Translate

Total Pageviews

Search This Blog

Blog Archive

Recent Posts