An application paradigm of non-persistent programs has the challenge of invoking programs very rapidly.
Consider the nearly worst case scenario of a mouse moving over a region that is mapped to a program. Instead of a persistent program, the global UI calls the program rapidly with onMouseOver parameters for each pixel the mouse passes over. For every program invocation, the program load, must read in its old state from the filesystem, process the onMouseOver, and write back out the new state.
Inspired by the Hashlife algorithm, and taking advantage that a computer program is deterministic given its inputs, the operating system memoizes some of the program's computation, keeping the cache in memory, so it can very quickly load and execute. Just knowing the name of the program and the changed input, it instantaneously fast-forwards (instead of executing) to the point where the computation might diverge due to the changed input. Because the cache stays in memory, it's almost as if it were a persistent program. The details of this are likely very tricky: the programmer can give hints, and the operating system can try to automatically detect and guess.
I wonder if a rudimentary form of this can be used to speed up loading of /bin/bash for shell scripts called boot up, helping smooth over the dash vs bash controversy in Debian and Ubuntu.
No comments:
Post a Comment