|
-
March 30th, 2001, 06:23 AM
#1
Freeing system resources
I have written a program on WinNT (PIII processor, 256mb RAM),which searches an Access db every 2 seconds +/- , looking for requests posted by another program. I also have 2 log files and COM1 port open for possible comms to an external system. The program (not running as a service) works perfectly BUT it virtually uses all the system resources (ie. it takes forever to load up MS EXcel or Windows Explorer etc.). How can this be overcome?. Any assistance will be greatly appreciated.
-
March 30th, 2001, 07:08 AM
#2
Re: Freeing system resources
My guess is that your code that checks whether 2 seconds have passed is in a tight loop and is not giving up control?
Try putting a DoEvents() in the loop - or better still, firing the loop for a VB timer control.
HTH,
Duncan
-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com
-
March 30th, 2001, 08:13 AM
#3
Re: Freeing system resources
I am assuming since the search occurs every two seconds that it only takes 1 second to search the entire database at the most ALMOST 2 but never 2 seconds. Consider this however, every 1 second your computers resources are being consumed by searching through the access database. Then the computer gets a short maybe 1 second break to continue the rest of its work.. then it starts searching a database again. Several suggestions would be.. as stated previously,use do events in your loops. But, stay away from loops as much as possible. Loops are inherintly slow in VB, try using an SQL statement to do your search, if you arent already. Possibly it would be worth considering writing the program in C++ and making it a multi-thread.. and if it is important enough use a second processor dedicated to this operation.
Anyways.. I really dont see any way to speed up an application that manually crunches through a database every other second.
Out of curiosity... why would you run a program that so intensively accesses a database on a nearly perpetual timeframe, on the same PC that would be used by employees for other operatioins?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|