Martina/everyone,
Do you know how to limit processor's memory in .NET code?
Thanks.
>Hi David,
>
>
>
>#DEFINE THREAD_BASE_PRIORITY_LOWRT 15
>#DEFINE THREAD_BASE_PRIORITY_MAX 2
>#DEFINE THREAD_BASE_PRIORITY_MIN -2
>#DEFINE THREAD_BASE_PRIORITY_IDLE -15
>
>
>#DEFINE THREAD_PRIORITY_LOWEST THREAD_BASE_PRIORITY_MIN
>#DEFINE THREAD_PRIORITY_BELOW_NORMAL (THREAD_PRIORITY_LOWEST+1)
>#DEFINE THREAD_PRIORITY_NORMAL 0
>#DEFINE THREAD_PRIORITY_HIGHEST THREAD_BASE_PRIORITY_MAX
>#DEFINE THREAD_PRIORITY_ABOVE_NORMAL (THREAD_PRIORITY_HIGHEST-1)
>
>#DEFINE THREAD_PRIORITY_TIME_CRITICAL THREAD_BASE_PRIORITY_LOWRT
>#DEFINE THREAD_PRIORITY_IDLE THREAD_BASE_PRIORITY_IDLE
>
>DECLARE INTEGER GetCurrentThread IN kernel32.dll
>DECLARE INTEGER GetThreadPriority IN kernel32.dll INTEGER
>DECLARE INTEGER SetThreadPriority IN kernel32.dll INTEGER, INTEGER
>
>lihThread=GetCurrentThread()
>lihThreadP=GetThreadPriority(lihThread)
>=SetThreadPriority(lihThread,THREAD_PRIORITY_IDLE)
>
>*.... hard code
>
>=SetThreadPriority(lihThread,lihThreadP)
>
>* and equal functions for process
>
>
>MartinJ
>
>>
copy of something I posted in the Wiki topic http://fox.wikis.com/wc.dll?Wiki~VFPVersion10WishList this morning to spark further discussion here...>>
>>
SET CPUHog ON | OFF | nPercentCPUUseAllowed ok so a better name is in order, but I think this one states the problem better...
>>
>>VFP needs to have a SET or sys() call that can be made to allow VFP to cooperate with other running tasks on a machine. There are two classic examples of where VFP's performance-at-all-costs mentality makes VFP fall flat. Long running SQL-SELECT executions and while waiting for long running synchronous SQLExec() results. When these operations happen on a fat-client VFP app or from inside a COM object used on a web server little other work can be accomplished on the box. TaskMan shows the VFP program as non-responding, which has probably caused more than a few needless End Task kills of the app. VFP needs a mode to give up CPU cycles and respond to Windows messages while these long running commands are executing. Losing a couple of percent execution speed on a SQL statement is an acceptable tradeoff if it means that a whole website will not go non-responsive or that a user can switch over to Word and be more productive while a VFP task is cranking away in the background. Currently we
>>have a work around for this fault by using a second machine which takes report query requests from a queue and processes them in an offline manner.
If it's not broken, fix it until it is.
My Blog