Page 1 of 1

qbasic taking up 100% of cpu!

Posted: Tue Apr 05, 2005 12:41 am
by cdcuase
Hey folks! Hope you can help me with a minor, but irritating problem I'm having with quickbasic 4.5 running in Windows XP (sp2)

As soon as qbasic is running in its dos window I notice it's taking up 100% of the cpu resources. Looking in Windows Task Manager I see that it is the process ntvdm.exe that's hogging up all the %. If I close qbasic, cpu usage goes back to normal (0%)

Anyone know how I can solve this? From the looks of things around this board, there are quite a number of you out there using qbasic under Winxp with no problems at all, and frankly I'm envious!

:)

Posted: Tue Apr 05, 2005 5:31 am
by MystikShadows
I would say the first question I need to ask you is.

1. Do you have all service packs?
2. What does your system have (CPU Speed, RAM, HD capacity, Video Card etc etc...)

I got XP and running QB fine....I never checked if it took all the CPU though lol. but I don't think so because I usually have it opened with an average of 7 other applications lol....so let's start with your system configuration and take it from there.

Posted: Tue Apr 05, 2005 9:34 am
by ShadowWolf
cdcuase is right any dos app will kill the cpu resource's most likely since dos is running though a piss poor VM. you could always try a another Dos emulator.

or simple give up QB and start using FB (www.freebasic.net)

Posted: Tue Apr 05, 2005 10:12 am
by Pete
That's exactly it. WinXP doesn't natively support DOS, so when you run DOS apps through the "Command Prompt," you're actually emulating the DOS environment. Emulation is processor intensive, plus the XP DOS VM is absolute garbage.

I have noticed that a lot of Freebasic apps take up 100% of the CPU too, though...

Posted: Tue Apr 05, 2005 11:43 am
by Z!re
Pete, yah

Poorly coded FB crap takes 100%


Namely, ones that rely on SLEEP for delay... or ones that use SDL and SDL_Flip inproperly.

Both sleep and sdl_flip have a bug that makes them suck up 100% CPU if called too often..


though, only on low end computers, so the people with 3ghz computers wont notice.


C Bug:
"It works for me, stfu!"
"It runs smoothly on my 15GHz computer with 128gb ram, n00b!"

Posted: Thu Apr 07, 2005 5:14 pm
by cdcuase
That is exactly right.. I did a bit more searching (ala google) and discovered that my Dos/XP problem was shared by a lot more people. Has something to do with the way Dos was designed a hundred years ago...

Found a site that helped fix the 100% cpu usage. Tamedos.com offeres a neat little program that basically "tames" dos. I installed it and now my cpu gets a much needed break whenever a dos app is loaded up. The program is shareware, however, so in 30 days I may have to look for another means of solving this little prob.

Posted: Thu Apr 07, 2005 5:31 pm
by Z!re
Just change the priority of the XP DOS VM.

Lower priority = higher usage (as it comes to the VM, dont ask me, ask MS)

Posted: Fri Apr 08, 2005 2:01 pm
by Mitth'raw'nuruodo
How do you do that Z!re?

Posted: Fri Apr 08, 2005 4:13 pm
by Halifax
i also have a problem with this. i like to program with music going on in the background, but media player is always so slow and it sometimes skips. it also screws with qbasic. and dont even mention the internet...

Posted: Sat Apr 09, 2005 3:32 am
by Z!re
Halifax, slow computer?
In any case, try changing to Winamp, you can set the priority of winamp so it wont hog the system, like WMP does. WMP is the biggest resource hog ever.


Mitth, not sure, I don't use WinXP. Probably as easy as righclicking on the exe or something (the DOS VM exe that is)

Posted: Sat Apr 09, 2005 6:11 am
by Mitth'raw'nuruodo
Well, I have no clue. :cry:

Halifax:
QB4.5 is using 100% reasources on my XP 3.0GHz. But for some reason I can still use WMP. It works fine....don't know how that's possible with 100% reasources.

Posted: Sat Apr 09, 2005 6:38 am
by Z!re
It's a bug in the DOS VM, it doesent actually use 100%

It works like this, the sleep funtion it uses to emulate DOS (not qb sleep mind you) works by taking all free CPU and using it to loop, checking for when not to loop anymore.

It sucks, and is crappy coding.

Posted: Sat Apr 09, 2005 10:11 am
by Rattrapmax6
:?: Why is FB's SLEEP like that? You know, the bug and all, makes little since......

Heh, I do know with QB1.1 or something that music wont play while running it.. but 4.5 and 7.1 seem to do it fine, course I was on my spare comp with a diff sound using those 2... I tried QB1.1 along time b4 I fried my audio on this one.

Wheter diff sound systems made a diff, dunno... can't check, that cpu is unusable since I had to swap monitors from it... :(

Posted: Sat Apr 09, 2005 10:49 am
by Halifax
well i have a 900mhz computer with like 712 ram. i also have qb4.5. so im gonna download winamp (free?) and see how its different. thanks for the advice. too bad i cant run kazaa or whatever in the background.

Posted: Sat Apr 09, 2005 2:22 pm
by Z!re
I dont know exactly how FB's sleep is coded.
It has the same kind of bug as SDL_Flip
SDL_Flip's bug comes from the flip not happening on extremely high end machines, running at high herz rates for the monitor/gfx card. So they "improved" the formula, so it wouldnt skip frames (single herzes, sort of) making it a bit faster on those high end 100hz+ machines, but slow as hell on normal machines with 60hz.

It's a documented "bug" and it seems the SDL teams arent going to improve it, not too big of a problem though, easy to code around.

FB's sleep could do something simmillar, use a CPU intensive loop to check for the sleep-end value, but i dont know.

Best advice, DONT ever use SLEEP for delays, bad:

Code: Select all

do
sleep 5
loop
Instead use timer, or simillar.

Ofcourse, using a single sleep to wait for a keypress is ok.


Yes, winamp is free.

Posted: Sat Apr 09, 2005 6:08 pm
by Mitth'raw'nuruodo
Do you mean processor speed?
Cause a 60Mhz processor is not 'normal' anymore.

Is a Radeon X300 a good gfx card? lol :lol:

Posted: Sat Apr 09, 2005 6:26 pm
by Z!re
It even says Hz, not MHz,

And I was refering to screen Herz rates.

Posted: Sat Apr 09, 2005 7:11 pm
by Rattrapmax6
:( What a delay if it want work?

You mean a timer delay, like this?:

Code: Select all

T! = TIMER: DO: LOOP UNTIL (TIMER - T!) = 0.1
:?: :roll: Oh well,....

Posted: Sat Apr 09, 2005 7:44 pm
by Mitth'raw'nuruodo
Z!re: sorry I missed that.

Rattra:
Its a good ideas to put a >= instead of a = just incase if FB skips .1 randomly for some odd reason.

What about this?
Do :loop while inkey$ = ""

Posted: Sun Apr 10, 2005 9:11 am
by Rattrapmax6
:lol: forgot the ">=",.. and yeah, FB skip it to.. I think,.. I'll go test it ^_^ FB is easier to crash, the IDE stays up... :wink: