Click to See Complete Forum and Search --> : ntvdm hogging CPU


cup
September 2nd, 2002, 02:53 AM
Whenever a 16-bit program is started, the process called ntvdm (I think it means NT Virtual DOS Machine) gets started along with it. This seems to take 92-99% of the CPU and everything runs really slowly. It is a 16-bit DOS program running on a 2GHz 1Gb machine. Why would it hog the CPU? Any suggestions on

1) How I can get it not to hog the CPU?
2) Is lowering the priority safe? Windows XP says it isn't but I haven't seen any side effects yet.

Thanks for your advice.

Kdr Kane
September 2nd, 2002, 08:23 AM
1) Rewrite the program.
2) Lowering the priority is absolutely safe. CPU usage will still be at the same level.

Older DOS, C, assembly language and 16-bit programs are not object oriented. This is why they run the CPU at 100%.

Here is a program that will attempt to use 100% of the CPU if it can:#include <conio.h>
#include <cstdlib>

int main()
{
int anykey;

while(!kbhit()) rand();

anykey = rand();

return 0;
}If while(!kbhit()) is changed with cin >> ch, this type of utilization goes away.

Please excuse the useless program.

cup
September 2nd, 2002, 10:17 AM
Thanks for that. Unfortunately, I cannot rewrite the program as I do not have the source. I suppose I'll have to live with it whenever my wife/kids play that game.