Gestalte GoConqr mit. Was sollen wir als Nächstes hinzufügen?

Notizen

Transfer of control via Interrupts

Matthew Swart Englisch 4 Seiten

Inhalt der Notizen (4)

Seite 1

From the point of view of the user program, an interrupt is just that: an interruption

of the normal sequence of execution. When the interrupt processing is completed,

execution resumes. Thus, the user program does not have to contain any

special code to accommodate interrupts; the processor and the operating system are

responsible for suspending the user program and then resuming it at the same point.

From the point of view of the user program, an interrupt is just that: an interruption of the normal sequence of execution…

Seite 2

Instruction Cycle with Interrupts

In the interrupt cycle, the processor checks to see if

any interrupts have occurred, indicated by the presence of an interrupt signal. If no

interrupts are pending, the processor proceeds to the fetch cycle and fetches the

next instruction of the current program. If an interrupt is pending, the processor

does the following:

• It suspends execution of the current program being executed and saves its

context. This means saving the address of the next instruction to be executed

(current contents of the program counter) and any other data relevant to the

processor’s current activity.

• It sets the program counter to the starting address of an interrupt handler routine.

The processor now proceeds to the fetch cycle and fetches the first instruction

in the interrupt handler program, which will service the interrupt. The interrupt

handler program is generally part of the operating system. Typically, this program

determines the nature of the interrupt and performs whatever actions are needed.

In the example we have been using, the handler determines which I/O module

generated the interrupt and may branch to a program that will write more data out

to that I/O module. When the interrupt handler routine is completed, the processor

can resume execution of the user program at the point of interruption.

It is clear that there is some overhead involved in this process. Extra instructions

must be executed (in the interrupt handler) to determine the nature of the interrupt

and to decide on the appropriate action. Nevertheless, because of the relatively large

amount of time that would be wasted by simply waiting on an I/O operation, the

processor can be employed much more efficiently with the use of interrupts.

In the interrupt cycle, the processor checks to see if any interrupts have occurred, indicated by the presence of an…

Seite 3

Program Timing Short I/O Wait

In this figure, user program code segments are shaded green, and I/O program code segments are shaded gray.

a) shows the case in which interrupts are not used. The processor must

wait while an I/O operation is performed.

b) assumes that the time required for the I/O operation is

relatively short: less than the time to complete the execution of instructions between write

operations in the user program. In this case, the segment of code labeled code segment

2 is interrupted. A portion of the code (2a) executes (while the I/O operation is performed)

and then the interrupt occurs (upon the completion of the I/O operation). After

the interrupt is serviced, execution resumes with the remainder of code segment 2 (2b).

In this figure, user program code segments are shaded green, and I/O program code segments are shaded gray. a) shows the…

In this figure, user program code segments are shaded green, and I/O program code segments are shaded gray. a) shows the…

Seite 4

Instruction Cycle (with Interrupts) - State Diagram

Instruction Cycle (with Interrupts) - State Diagram

Informationen

Beschreibung
Notiz am Transfer of control via Interrupts, erstellt von Matthew Swart am 20/11/2018.
Erstellt von
Matthew Swart · Nov 2018
Aktualisiert
20 Nov 2018
Aufrufe
10
Bewertung

Mehr zu I/O Modules, Interfaces and Techniques

Feedback

Worum geht es?

Was sollen wir als Nächstes hinzufügen?