Tim
Tim

Reputation: 99508

Is "I/O device request" external interrupt or internal exceptions?

From Computer Organization and Design, by Patterson et al

enter image description here

Why is "I/O device request" external interrupt?

Does "I/O device request" mean that a user program request I/O device services by system calls? If yes, isn't a system call an internal exception?

Thanks.

Upvotes: 0

Views: 326

Answers (3)

Hans Passant
Hans Passant

Reputation: 942040

Because the interrupt isn't generated by the processor or the program. It is a physical wire connected to the interrupt controller whose state changes. Driven by the controller for the device, external to the processor. The interrupt handler is usually located in a driver that knows how to handle the device controller's request for service.

"Invoke the operating system" is a software interrupt, usually switches the processor into protected mode to handle the request.

"Arithmetic overflow" is typically a trap that's generated by the floating point unit on the processor.

"Using an undefined instruction" is another trap, generated by the processor itself when it can't execute code anymore because the instruction is invalid.

Processor usually have more traps like that. Like division by zero. Or executing a privileged instruction. Or a page fault when virtual memory isn't mapped to physical memory yet. Or a protection fault when the program reads an unmapped virtual memory address.

Upvotes: 1

user3344003
user3344003

Reputation: 21647

The path in to the operating system is an array of pointers. This carry may have different names depending upon the system. I will call it the "dispatch table." The dispatch table handles everything that needs the attention of the operating system: Interrupts, faults, and traps. The last two are collectively "exceptions".

An exception is caused by executing an instruction. They synchronous. An interrupt is as caused by by something occurring outside the executing process/thread.

A user invokes the the operating system synchronously by executing an instruction that causes a trap (On intel chips they misname such a trap a "software interrupt"). Such an even is a synchronous, predictable result of the instruction stream.

Such a trap would be used to queue an I/O request to the device. "Invoke the operating system from user program" in your table.

The device wold cause an interrupt when the request is completed. That what is meant by an "I/O Device Request" in your table.

The confusion is that interrupts, faults and traps are all handled the same way by the operating system through the dispatch table. And, as I said, in Intel land they call both traps and interrupts "Interrupts".

Upvotes: 1

Martin James
Martin James

Reputation: 24887

It's referring to peripheral devices signaling that they require attention, eg. disk controller hardware that is now ready to satisfy a read request that it received earlier, (or has finished DMAing in data for the read request).

Upvotes: 1

Related Questions