Hacker News new | ask | show | jobs
by delusional 2320 days ago
I'm curious here. In my mind the computer is basically imperitive. It processes a series of instructions. It then happens to process multiple of such streams at once, but it's still essentially serial.

How is it event driven?

4 comments

It's event driven in the manner of stimulus/response. A computer may process a series of instructions, but absent a loop it then finishes and does nothing without being told to process another series of instructions. Even within a listening loop it is essentially looking for "something to happen" and if nothing happens it NOPs, or does some basic house cleaning regarding the loop which is essentially the same. It is only when a stimulus occurs that the computer responds with a not-loop series of instructions.
I suspect they’re confusing “event driven” with “interrupt driven”.
Yes, interrupts and events are distinct.

Would it be clearer to say sequential vs asynchronous?

Or to say that interrupts are one form of event, but not all events involve interrupts.

Most computers have had more than one core and even additional cpu's like a gpu. Also things on the bus usually have their own processors. So things are happening at the same time, it might tick at the same rate that the bus allows but they communicate by events like interrupts. As far as I understand it.
i/o, exceptions, system calls.. all these (usually) involve stopping the sequential flow of your program and doing something else.