Why VMs are good, mmmmkay
Posted: Sat Apr 02, 2005 12:40 am
In this thread I argued that run-time environments such as the JVM and the CLI are the wave of the future. The discussion quickly turned towards the security-specific aspects of the argument, and I realized there was a lot more I wanted to say that wasn't part of that topic... so here it is.
The accusation was made that VMs are effectively redundant and exist because of laziness. I argue that there are a lot of benefits to running apps in a VM, and I will try to list here all the benefits I can think of, as I think of them. Comments and rebuttals are most welcome.
Why I like VMs #1: Memory protection
Part of the process of translating bytecode (or IL, or whatever each camp calls it) into machine code can include verifying it for "type safety". In a nutshell, this means no blind access to memory. This means no more memory corruption and all the subtle errors it can cause. Processes with different address spaces were created to deal with this problem, but it was quickly realized that crossing address spaces frequently was too expensive, and it made a lot more sense in many cases to implement certain things as shared libraries. The problem with shared libraries is that they share the address space with the process using them, and the quality of those written by 3rd parties cannot be guaranteed (sadly, software has bugs... we learn to live with it while trying to make things better).
The other day I was debugging two database drivers side-by-side in the same test tool, and I noticed that the rows of the table returned by one driver contained lots of garbage. Among that garbage were symbols that I knew were unique to the other driver! Obviously some pretty weird memory issues going on there...
Anyway, the point is, not having to worry about memory smashes when you're writing an application is pretty neat. It eliminates a large class of common errors, and the result is more robust software.
...continued...
The accusation was made that VMs are effectively redundant and exist because of laziness. I argue that there are a lot of benefits to running apps in a VM, and I will try to list here all the benefits I can think of, as I think of them. Comments and rebuttals are most welcome.
Why I like VMs #1: Memory protection
Part of the process of translating bytecode (or IL, or whatever each camp calls it) into machine code can include verifying it for "type safety". In a nutshell, this means no blind access to memory. This means no more memory corruption and all the subtle errors it can cause. Processes with different address spaces were created to deal with this problem, but it was quickly realized that crossing address spaces frequently was too expensive, and it made a lot more sense in many cases to implement certain things as shared libraries. The problem with shared libraries is that they share the address space with the process using them, and the quality of those written by 3rd parties cannot be guaranteed (sadly, software has bugs... we learn to live with it while trying to make things better).
The other day I was debugging two database drivers side-by-side in the same test tool, and I noticed that the rows of the table returned by one driver contained lots of garbage. Among that garbage were symbols that I knew were unique to the other driver! Obviously some pretty weird memory issues going on there...
Anyway, the point is, not having to worry about memory smashes when you're writing an application is pretty neat. It eliminates a large class of common errors, and the result is more robust software.
...continued...