Assigning a CPU 'Affinity' by command line options when opening MT4s in Windows?

 
MT4 is not MultiThreading and I have MultiCore CPUs
I am trying to find out how to auto-open MT4s in Windows with command line options via Windows Scheduling to assign different instances of MT4 at StartUp to different CPU cores to balance the load and optimize computer operation.
 
FourX:
MT4 is not MultiThreading and I have MultiCore CPUs
I am trying to find out how to auto-open MT4s in Windows with command line options via Windows Scheduling to assign different instances of MT4 at StartUp to different CPU cores to balance the load and optimize computer operation.
I'd be very surprised if you managed to get any consistent benefit from this. It might possibly work for backtesting. However, in normal operation MT4 is multi-threaded, and Windows should do a perfectly good job of sharing the threads out across processors. Even with regards to backtesting I've never personally seen a scenario where Windows allocates multiple copies of MT4 to a single core and leaves other cores sitting idle.

I'd definitely start with a manual check that this actually makes a difference, by setting the affinity using Task Manager, before trying to automate it. If you're looking at this with regard to backtesting, then I'd also check that the backtesting process is definitely processor-bound rather than e.g. IO-bound, and try running it from a RAM disk.
 
jjc:
[...] I've never personally seen a scenario where Windows allocates multiple copies of MT4 to a single core and leaves other cores sitting idle. [..]
I second that. Using multiple Terminals for load-balancing is only relevant if u use the Tester. The actual core allocation is done automatically by windows...
 

Hi,

Thanks for the responses.

I'm not doing any back testing at this point in time, only forward.

Perhaps I'm misinformed about MT4's lack of MultiThreading. I came across it here at some point in time which doesn't mean it was correct; or I may have applied it in the wrong context and forgot that this was strictly a Back Testing issue.

I am using the Task Manger to assign these. Currently in an XP environment and have been assigning the affinity to the numerous simultaneous instances of MT4. I noticed that in the CPU column of the Processes tab of the Task manger that these do change dynamically. However what I find confusing about this is that on this dual core machine that while most of the time it says 0, 1 or 2, it it will occasionally have numbers higher than this. Looking at it now while doing this posting I see that the 'System Idle Process' is staying in the nineties so perhaps this column is showing the CPU load that the process is putting on the CPUs and not core assignment.

So it would seem that the best solution to this problem is that it is no problem at all and is already being taken care better automatically than confining processes to a specific CPU core manually.

'Live and Learn' It never ends. until it does! LoL (< 8)

Thanks again folks

 

FourX:

So it would seem that the best solution to this problem is that it is no problem at all and is already being taken care better automatically than confining processes to a specific CPU core manually.

exactly.
 
FourX:

Looking at it now while doing this posting I see that the 'System Idle Process' is staying in the nineties so perhaps this column is showing the CPU load that the process is putting on the CPUs and not core assignment.

As I think you're now aware, a percentage of e.g. 95% for the System Idle Process means that the computer is only consuming 5% of processor time. The CPU column in Task Manager always adds up to 100. If there is no processor work taking place, the total of the CPU column is not zero.

FourX:

Perhaps I'm misinformed about MT4's lack of MultiThreading. I came across it here at some point in time which doesn't mean it was correct; or I may have applied it in the wrong context and forgot that this was strictly a Back Testing issue.

It is strictly a backtesting issue. The main complaint is that MT4 does optimizations serially, rather than running the different settings in parallel.

In forward operation MT4 is multi-threaded. Each copy of MT4 has a number of persistent threads (e.g. one for the GUI, one for the price feed), plus the fact that each separate tick processed by an EA is handled by a new thread.

Reason: