The 411 on Process Virtual Machines

Most everyone uses ones of these every day and don’t know it. Some that do know either don’t understand it or, even worse, misunderstand it. Yet if anyone ever ran a Java program or a .NET based program they’ve used one.

At its most basic, a Process Virtual Machine (PVM) is somewhat like the Virtual Machines (think VirtualBox) that run whole operating systems. The main difference between the two being  PVMs only virtualize processes, not whole operating systems. The main idea of a PVM is to simplify the creation of programs as well as making programs easy to use for the end user.

Java and .NET both have their own systems, but the basic idea remains the same: a coder can make a code once and the PVM deals with making it run on different computers.  In Java’s case, this means that a programmer can make one code that will run on Windows, Mac, UNIX, Linux, and even mobile phones.  In the case of .NET, a programmer can target any Windows based device and have the code work with little or no changes. This helps developers target very large groups of people with minimal expense in terms of time and money. Furthermore, PVMs makes programming easier since a lot of things that a programmer normally has to worry about, things they would usually have to code manually, can be easily called instead of created. Continuing on that trend, PVM based programs are also safer since the program is running in a virtual machine, making it harder to mess up the system (though not impossible, trust me, I know =D).

On the flip side not everything is rosy in PVM park. For starters you need to have the PVM installed on your computer, though in the case of .NET if you keep your computer up to date odds are you will have .NET (or, depending on what Windows you have, you may not even need to download it from anywhere because various versions of .NET come with Windows Vista and Win7). If you don’t have the PVM or even the correct version (in general having a new version is ok) the program won’t run.  And the PVM is not always that small – the installer for .NET 3.5 SP1 is 250 MB. PVMs are also controversial. PVMs are considered to be cheating by some since the programmer has the PVM doing a lot of the work for him or her. However, that also hurts the programmer since if something is not in the PVM they have to access native (or non PVM) code to do it, which can be very hard sometimes. Finally, though this is more true with .NET than Java, a PVM program will only run if the PVM is supported on the OS in question.

I personally am a PVM programmer. My “native” programming language is Visual Basic (.NET PVM), but I know Visual C# (.NET PVM), and am in the process of learning Java (Java PVM). I also plan to learn to code natively in the future. Though I admit that using PVMs has some problems, I believe that just because a program uses them doesn’t make them any worse than a program that’s written natively. However, in the end I suppose that’s your call.

[This article has been contributed to dotTech by Samuel with minor edits from Ashraf.]

