0% found this document useful (0 votes)
93 views3 pages

Lesson6 Input and Output Devices and Interrupts

This document discusses input and output devices, interrupts, and interrupt handling. It begins by defining input devices as those that allow communication with the computer, like keyboards and mice, and output devices as those that display or print information, like monitors and printers. It then explains that an interrupt is a signal that suspends the current program to service a higher priority task, like I/O completion. There are different types of interrupts, including I/O, timer, and errors. When an interrupt occurs, the interrupt handler saves the state of the suspended program, services the interrupt, restores the saved state, and resumes the original program.

Uploaded by

leonard thuo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
93 views3 pages

Lesson6 Input and Output Devices and Interrupts

This document discusses input and output devices, interrupts, and interrupt handling. It begins by defining input devices as those that allow communication with the computer, like keyboards and mice, and output devices as those that display or print information, like monitors and printers. It then explains that an interrupt is a signal that suspends the current program to service a higher priority task, like I/O completion. There are different types of interrupts, including I/O, timer, and errors. When an interrupt occurs, the interrupt handler saves the state of the suspended program, services the interrupt, restores the saved state, and resumes the original program.

Uploaded by

leonard thuo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

LESSON6 INPUT AND OUTPUT DEVICES AND INTERRUPTS

Chapter Objectives
At the end of the chapter the learner shall be able to;
  Explain input and output devices and the role they play in a computer
 Define the term interrupt and explain the different types of interrupts
 Explain how an interrupt handler operates

5.1 Input Devices


An input device lets you communicate with a computer. They are used to enter
information and issue commands to the computer. Commands tell the computer
to do something, like save the file. A keyboard, mouse, scanner, digital camera,
touch pads and joystick are examples of input devices.

5.2 Output device


An output device displays information on a screen, creates printed copies or
generates sound. A monitor, printer, and speakers are examples of output devices.

The input and output devices are discussed in details in chapter 2 of the module.

5.3 Interrupts

An interrupt is a signal from some device or source seeking the attention of the
processor. The interrupt signal is sent along a control line to the processor, and
the currently executing program is suspended while control is passed to an
interrupt service routine.

5.3.1 Types of interrupt

The following are the different types of interrupt that could occur;

 Interrupts generated by the running process; the process might need


 to perform I/O, obtain more storage or communicate with the operator
 I/O interrupts; these are initiated by the I/O hardware and signal to the
CPU that the status of a channel or device has changed. An I/O interrupt
will occur when an I/O operation is complete, when an error occurs, or
 when device is made ready.
 Timer interrupts; these are generated by a timer within the processor,
and allow the operating system to perform certain functions at regular
intervals. For example, each user in a multi-user system may be allocated

41
 Program check interrupts; these are caused by various types of error such
as division by zero.
 Machine check interrupts; these are caused by malfunctioning hardware

5.3.2 Interrupt priorities

There is a special register in the CPU called the interrupt register. At the
beginning of each fetch-execute cycle, the interrupt register is checked. Each
bit of the register represents a different type of interrupt, and if a bit is set,
the state of the current process is saved and the operating system routes
control to the appropriate interrupt handler.

Some interrupts, such as those generate by hardware failure, may need to


be dealt with immediately, whereas such as an I/O device signaling that it
is ready for I/O, can be temporarily ignored. Interrupts are therefore
assigned priorities so that when two interrupts are received simultaneously,
the one with the highest priority is dealt with first. Only an interrupt with a
higher priority is allowed to interrupt the servicing of another.

Class of Interrupt Source of Interrupt Priority


Hardware failure Power failure-initiated when a decline in the 1
internal voltages is detected, giving the OS a few
milliseconds to close down as gracefully as
possible.
Memory parity error 1
Program Arithmetic overflow 2
Division by zero 2
Attempt to execute an illegal machine instruction 2
Reference outside a user’s allowed memory space 2
Timer Generated by internal clock within the processor 3
I/O I/O device signals normal completion or the 4
occurrence of an error condition

5.3.3 The Interrupt Handler

What happens when, for example, a key on the keyboard is pressed, thus
generating an interrupt? A small program called an interrupt service routine
(ISR) or interrupt handler is executed to transfer the character value f the key
pressed into main memory. A different ISR is provided for each different
source of interrupt. A typical sequence of actions when an interrupt occurs
would be:

42
1. The current fetch-execute cycle is completed
2. The contents of the program counter, which points to the next instruction of
the program to be executed, must be stored away safely so it can be restored
after servicing the interrupt.
3. The contents of other registers used by the user program are stored
away safely for later restoration
4. The source of the interrupt is identified
5. Interrupts of a lower priority are disabled
6. The program counter is loaded with the start address of the
relevant interrupt service routine.
7. The interrupt service routine is executed
8. The saved values belonging to the user program for registers other than the
program counter are restored to the processor’s registers
9. Interrupts are re-enabled
10. The program counter is restored to point to the next instruction to
be fetched and executed in user program

5.4 Chapter review questions


1. Give four different types of event that may cause an interrupt
2. When data is being sent to a printer an interrupt may occur. State two reasons
why an interrupt may occur in this case
3. Describe the role of priorities in the handling of interrupts

5.5 Suggested Readings

1. Fuller F., Larson B., Computers: Understanding Technology(Second


Edition) Pages 102-120

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy