Forum > Windows

[SOLVED] How to prevent my.exe eat the resources too much?

(1/2) > >>

d2010:
When I start the Cecolord.exe, (always time) , this applications block entire Win7, for
11-12 minutes.
I need the "chiajnax.exe" detect the Cecolord.exe, he calculate the consuming time
of CPU/ hard-disk , and at next start, the "chiajnax.exe", will sets

* set Afiinity of CPU at last core(I have the solution.pas in source inside Lazarus)
* usage of RAM too much , Cecolord.exe have a maximum memory usage always running
* set DiskUsage limit (optional solution)
* set Internet usage time to much, and Cecolord.exe set internet,usage to minimum if the Cecolord.exe block entire CPU.
* Chiajnax.exe can run the Cecolord.exe as User not Admin
* The main question = this one 1/5
How to Chiajnax.exe can detect the Cecolord or others Acad.exe, BrisCad.exe , far.exe?
 >:(
Eg. fix-Ram-usage= winamp.exe, scandisk.exe, chkdsk.exe, mineswpeer.exe,  mspaint.exe, msconfig.exe
Eg. dynamic-Ram-usage= MsWord,  Acad.exe , SolidWork, Vlc.exe,
Secondary question= how to create of list with apps (with maximum-fix-RAm usage and application with "dynamic-Ram-usage"
 :(
Cecolord.exe create a list with apps_fix-Ram-Usage ;
    dynamic-Ram-usage= All_Apps.exe(minusp)apps_fix-Ram-Usage
 :'(

440bx:
Before anything, I have to mention that I'm not sure I understood what you are asking for.  What follows are answers based on my guesses of what you are asking for.


--- Quote from: d2010 on January 30, 2024, 09:07:59 am ---How to Chiajnax.exe can detect the Cecolord or others Acad.exe, BrisCad.exe , far.exe?
 >:(

--- End quote ---
I'm guessing you want a way for that program to determine if Acad.exe, BrisCad.exe and other executables are currently running.  If  that is correct, there are a number of ways of listing the processes, the most common one is using the Toolhelp interface.    I'll give more details if you confirm that this guess is correct.

As far as the RAM a process is consuming, the answer is quite similar, there are a number of APIs that will return that information.  Some of the APIs will return the current working set, the maximum working set and other info.

By the way, those are the APIs used by Process Explorer to display the information it shows.  If you want to see actual code doing it, there is Process Hacker (written in C) that is pretty much a Process Explorer clone.  A great number of questions about how to obtain system information can be answered by studying that code.

As a side note and just FYI, a lot of system information can be obtained using documented APIs but, there is some information that can only be obtained using undocumented APIs mostly residing in ntdll.  The more ambitious you get, the more likely you'll have to deal with undocumented APIs.

HTH.

Thaddy:
I think he is referring to AutoCad tools, which I should know, but can't see the question. Be more specific.

d2010:

--- Quote from: 440bx on January 30, 2024, 10:31:47 am ---
As far as the RAM a process is consuming, the answer is quite similar, there are a number of APIs that will return that information.  Some of the APIs will return the current working set, the maximum working set and other info.

By the way, those are the APIs used by Process Explorer to display the information it shows.  If you want to see actual code doing it, there is Process Hacker (written in C) that is pretty much a Process Explorer clone.  A great number of questions about how to obtain system information can be answered by studying that code.

--- End quote ---
HTH.

The solution1inside mind= "chiajnax.exe" calculate sumtime=time_consuming_CPU+calculate_time_Harddisk+calculate_total_RAM?
(Foreach APP from "applist'  if sumtime>0.30*time_clock then chiajanx.exe slowdown the app)
About Acad.exe are too powerfull , "chiajnax.exe" cannot "calibrate-internal-speed of Acad.exe".
 :(
The solution2inside cmd.exe=" chiainax,exe running cecolord.exe with low-resource+minimCoreOf_Cpu+minimHard_disk
   winexec("cecolord.exe" ,5, MINIM_RES_FLAG+NOWAIT)
?? Because are too many  undocumented APIs., I need only,  the answer "solution2inside cmd.exe"?
Thank you



440bx:
Again, I have to state upfront that it is unlikely that I understood what you meant correctly but, I'm going to guess that you want  some way to limit the amount of CPU that will be given to one or more processes.

If that guess is correct then a possibility that comes to mind is to lower the application's priority.   A "low priority" or "idle priority" app will usually consume less CPU than an app running at a higher priority.

MS explains how to manage priorities in the page https://learn.microsoft.com/en-us/windows/win32/procthread/scheduling-priorities

You could easily write a command line program to manage process priorities.  That said, both, Process Explorer and Process Hacker allow you to manage process priorities therefore you might not need to write your own program to duplicate that functionality.

As far as controlling the amount of RAM a process uses, for the most part, there is no way to control that.  Normally, Windows will do whatever it can to satisfy a program's memory requirements.  The most you can do is "supervise" how much it uses at a particular time.

HTH.

Navigation

[0] Message Index

[#] Next page

Go to full version