Hacker News new | ask | show | jobs
by thristian 3636 days ago
CPU interrupts aren't too bad in a kernel, because a kernel is built around the idea of frequently switching task, so one more kind of switching isn't a big deal. Also, when the kernel asks the CPU to do something (like write to memory), the CPU will generally wait until the task is complete, or reaches some convenient checkpoint, before stopping and jumping to the interrupt vector.

On the other hand, most programs aren't designed for context switching, so the design overhead of dealing with signals is significant. Furthermore, signals can arrive at any time, even during a syscall, and while it's possible to do reliable I/O in the face of random interruptions, it's quite tricky.