Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Multi threading with a QUAD CORE CPU

Posted on 2008-06-25
2
Medium Priority
?
1,285 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 2000 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

597 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