8 karma · joined Apr 11, 2020 (6y ago) · 5 submissions
comment 6y ago · link · parent
So it's a matter of perspective I guess. You don't want to poll in your code and you want to let the kernel do the job for you. Does it mean that the kernel doesn't poll? Not necessarily; The kernel itself might be forced to "poll" (e.g. the device driver can't do otherwise) or it can outsource ;-) the dirty and time consuming poll job to a peripheral which in turn will have an embedded CPU and firmware.
Bottom line: if you poll it is GUARANTEED to be a waste of time and CPU cycles but if you let the kernel do it there's a chance that the system might do a better overall job. That's because main CPU time is really expensive while peripheral CPU resources might be cheaper in the big picture so ultimately it's not a "poll vs. no poll" but rather "specialized poll vs wasteful poll"
comment 6y ago · link · parent
Network controllers can issue interrupts so you know a packet has arrived... keyboard controllers too and so on. Hopefully you get the idea. :)
5.
Ask HN: C++ Equivalent to Illinois CS241?
1 points · by LowerThanZero · 6y ago · discuss