1

I'm gonna sketch my understanding of both. I've googled around but i'm not sure about my knowledge. Please correct me!

Hardware interrupt is generated by the operation system event scheduler to reassign the cpu time for another process. Is this true?

Software interrupt can be generated from a running program who wants for example to read a file, and for that we need to reassign the cpu for the appropriate operation system call. Is this true?

Is there other kind of software/hardware interrupts?

user9517
  • 115,471
  • 20
  • 215
  • 297
p1100i
  • 579
  • 2
  • 7
  • 15

1 Answers1

3

Hardware and software interrupts primarily differ by how they're generated: hardware interrupts are generated by hardware, e.g. a timer, keyboard, network card etc while software interrupts are triggered by a special software instruction (e.g. int 0x80). There is also a related difference in their role: hardware interrupt handlers are supposed to handle hardware events (e.g. a packet arriving on a network interface) while software handlers are supposed to serve another piece of software, usually an application, which executed the interrupt instruction (e.g. in order to request the kernel to access a file on application's behalf).

Timer interrupt is indeed used by operating system's scheduler to periodically regain control and perform various operations (e.g. resource accounting, context switches).

Generating a software interrupt is one way of communicating with the kernel and may be used on some platforms to invoke system calls.

Adam Zalcman
  • 780
  • 5
  • 19