Solved

Multi threading with a QUAD CORE CPU

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

773 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