Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Optimising code

Status
Not open for further replies.

StevenK

Programmer
Jan 5, 2001
1,294
GB
I've been asked to ensure that my code is optimised for
1. Running on a Windows 2000 platform.
2. Ensuring the system uses all processors in a multi-processor environment.

How should I approach this ?
The system was designed and developed on a Windows NT machine (with only one processor) - how can I assure that the code is designed to fit the requirements as above ?

Any help would be appreciated.

Thanks in advance
Steve
 
Windows 2000 is modelled on Windows NT so I would imagine that your code is already optimised for Win2K. As for multi processors, I should think that either the computer itself or Windows handles that side of resource management and any changes in your code will make no difference to this handling. If anybody knows any different then I too would like to hear it but thats the info I have gathered so far on this kind of thing. Arte Et Labore
 
I've heard (I'm not completely sure) that to take advantage of multi-processor machines, one must write his/her program utilizing threads for processor intensive operations. The thread scheduler will assign a processor for running that thread. If you do not use threads in other words, multi processor machines are just a waste of money.
 
I believe the same as Ulfeng, if the app isn't written as a multithreaded app then it'll mainly use 1 processor.

lou
 
If you want to make use of the extra processor(s) you must write your app as multi-thread. Find compute-intensive tasks and split them off into a separate thread. Note that this can be a lot of work to debug, don't do it unless it's needed for performance. You need to be *VERY* careful about access to any shared data and in general the debugger will not help you. Secondary threads are also not allowed access to the VCL--your debugging is basically limited to writing to a log file and that can easily mask the bug itself. Note also that you can't truly test such code unless you have a multi-processor machine yourself--some thread bugs will never show in a single-processor environment.
 
Thanks for the pointers so far.

My application is not multi-threaded (due to the nature of the beast) as one stage relies on the completion of the previous, the data processing is progressive.
Does this mean that I am unable to utilise a multi-processor environment ?
Could I allow the SQL Server to make use of this environment to better utilise the resources available ?

Any further help would be appreciated.

Thanks again (and in advance)

Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top