Re: What do you think about managed code and OSes written in
Posted: Sat Jan 31, 2015 5:08 am
Then what about learning time problems, for example? Can they be detected at compile time?Brendan wrote:As far as I'm concerned; "managed" only means that the environment detects problems at run-time for more than just security/isolation purposes.
My definition has consequences:
- If problems are detected at compile time, then none are left to be detected at run time and it's not "managed".
Then what about a security manager, that never was a part of any bytecode?Brendan wrote:
- If hardware performs the run-time checks (e.g. someone built a CPU that uses Microsoft's CLI as it's native instruction set that honours the run-time checks) then it is still "managed".
Then what about runtime checks for invalid pointers? How it is possible to determine that the pointer is valid (i.e. it's value should be x-4 instead of x)?Brendan wrote:
- If the hardware doesn't do the run-time checks, then they can be done in software (either by a compiler injecting run-time checks into native code or by using an interpreter or JIT compiler) and it'd still be "managed".
Run time checks only define no managed environment.Brendan wrote:Mostly this means that (for my definition); "managed" doesn't necessarily mean that software does the run-time checks and doesn't necessarily mean executables can't be native code.
Well, then just define an algorithm for detecting all possible incorrect pointers. And the I will accept your definition without any problem.Brendan wrote:Also (for my definition), "managed environment" has nothing to do with the source code or language (e.g. you can execute C in a managed environment, or execute C# in an unmanaged environment) and has no effect on the time it takes for developers to actually write code (but can slightly improve the time it takes developers to find and fix bugs in code they've written).
Managed language is a part of a managed environment. Nothing will be managed if the system is split into some parts. Language without environment is unmanaged just as the environment without language is unmanaged too.Brendan wrote:A "managed language" is a language that's designed for a managed environment, and this has nothing to do with whether the code is actually executed in a managed environment or an unmanaged environment.
It's the same as above - just define an algorithm for detection of incorrect pointers.Brendan wrote:a "managed OS" is an OS where all (user-space) code executes within a managed environment (and has nothing to do with whether that code was written in a managed language or not).
In this case everything in the universe is "relatively safe". But if we notice that the "relatively safe" is a property of everything, then it will be a much simpler and still absolutely honest comparison if we just remove the "relatively safe" part from both compared sides. Just because x+y>x+z will always be the same as y>z.Brendan wrote:In this case; because the code is running in a managed environment it's "relatively safe" to avoid using the hardware's protection mechanisms for security/isolation (e.g. the Singularity research project). Note that "relatively safe" here means "100% safe, if and only if you can guarantee there's no bugs in the compiler or run-time environment, and no hardware faults".
There's just no need for such duality. All it is possible to combine in one single managed OS. If you are in a development stage then your environment just doesn't remove anything useful for debugging, runtime statistics and other stuff. But if you have decided that your code is as safe as if you will never be ashamed of it, then you can tell the environment that your code is "great" and it will compile it with all optimizations possible and run it under hardware protection as a purely native application.Brendan wrote:In my opinion; the best possible approach is to use an unmanaged language (where the programmer's hands aren't tied behind their back) and provide a managed environment that developers can use before releasing their software (e.g. something like valgrind maybe) and also provide an unmanaged environment that end users use after the software is released. This "dual environments" approach gives you the benefits of faster bug detection/fixing for developers while also giving you the benefits of max. performance for end users. Of course the disadvantage here is that it's a lot more work to create the compilers/environments needed to support "dual environments".