3 ms·
so at a fundamental level, there’s really nothing other time slicing and interrupts. anything a single cpu does that looks like it’s doing 2 things at once, usu
by milesvp 3y ago
so at a fundamental level, there’s really nothing other time slicing and interrupts. anything a single cpu does that looks like it’s doing 2 things at once, usually there’s some loop somewhere that is moving data in and out of registers to allow 2 pieces of code to run interleaved. usually it’s doing this many times a second.
if the os doesn’t do this, the code running on the os can.
then there’s interrupts. if there is no threading loop, you can still register interrupts. this is a fundamental concept in cpu design. every cpu has some way of interrupting the current task and run some function. so you can register an interrupt handler for certain types of interrupts, and that code then is run instead of whatever code is running then when the interrupt is handled it does back to the place it was. It looks like you have non imperative code because 2 things happened close enough to look simultaneous, but its still sliced.