-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Define "Virtualization" #156
Comments
cc @kriskowal |
A preliminary sketch: In computing, Virtualization is the partitioning of an actual computer into multiple virtual computers, preserving the illusion that each virtual computer is a whole physical computer. For example, kernel mode (host) programs can address all of a computer’s physical memory. A kernel conspires with hardware features to create an illusion for multiple user mode (guest) programs that they can also address all of a computer’s physical memory, each believing that their stack starts from the bottom of their address space and grows up, and that the heap starts at the top of addressable memory and grows down. They maintain this illusion by pausing guest programs while they swap pages of virtual and physical memory. This suggests a more general meaning for virtualization: For a particular host system, a virtualization of that system partitions the system into multiple virtual guest systems, providing an illusion that each virtual system is not observably different from the system as a whole. For ECMAScript, virtualization is specifically the implementation of a host feature with guest ECMAScript, such that there is no (or limited) observable difference between the behavior of the host and guest. For example, an ECMAScript program can virtualize most host objects that operate within the limits of the Meta Object Protocol, using a Proxy. |
I think that's a pretty good definition. A clarifying question: What are the boundaries expected that one can 'draw a line around'. Is the idea that 'virtualization surface' will -always- be encapsulated within a proxy, or is a new global object a desirable line? |
I don't think that the "multiple" part is a necessary part of this definition, and indeed most cases where I'm dealing with virtualization there is exactly one guest.
This implies that the point of virtualization is to provide the appearance of the actual host, whereas many use cases for virtualization involve providing the appearance of a host with different behavior than the actual host. The point of virtualizing host-provided timers, for example, is usually precisely to make them not behave as timers, which I wouldn't characterize as only a limited difference in behavior. Rather, I would say that from the point of view of the guest the behavior of a virtualized feature should (usually) not be distinguishable from the real behavior, while from the point of view of the host it might be quite different. |
@bakkot I agree with both of these clarifying nuances. |
@mgaudet I included Proxy as an example, but a case that is a central concern to me is virtualizing the behavior of |
See also
Because a universal Turing machine can emulate any other Turing machine, to have a useful definition of "virtualizability", we need something much narrower than emulation. The Popek/Goldberg criteria applied to language design suggests the constraint "without any source-to-source rewriting". This is perfectly applicable to JS and indeed how we've used it for JS. Because JS is so bloody difficult even to lex correctly, and because the syntax is a moving target across language versions, the "without rewriting" is an amazingly useful constraint for JS virtualization. Proxies enable JS code to emulate almost any host object without source-to-source rewriting, i.e., almost all host objects are virtualizable via proxies. Full Compartments would enable JS code on any host to emulate almost any other host behavior without source-to-source rewriting, including behavior provided via so-called "host hooks". I say "Full" because we expect to postpone most host hook virtualizations to later proposals, so committee resistance on any particular host hook virtualization need not delay the core Compartments proposal. The Popek/Goldberg split between "user-mode instructions" vs "system-mode instructions" is almost perfectly, and accidentally!, reflected in the JS distinction between the JS language, as defined by tc39, vs the various hosts, as defined for example by w3c. Aside from Thus, being able to intervene on global scope lookup enables the same kind of virtualizability as being able to redirect system calls. Being able to intercept other host hooks would complete the story, in the same way as being able to redirect other process traps. |
Good presentation :) Thanks for pointing it out. For an actual definition to be appended to the definitions, a helpful shape I think would be including some examples of potential threats to virtualization (like in Mark's presentation, `peek/poke) |
Some groups are interested in maintaining Virtualization; but I have only a weak mental model for this and think our definitions should define it I think.
The text was updated successfully, but these errors were encountered: