Task priority

Task priority

Postby grumpy » Tue Dec 27, 2005 12:55 pm

Is there a way of setting a tasks priority. I have a program that processes a lot of data from text files created by another device. The user now wishes some stats from this program, I wish to create them on the fly. The problem is each text file takes approx 30 - 40 minutes to process and creates thousands of records in my databases. When I put in the stats accumulation I slowed the program by 50%, so I thought I will just write the stats to a single dbf file containing stat type, equip id, date, value and in the program that processes the data I would start (WINEXEC) another program to actually process the stats into the Weekly, Monthly and Yearly stats dbfs which have approx 22 different stat fields.

The problem is there is little difference in processing time by the main program as the program I started from it hogs the CPU each time it checks the DBF for new records, I have a timer set at 10000 to do the check DBF written by the main program and append any data if necessary and delete each record created by the main program to avoid processing the record more than once, I also do a sysrefresh every 10 records to try and share the CPU.

If I could winexec the stats program and have it perform at a lower priority then maybe the main program will function better. Or do I need something to run each in their own memory space (XP) which may also overcome the problem.

Any assistance would be appreciated.

Gerry
grumpy
 
Posts: 48
Joined: Tue Dec 27, 2005 12:40 pm
Location: Australia

Postby Antonio Linares » Tue Dec 27, 2005 2:22 pm

Gerry,

Have you tried to increase the 10000 value of the timer ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42127
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Task priority

Postby grumpy » Wed Dec 28, 2005 4:49 am

Increaing the timer only delayed when the program hogged the system. I have now set a flag whilst processing incoming text files and do not update the stats until this flag is no longer set.

Another problem Winexec("program",9) states it will start a program or use the one currently running. When I use this it always starts a new version?

Cheers
Happy New Year
Gerry
grumpy
 
Posts: 48
Joined: Tue Dec 27, 2005 12:40 pm
Location: Australia

Postby Antonio Linares » Wed Dec 28, 2005 8:00 am

Gerry,

IMO the way to solve your problem is to post messages to yourself, and perform just a small work when you receive the message. This is quite different from using a timer.

... do a little work
... PostMessage( oWnd:hWnd, WM_USER_DEFINED )

then you subclass TWindow and define Method HandleEvent(), that will check for WM_USER_DEFINED (see include\fwmsgs.h) and will perform again a little work and then, again, will post a msg to itself.

This way you don't overload the system.

Regarding WinExec( ..., 9 ) you may press ctrl+alt+del to check in the task manager if the called app is running only once. It should be just there once.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42127
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for CA-Clipper

Who is online

Users browsing this forum: No registered users and 3 guests