Solved

Multi threading with a QUAD CORE CPU

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now