Re: Choosing the right language for kernel development
Posted: Fri Nov 07, 2008 7:19 pm
The number needs to be validated, which reduces performance. Strong typing eliminates this by (for example) making the constructor unavailable to user mode code, so user mode code can only pass either a null reference (which is easy to check for) or a handle it already knows about.rdos wrote: Absolutely. The handle is only a number. This number is used to look up the kernel data. The handle could also be "typed", so the kernel knows the handle passed is associated with the data-type intended. The typing is kept in the kernel.
This is true, however user-mode code can still pass arbitrary values to the kernel, which need to be checked. Strong typing eliminates this check.rdos wrote: The handle is like the "this" pointer in C++. It refers to the object and is passed as a parameter to "methods". This means that all the user-level code knows about the object-data in the kernel is the handle, and nothing else. True encapsulation that is unbreakable, unlike C++ encapsulation.
I think he meant that type-safety applies to the entire system, not only to the kernel. Strong typing applied only to the kernel, and allowing unsafe applications does not have an advantage over traditional kernel designs, I suppose.rdos wrote: Not between kernel and user-level. Only within the same program. It is easy to break any type-safe language with assembler code.