3 ms·
A lot of the discussion here has been around Lua, but not around what they do with it. I think that putting yet another language and runtime in the OS kernel i
by c3d 12y ago
A lot of the discussion here has been around Lua, but not around what they do with it.
I think that putting yet another language and runtime in the OS kernel is a bad idea. It makes the amount of code to validate much bigger. I much prefer the Mill Computing approach to security, where "everybody works the same" including the kernel (see http://millcomputing.com/docs/security/ http://millcomputing.com/docs/security/ if you have not seen it already). That's also the idea behind many microkernels.
Although the Mill CPU embeds basic mechanisms in the hardware to make it easier, I believe this could be achieved on modern x86 or ARM as well with reasonable performance. You don't need privileged instructions to deal with packet routing or CPU throttling, you only need controlled memory access to specific regions of memory (e.g. device registers, buffers, etc). I see no reason why the scripts could not do their work from user-space, with kernel-controlled access to the regions of memory they need to operate. And the overhead in doing that is practically zero (basically, it's the cost of the TLB translations, which is paid for every single memory access anyway).
Obviously, you also need inter-process and inter-CPU synchro, interrupt handling, etc. But all these are already presented in a virtualised form to user-space.
Also, if you want the flexibility of a scripting language, you are willing to forego quite a bit of performance in the process. Is the cost of a user-kernel transition really that relevant in this scenario? And if it is, there are mechanisms to mitigate that cost, e.g. pooling requests, deferring, sending to another CPU, etc.
I'm a bit appalled by the way they measure the overhead (Section 5 of the article). They say that their CPU rethrottling code runs in "only" 8 microseconds. Well, if compared to the rescheduling interval, it may seem small, 8 microseconds in kernel code is actually a lot. It means 1/125 of a regular millisecond tick. All this just to change the frequency of the CPU?
In short, I agree with the objectives (making the OS more extensible and more flexible), but the way they did it seems dangerous and under-optimal.
- fit2rule 12y ago>>I think that putting yet another language and runtime in the OS kernel is a bad idea. I'm of the opposite opinion. My experience with distributions and host-OS/integrated libs+bins, from a product perspective, lends me more towards the new-school idea of putting the Linux kernel in a bare machine with nothing but Lua.. because actually this is already a configuration and approach to embedded computing. Lua is used industriously as a configuration and embedded scripting language; it is one of the small/light/good-enough variants of the gems of the open source world. A full-stack Linux OS with strictly Lua front-end, from embedded to desktop, is an achievable target.. and indeed a worthy goal. There will always be new languages. Always. But what really matters is the usage factor. Putting an extreme case forward as a simplification of the field will always, thus, be an interesting exercise. As we can see with the router-Lua guys, often profitable. Imagine that space encroaching on Android, et al.? There are some who say that a bridging maneuver against the disastrous developer-mindset-killing, "iOS vs. Android" battle, has been waged, and its flag is Lua.