Process/Thread Priority Findings

BlitzMax Forums/BlitzMax Programming/Process/Thread Priority Findings

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Hi Grey, Delphi for me since Delphi 2 for Win32. Prior to that C++, turbo pascal...way way back. Now I am Director of R&D for development company so I get to play with different technologies, and make real money .Net and such for buisness apps.

BMAX is my side fun.

WaitEvent waits on system mutex for event to window. Not good idea for games. The Timer if I remember posts a high resolution event and wakes up the mutex so its should still be running. However no drawing happens since the DirectX context is disabled so all the drawing NOOPS so the loop just spins faster and spends more time in WaitMessage.

As for PeekEvent

Yes its still consuming 100% thats not a bad thing. People have this idea thats bad no its not. its bad when your program doesnt yield. By calling PeekMessage your are yielding to the OS. This is where the task switch will then then give any other process with same priority its slice of the CPU pie. You dont need the delay command for windows apps to try and yield. calling Peekmessage yields.

ie. If you have two programs using 100% like this they will each get 50% as they will usually swap at the PeekMessage. I say usually as the OS is preemtive so a high priority process like a network driver will still preemt the execution. For example the task manager. The UI gets klunky when you dont yield but the OS is still chugging away.

Since potential for yield is at PeekEvent which invokes PollSystem by minimizing the number of calls to BMAX commands that call Pollsystem ensures that your app is getting enough CPU.

I have been playing with DirectX forever and never had the problem on my machine you describe. Although I dont load a lot of crap on my machine, ie. widgets Thing is I do run stuff like database servers and such in background and they usually dont seem to interfere, unless a major query kicks in. But even then my frame rate drops but my program doesnt pause.

If you could demonstrate a stripped down program without your framework that demonstrates the problem, we might be able to track down the cause. It might be bad messagepump under the covers or bad handling of a message by BMAX. I have visually looked at them and they look ok.

Does problem exists with DirectX or the OpenGL driver?

FYI this widgets and virus scanners are notorius problems with systems from a support perspective as they can,
1. Cause unexpected slowdowns
2. Monitor your webactivty
3. Cause system instablity

Mabye your client needs to run spybot and see if he has anything nefarious on his machine.

Have you had more than one person report this? If I install this Yahoo thing will I duplicate problem. I have hyperthread PIV so I doubt it.

You might want to mess with priority although I dont think I have ever seen that as solution to timing problems games usually say in documentation shut that crap off. TDUMP some of your favorite games. Do they import SetPriorityClass


Doug Stastny