Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

please, I know that when you for example divide by zero, the aproptiate flag is set in CPU flag register. But today I read that there are special interrupt vectors (I think the first 16 in IVT) that are used for such conditions like dividing by zero. So, what I want to ask is, does any situation that couses change som flag also triggers apropriate interrupt? Becouse in school, we used conditional jumps that checks wheather carry flag has been set or not, and I don´t remember there was some interrupt triggerd by that. So I am pretty confused now.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

There are two types of interrupts.

The first type are interrupts for signalling hardware events, like that the hardware timer has elapsed or that the hard drive controller has finished transferring data to memory.

The second type are interrupts for signalling some unexpected condition. Some examples are: access to invalid memory, division by zero (actually it's "divide overflow" that occurs not only when you divide by zero, but even when you divide a very large value by a very small value), breakpoint instruction, hardware breakpoint etc. This type of exceptions are raised by CPU when it cannot complete the current instruction and usually result in terminating the current process or breaking into debugger. They are actually unrelated to CPU flags, which hold the results of the latest instruction.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.