Multi core CPU

This forum is for eXpress++ general support.
Message
Author
User avatar
Tom
Posts: 1176
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: Multi core CPU

#21 Post by Tom »

As Markus said: You can't know what happens within the next few minutes.

1. Select the CPU randomly! This is really the best way to do it, especially if you have 4 or more cores. If you count app instances running for your decision, this information may be usesless one millisecond later.
2. Save the selected CPU # somewhere. Erase the information if the app ends. Don't forget to add this to your ErrorSys. Remember that fatal errors will not change/remove this information. Delete the file periodically, i.e. once a day or once a week.
3. Add a functionality for user-selected CPU-change inside your app. Show information from # 2 here.
4. If you want, watch CPU usage (using information from # 2) inside a special thread. You can change the selected CPU anytime you want. But: You still don't know what's happening on this CPU. One user may work intensively, while three others have phone calls, so their CPU usage is almost zero.
5. There are API-functions available to really find out what's happening on each CPU, but they are not very reliable (XP or earlier). This information may also be useless within the next seconds. If one app quits and two new users enter, everything changes. If one user works with iTunes or PhotoShop, everything is different. Those apps (and others) use several CPUs at a time.
6. Ask your customers to add tons of memory. This is the most important factor!
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

User avatar
Auge_Ohr
Posts: 1407
Joined: Wed Feb 24, 2010 3:44 pm

Re: Multi core CPU

#22 Post by Auge_Ohr »

STLau wrote:After implementing the DC_setcpu() as provided by Roger, the assignment of CPU core works, however, the assignment is based on the last CPU# saved in the file created. Therefore, it can end up with a situation where the same core is running for a few application when all application in other core quit.
you can "manuell" assign on which CPU your Application shoud run. use a Parameter for it

DEFAULT nCPU := 15
// 7 = 3 CPUs
// 3 = 2 CPUs
// 1 = 1 CPU
STLau wrote:I would like to know is there a way to detect the next available CPU and assign to that CPU instead of sequentially allocate to the next CPU.
Alaska have made "CPU load balancing helper" Asmp10.lib but as Tom say

Code: Select all

_MPGetLeastUsed() -> nProcessor  
 _MPGetWorkload() -> aProcessorLoad
does not work (on my System ...)
as i can say they try PDH (Performance Data Manager) API http://support.microsoft.com/kb/284996 so it might work on NT 4.0 ;)

since XP we have WMI (Windows Management Instrumentation). you can ask allmost everything about your Hardware, also CPU %
some Vendor, like HP / Compaq, include VbScript for Administrator Management, search for it
As Markus said: You can't know what happens within the next few minutes
right, but you can create a History for "last Minutes" to find out which CPU does sleep.

... but all "multi" CPU Problem shoud not be a Application "Problem".
Xbase++ Application shoud run on ALL CPU and OS() will give Time to each CPU
greetings by OHR
Jimmy

Post Reply