Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Parallel Processing and Multi-threading
Message
From
18/10/2014 00:34:50
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01609441
Message ID:
01609608
Views:
49
>>>>>>Curious,
>>>>>>
>>>>>>If have a multi-core machine, and run a part of my application using parallel processing technique.
>>>>>>The processes are spread across the various cores. This cool. Now if implement multi-threading in the
>>>>>>processes, will the multiple threads be ran in the same core that the parallel processing process this running,
>>>>>>or will the system delegate the threads to other cores?
>>>>>
>>>>>As I understand it, the whole point of multithreading - well, one of the points - is to allow different processors or cores to share the workload. I am not sure how you implement multithreading in Visual FoxPro, though, since it doesn't have any built-in multithreading capability. At least, none that is exposed to the programmer.
>>>>
>>>>You are right about VFP being single threaded. But with the help of the VFP community, there are examples of implimenting multi-threading (mtmyvfp by Calvin Hsia) and Parallel Processing (ParallelFox by Joel Leach (?)). I have been adding these features to my FUnit project. I am not sure if the threads are running in on the same core that the parallel processing is running, or spread out to other cores. This would alter the length the of time the test cases take to run.
>>>
>>>OK, sorry, I have no idea how these particular classes are implemented. However, if any operating system function is invoked to start either a thread or a complete different process (it is my understanding that a "process" is more "heavyweight"; and a "thread" is more like a sub-process within a main process), then I would expect the operating system to decide to use whatever processor happens to be available.
>>
>>I am beginning to see it that way too. But the experiment will continue. I will let you all others know what I find.
>
>You can change that by setting the process affinity, in windows SetThreadAffinityMask and SetProcessAffinityMask, not sure if it is implemented in ParallelFox as I never used it (well, I never used the affinity mask myself anyways :)).

Wow, OK. This sets a whole another level of control and complexity. I will need to save this for future investigation. But, it does answer my original question. Threads are spawned to the best available processor at the time they are initiated. But there is a way to control where they can be executed. I do agree that it is wiser to leave this to the system.

Knowing this, it is probably best to either use Threads or Parallel Processing, but not both at same time. If processes (Test Case) is going to be executed on multiple cores, and, say, additional Cases are then spawned via threads, then the speed of the (timing) will be effected. So, basically, for the purpose of the FUnit suite, I should just stick with Parallel Processing. But I will continue to experiment, just determine the outcome.

Thanks for the information.
Greg Reichert
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform