Solved

Multi threading with a QUAD CORE CPU

Posted on 2008-06-25
2
1,283 Views
Last Modified: 2013-11-07
Hi,

I am using simple threading to spawn Html parsing algorithiums from a class file, my question is, will a new thread automatically be assigned to an unused core in a quad core system? if I spawn 4 threads within say 500ms, and each has an execution time of 1000ms, will the oporating system manage the cpu assignment in the best way, or is there something else I should be doing?

Below is my threading code simplified:


Imports System.Threading
Module HtmlParcer
 
    Sub ParseSite1(ByVal sHtml As String)
        Dim oThread As New ParseThreadClass
        oThread.sHtml = sHtml
        Dim t As New Thread(AddressOf oThread.ParseThread1)
        t.Start()
 
    End Sub
 
    Public Class ParseThreadClass
        Public sHtml As String
        Public Sub ParseThread1()
 
'### DO SOMETHING
        End Sub
    End Class
End Module

Open in new window

0
Comment
Question by:bhermer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 14

Accepted Solution

by:
cuziyq earned 500 total points
ID: 21869902
The operating system's process scheduler will take care of this for you.  There is no way you can control it, and no way to know what it will do at any given time.  You just have to trust that the scheduler will do it in the most efficient manner possible.

Note, also, that if a thread is executing on a particular core, and that core becomes saturated, the thread can also be moved to another core as well -- something else you have no control over.  So even if a process begins execution on core 1, there is no guarantee that it will stay on core 1 unless you've manually set it's affinity, in which case you've just neutered the system's ability to balance execution for that thread.
0
 
LVL 4

Author Closing Comment

by:bhermer
ID: 31470768
Fantastic, the answer I needed, me not worrying and letting a smarter system than mine do the work is the way I like it, thanks
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

687 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question