Fast means pretty much being able to run Node.js, since we need to be able to give a situation where code is not only generated at run time, but is also changed at run time, maybe modified in place, or maybe just deleted and put somewhere else. This also happens when running code with V8, because code itself is garbage collector and moves around memory over time.
And then we wanted to build something scalable. What this means is that although I showed you guys just a bunch of yellow words, this thing can work on much bigger code bases. We wanted to build something that can work with programs in the wild, which means we want to support multiprocessing, multithreading, thousand of files, and all the sort of features that are effectively used by programs that are real, not just toys.
To give you an idea what we've seen so far, Chirpx is this environment in which all the execution happens. And it's all client-side. It's all in the browser. There is no server-side component doing the execution for us. This is not a trick. And the first thing to start is Bash. So Bash is the parent process. And then Bash itself can spawn sub-processes, child processes, and I showed you GCC and Python, and all of these are actually completely independent to other spaces. They have their own code and they have their own data.
But the issue is that, from the point of view of the system, we don't really know what is code and what is data. These two things are just bites. It's just old data in memory. And to solve this problem, we have actually a two-tiered execution engine. The first tier is an interpreter, and the second tier is an actual JIT engine that can generate highly optimized code. And the interpreter is able to pretty much run code without any information. It will start from the first instruction and put it to the next and so on and so forth. And as it does this, it will also build the metadata internally about how the code is structured. And with that, it's now possible to fire up the JIT engine to generate optimized, robust code out of this.
And eventually, all these applications will need to reach the browser somehow because we need to display text on screen, for example. And this happens as you would expect on a native system via syscalls. And syscalls, we implemented them ourselves. So what you saw so far is not a Linux kernel. It is a Linux-compatible ABI, so it's able to run any Linux executable, but it's not Linux itself. And the system call is the place where we stop and implement the system call manually so that they can interact with the browser. And now you might wonder why don't we just run everything in the JIT, since it's most likely more efficient.
Comments