David Madore's WebLog: On processors, virtualization, and reflexivity

Index of all entries / Index de toutes les entréesXML (RSS 1.0) • Recent comments / Commentaires récents

Entry #0529 [older|newer] / Entrée #0529 [précédente|suivante]:


On processors, virtualization, and reflexivity

Let me talk about geeky matters, for a change.

I'd like to say something about architecture emulation / sandboxing / virtualization (I'm not sure what the best term is). What I am referring to is a program that lets you run, on a given computer (hardware+software) platform, programs meant for another platform (or perhaps even the very same platform: although the worth of that is not obvious at first sight, it is actually very useful). Here are some examples: the Bochs project is an emulator for the entire Intel-32 (x86) PC platform, which runs on many different platforms, and lets you run mostly anything a PC can run, although it incurs a very high performance penalty; the Plex86 program (a free clone of VMware) is another Virtual Intel-32 platform (although recent versions, apparently, can now only run the Linux operating system), but this one runs only on the Intel-32 platform itself and makes use of native instructions as much as possible to achieve a much lower execution cost than Bochs; the QEMU emulator is more general since it aims to emulate several different architectures on several different platforms; the User-mode Linux is a Linux implementation that runs (entirely in userland, and without special privileges) on top of another Linux implementation; along a related line, I should also mention Systrace (lets you run programs in a sandbox on various Uni*es), and of course the emulators for a whole lot of “heroic day” platforms (I keep losing my pointers to the PDP architecture emulators that I used to play with to run very old versions of Unix, but there are plenty of other things in the same vein, with emulated platforms ranging from PC's of fifteen years back to modern hand-held calculators) or specific emulators specialized in various gaming virtual machines (LucasArt, Infocom, Sierra and so on).

I do not propose to give a mathematically rigorous definition of what an emulator is (in any case, it would probably include any kind of interpreter, and possibly any kind of program altogether): we have a reasonable—pragmatic—idea of that.

Now here's an important remark: apparently, emulation/virtualization/whatever incurs a performance penalty. The more you rely upon the host architecture functions to reproduce the emulated architecture functions, the lower the penalty: this is why Plex86 runs hundreds of times faster than Bochs — because, insofar as possible, it uses the x86 directly to emulate an x86 rather than reimplementing it. The Intel x86 processor has a special mode called virtual 8086 mode or something like that, which lets you run (real-mode) x86 instructions in a kind of “virtual box”, except for certain privileged instructions which must be reimplemented in software (perhaps at great cost).

And here's a question that baffles me thoroughly: is it possible to implement a “Completely Reflexive” processor, in the sense that the overhead of completely emulating the processor on itself (including the reflexive ability itself, of course!) would have a very low cost (with a reasonable definition of low cost; of course, the memory used up by the emulator itself would not be available in the emulated system, for instance!). Even if one were to set traps and debug breakpoint conditions in the emulated system (and even if the latter itself used traps and breakpoints…).

Faré, if you can read me, please enlighten me!

↑Entry #0529 [older|newer] / ↑Entrée #0529 [précédente|suivante]

Recent entries / Entrées récentesIndex of all entries / Index de toutes les entrées