Better HN
topnewbestaskshowjobs
Log inSign up

LowerThanZero

8 karma · joined Apr 11, 2020 (6y ago) · 5 submissions

___ YAH
Submissions

comment 5y ago · link · parent

Because there is absolutely no equivalent of "letsencrypt" for email. Period.

comment 6y ago · link · parent

http://www.ce.uniroma2.it/~pellegrini//didattica/2017/aosv/1...

comment 6y ago · link · parent

Your question though rises an interesting problem: ULTIMATELY, is there a piece of code which loops while waiting for data? I guess the answer is "maybe" but it's more of a philosophical question... in my previous example the OS kernel running on the main CPU doesn't loop awaiting for a disk drive block or a network packet but the code running on the controller CPU most likely does.

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

Not necessarily. See, at hardware level the CPU can use what is called an "interrupt". In its simplest form it's a CPU pin that receives electrical signals from the outside world. The CPU can then well... interrupt from what it was doing and see what the problem was. That part of code which is run when the interrupt occurs it's called "interrupt handler". Say you wanna read a sector from a disk drive and your disk controller is hooked to the interrupt signal of the CPU... you tell the drive controller "gimme sector X" and then you (as a OS kernel) mind your own business doing other things. Once the platter spins in the right position and the read head is positioned etc etc that is milliseconds later the controller gets what you asked for and it issues an "interrupt" for the CPU. The kernel interrupt handler will go and fetch the desired block. Or even better, a DMA controller can do the job and take the data from the disk controller and move it somewhere in memory then only bother the CPU to say "The required block has arrived your highness" ;-)

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