Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Bind process to a CPU core
Message
From
06/05/2022 20:50:12
 
 
To
06/05/2022 11:37:26
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
01684340
Message ID:
01684342
Views:
81
Likes (1)
>Is there a way you can bind an executable to a particular CPU core?
https://en.wikipedia.org/wiki/Processor_affinity

Assuming you're talking about Windows, NT and successors support this:
https://winbuzzer.com/2020/07/03/how-to-set-cpu-affinity-in-windows-10-with-task-manager-or-system-properties-xcxwbt/

That said, I doubt anyone would see much benefit doing this for a VFP app on a modern Windows system. Bear in mind doing this reduces the flexibility of the Windows scheduler - it can no longer fully optimize resource usage amongst all competing processes. If setting affinity for one process improves its performance by X%, the performance of all other processes will probably be reduced by (some multiple of) X%.

These days CPU is rarely a performance bottleneck. If you need more overall performance you'll probably see greater gains by improving disk, RAM or network.

I've read that some enterprise loads such as SQL Server and Exchange can benefit from it, especially on multi-processor/NUMA hardware e.g. https://infohub.delltechnologies.com/l/performance-best-practices-3/sql-server-2019-cpu-affinity . Getting those techniques to actually work as expected is enterprise-grade stuff.

If someone is asking you to set CPU affinity for a regular business-type application I'd suggest:

- Ask them for expected benefits and expected degradation of other processes
- Ask them for detailed technical background to show they understand why the process will benefit. Basically, explain how setting affinity for that process will be better than the default scheduler behaviour
- Make sure YOU understand the reasons they give and can accept the drawbacks

Be aware that setting affinity won't work well, or at all, in a virtualized environment unless the hypervisor will accept hints from guest OSs (and abide by them). That sort of paravirtualization support is not a given. If not in place the hypervisor will manage its vCPUs however it sees fit, regardless of what guest OSs think they're doing.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform