Cool new Free software
Posted Dec 19, 2012 16:29 UTC (Wed) by
man_ls (subscriber, #15091)
In reply to:
Cool new Free software by nix
Parent article:
Status.net service to phase out, replaced by pump.io
I am not sure how select() and poll() work, but let me explain it a little bit better. With the classic model, a running process says that it wants to access e.g. the keyboard and then blocks on it: the whole process is frozen and its state is maintained. When an event comes, the kernel has to wake it up, thaw its state, and then let it run again where it left off.
In a callback model, a process registers to access to the keyboard, its state is preserved (in javascript as a few closures), and the process dies. When an event comes a new process is created, the closures are recovered and off we go. The new process may even be based on the kernel process instead of the original, although in this hand-waving scenario I am not sure if this is at all feasible. Note that the new process can only access those variables that it is actually going to use, not the whole address space.
(
Log in to post comments)