Solved

Multi threading with a QUAD CORE CPU

Posted on 2008-06-25
2
1,282 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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

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…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

726 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