Years pass by, every now and then a new user interface paradigm is created, but on the server side nothing really changes. No matter if we use Java, .NET or Ruby, the same old story is repeated again and again. A packet comes in, it goes to some kernel-level TCP library, then HTTP library or whole web server to finally come to the managed world of a virtual machine. During its processing a considerable amount of garbage gets generated and left to be later collected by the GC. This whole interaction happens under a control of an operating system that hosts a myriad of other processes (including a graphical user interface). The OS itself is virtual, working under control of a hypervisor.

Multiple layers of indirection cause heavy indeterminism. And I am not even mentioning metal level where x86 instructions are mapped to actual RISC instructions. I think we are slowly reaching the limits of such approach. We can’t increase the complexity of the architecture indefinitely. At some point we need to remove one moving part in order to be able to add another.

What can we do? Let’s imagine the runtime environment of the future. It does not need an OS. It boots directly as a guest VM. Because it is a virtual machine that runs managed code it does not need memory protection nor processes in order to achieve proper isolation. It can statically verify if the code does not violate the security restrictions on memory access (as implemented in Singularity). As RAM is super cheap these days there is no need for any form of memory paging.

When a request comes in, it is redirected to a lightweight process (consisting of a thread of control, a stack and a heap) that has both HTTP library and user code loaded. After the request is handled, the whole process is destroyed and its heap disposed. No garbage gets accumulated over time hence no ‘stop the world’ collection is ever necessary.

Everything happens inside one address space that runs in kernel mode (as the whole VM runs as OS). There is no need for any devices drives other than one for the network adapter. The number of moving part is reduced to minimum.

Because there is no OS and hence no shell of any form, how do we start our server program? We don’t. The VM image contains the actual VM binary, the user code binaries and all the third-party binaries it references.  The image is assembled at build time and it automatically boots the user code when started.

I would love to see it implemented with CLR and C# but it seems not possible. There is, however, a similar concept for Erlang — Erlang on Xen and I think it would be relatively easy to implement such thing with node/V8 as a VM. What do you think?

VN:F [1.9.22_1171]
Rating: 5.0/5 (3 votes cast)