Look up Singularity or Cosmos. But be aware that managed code != no security vulnerabilities (look at the huge raft of security issues Java or Android apps has had for instance)
I should not say managed code since it does not imply what I am thinking. More just a higher order framework that includes garbage collection and goes a long way in enabling the programmer to get the end result to the user. Like in C# and .NET the programmer is multiple times more productive than with COM and C++. The OS should have such a framework as its core.