Related Posts

  • @Ramesh Kumar: No problem, it’s my pleasure to help.

    1) No problem, could be either of our faults. And while .NET isn’t perfectly cross platform it is for the most part. The differences in the different .NET Frameworks are more based on device capabilities than anything else. And there are cases where the differences are very minimal. For example, WPF, which is MS’s new graphics system, is used both for Windows programs and in Silverlight, MS’s version of Flash, so that you can very easily take code from one to the other with very few if any problems.

    6) In general the biggest reason to remove something is that it’s less efficient or that it’s a throw back to pre .NET. And MS is pretty good about letting developers know about something getting removed. What they’ll do is add an Obsolete tag to items that will be removed soon, so developers have time to remove calls to them.

    5) The idea of .NET using less resource is a good one, since .NET can be more aggressive about freeing memory then a programmer might be, though I admit they don’t really live up to the always part. And yes I was talking about GC.
    You question about C++ over C I can’t really answer, mostly for lack of knowledge. As I said in the article, my language is really Visual Basic, though I admit I can read and understand for the most part C++.
    And yes Windows, and in fact most OSes are, is written in C/C++ being as they are very close (C more than C++) to assembler.

    And you hit the nail on why I did this article, I can’t stand baseless hate or hate based on misinformation (on reason I hate Apples Mac ads, a Mac is a PC).

    Thank you very much.

  • Ramesh Kumar

    Thanks a ton :D

    1)Hey I do know they are all different OS. Perhaps I phrased myself wrongly. Sorry. :( That said, sadly .NET has not become as “device independent” as what it intended in its original mission statement. In the original mission statement .NET was visioned as one which was cross device i.e. “device independent across all windows platforms”. Because of that “platform independence between Windows” & because of that “device independence between computing devices” the user would benefit because he would always be “data synced” between all his computing devices provided he used Windows. Among other things Windows aimed to use this to increase its mkt share in other devices too aka palmtop, mobile phones etc rather than only continuing to be a “big daddy” in desktops & laptops. :)

    Either the “techno” wrinkles were not adequately de-wrinkled in .NET or the consumer thought that “data-sync between computing devices” was not a deal maker consumer benefit or the developer felt it was unviable to offer “data sync” as a consumer benefit. It could even be all the three.
    2)ok thanks :)
    6)ok thanks. Why would a new version of .NET wish to remove some of the functions which were there in the older version? :? BTW this is one reason why neither Microsoft nor Java give a plainspeak “yes” or “no” to the question – “Can one remove the earlier runtime component or should one replace it?” Java at least is guilty of this. Perhaps Microsoft is not guilty of this. You can check the veracity of my question by reading the FAQ in
    5)ok thanks. This point about cleaning up – I think you are referring to “garbage cleaning technology”. Right? BTW the original vision statement about .NET had claimed lower resource usage always i.e .NET would “always” consume lesser resources than a “natively coded app”. Sadly this aspect of the vision statement also remained undelivered. :(

    Thanks understood the “native program” concept.

    Regarding C & C++. I know a good portion of Windows has been written using C & C++. I know (other things remaining equal) that .NET generally prefers OOPS (one example being C++) to non-OOPS (one example being C). BTW I know that .NET has more than 60 other generic languages to write source code in.

    My question is – When .NET “generally” prefers OOPS over non-OOPS why does it, when it comes to “specifics”, prefer C over C++? What is it about C++ which irritated them because of which C is seen to be a “better behaved boy” rather than C++?

    Chief while doing the “pros-cons” assessment the spirit was only that .NET like most things “might” have pros & cons & that it is useful to know them “beforehand”. There was also one other personal reason why I chose to do the assessment. :)

    I am grateful for your replies because they are as as intelligent as they are honest; as polite as they are corrective. Trust me, friend, that’s a rare find nowadays :)

    Ramesh :)

  • @Ramesh Kumar: You got the basics down. Just a few errors:
    1) Windows Mobile and Windows NT/2k/XP/Vista/7 are not the same OS. And in fact they use different .NET Frameworks, though they are similar.
    2) Yes .NET does a lot of the management work for the developer, but you took the idea a bit too far. But you got the basic idea which can be summed up in Java’s mission statement: Write Once, Run Every Where (or something like that).
    6) While yes having a newer version of the .NET framework can cause problems, that’s only with older programs that may use functions removed in newer versions.
    5) .NET doesn’t always consume less then native program, it can go either way. .NET just makes it so that the programmer doesn’t have to clean up after themselves as much. But a native program can use less memory since there is no .NET in the background.

    But for the most part you got it.

    A native program is one that does not use a PVM, usually written in C/C++

  • Ramesh Kumar

    Dear Samuel,
    1)A process virtual machine is created for a process aka a single app rather than having to create a virtual machine for an entire OS
    2)That said a process virtual machine is OS dependent but device independent. So if the same OS e.g. Windows .NET runs on a palmtop, desktop, laptop & also a mobile phone you need not worry. Your app will run on all 4 devices provided:-
    a)all 4 devices have the same OS
    b)that os is the one the vpm has been set to work within
    c)that particular os has the appropriate version of .NET which that app requires
    d)often times the latest appropriate .NET version which fits that OS would do but this is not guaranteed. Meaning on occasion just saying that you have the latest .NET version won’t help you. An earlier .NET version might. These are some kinks.
    e)essentially .NET is a runtime component i.e. part of an OS. The runtime component manages the computer resources aka cpu cycles, RAM & Virtual Memory. It is a “Managed Runtime”. Pre .NET runtime environments were “Non-Managed” runtime environments wherein the source code defined computer resources. .Net does not allow source code (i.e. developer’s apps code to manage the resources. .NET itself does that)
    f)among other things a vpm offers another advantage.In the “unmanaged environment” if a coder aka developer of the app had to write source code he perhaps had to learn generic high level languages, assembly language & even machine language.In fact he had to learn several of them because it varied from computing device to computing device for a given OS. The poor guy would just get exhausted. :) .NET however has automated both these things to quite an extent. The developer can write source code in any high level generic language. Developing an app can be done more quickly. Because .NET has only one assembly language (IL) & that is rather automated it compiles the source code into assembly language much faster – a great relief to the developer.The developer now does not have to learn too many languages generic or otherwise. He can focus on creation & do things fast
    g)furthermore the assembly intelligently does not precompile the entire app – but only those methods aka functionality of that particular app which are called the first time.This too is done just in time (jitting). The next time around when that method is called it has already been compiled
    h).net consumes lesser computer resources than non- .net run time components & apps as well
    i).NET files are huge which can be a real pain

    have I got it right? :)

    Unable to understand the bit about “native”

    Ramesh :)

  • @Ramesh Kumar: This is the article I was talking about.

  • Ramesh Kumar


    Firefox 3.5.7 got it in Tips & tricks.

    Am i right this is the article about .NET technologies you were referring to? I am quickly searching out others from you on .NET even while you answer