c#


Utilizing Dual/Quad core Technology


In C#, when I create a new thread and execute a process on that thread, is there a way to assign it to a particular core? Or does the operating system handle all that automatically? I wrote a multi threaded application and I just want to be sure its optimized for dual/quad core functionality.
Thanks
You can force your threads to run on specific cores, but in general you should let the OS take care of it. The operating system handles much of this automatically. If you have four threads running on a quad core system, the OS will schedule them on all four cores unless you take actions to prevent it from happening. The OS will also do things like try to keep an individual thread running on the same core rather than shifting them around for better performance, not schedule two running threads on the same hyperthreaded core if there are idle cores available, and so on.
Also, rather than creating new threads for work you should use the thread pool. The system will scale this to the number of processors available on the system.
Windows Internals is a good book for covering how the Windows scheduler works.
Based on your question you would probably be interested in the .NET 4 task parallel library (TPL) extension. Take a look at this article.
This post shows how to set processor affinity for a particular process thread. You can use this property to restrict a thread's affinity to a particular processor or set of processors.
Multiple threads will typically be running on multiple cores or CPUs. By default, it's the Windows sheduler which assigns the threads to CPUs.

Related Links

Create Multi line chart from datatable in WindowsForm C#
Switching between word documents interop
Checking whether a sequence of integers is increasing
C# CF - Convert a SOAP Message from a Stream
Breaking change in method overload resolution in C# 6 - explanation?
#Url.RouteUrl returns misleading/wrong path for a controller-action (unless the 'routeName' parameter is explicitly specified)
Entity Framework - Loading specific Navigational Property for members in collection
How to create a border for the text in the TextBlock?
Pass a UIElement class parameter to an assembly class?
Simple way to get MAC address from inputted IP?
Using bindings for dependency property XAML
Resize PictureBox with its related controls
Get value inside XElement
How to limit DocuSign request to either wet signing or signature drawing
Query VMWare by ManagedObjectReference?
AdmobAPI/Admob.cs(12,40): warning CS0067: The event `admob.Admob.nativeBannerEventHandler' is never used

Categories

HOME
system-calls
bigtable
conceptual
livecharts
artifactory
richtextbox
autocad
revit-api
sahi
select2
angular-universal
ndepend
logstash-configuration
repeater
responsive
exchange-transport-agents
ringcentral
aiml
url-parameters
datazen-server
vala
lotusscript
connectiq
fastboot
screen-scraping
android-xml
pixels
continuous-fourier
windows-mobile
utc
formtastic
scripting-language
federated
apm
boost-log
visual-prolog
sampling
ansible-inventory
queryover
scalamock
byobu
ngrok
cowboy
electron-packager
uitextview
datagridviewcombobox
paperclip
peerjs
risc
google-chrome-storage
serialversionuid
visio-2010
jscoverage
audio-fingerprinting
playframework-1.x
kendo-scheduler
google-scholar
turbolinks
jigsaw
csc
boost-bind
treelist
bbedit
trendline
jersey-test-framework
apache2-module
computability
app-data
wiql
android-togglebutton
tooltwist
callfire
data-representation
waterline
radgrid
quickfixn
javadb
formbuilder
powershell-v1.0
fscanf
rpt
enquire.js
image-preloader
elixir-framework
xtify
google-voice
ardor3d
extensibility
pyxplot
uikit-dynamics
gwt2
qt5.1
nsregularexpression
yii-components
tasklist
expresso-store
parsec
code-organization
pex-and-moles
xpolog
functional-specifications
table-valued-parameters
chromebug
iphone-maps
silverlight-2.0
webdb
newspeak
uccapi
pixel-bender
rpxnow
djangoappengine
html-help-workshop
office-2003

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App