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

Migrate AIX 5.3 crypt function to C#
What is the point of groupBox in WFA in C#?
c# Equivalent of Err in vb
Managed VCL.Arrow keys and Tab key
JavaScript - Escape single quote in the JavaScript Object property value
C# Are the variables inside the static methods initialized in the beginning or when the method is called first?
EventLogs using Silverlight
Moq - Setup return values of strongly typed class
Which MySQL version is my application using if I have both wamp as well as standalone MySQL installed separately?
strange behavior of Property functions
How to run the application from the other system
How to apply updates using Domain Service Class?
Compiling and accessing class at runtime [closed]
Memory leak with object initialized in a static method and using NSNotificationCenter
AutoMapper - Map using the same source and destination object types
C#: WMP, time stamp in milliseconds / tenth of a second

Categories

HOME
skype-for-business
optimization
redux
macros
customization
weblogic
ebay
yuv
procmon
kohana
pyodbc
minimax
activejdbc
openbsd
captcha
hql
web-worker
views
novacode-docx
webgl-earth
minimagick
polybase
serenity-js
oracle-golden-gate
scalatest
angular2-changedetection
pypy
keil
imdb
kubectl
webspeech-api
mootools
scip
var
ngrok
icu
file-descriptor
compiler-warnings
xmldom
openxava
visualizer
activesupport
r-commander
disassembly
robotc
apache-commons-cli
easy-thumbnails
firebase-polymer
eclipse-mars
avi
pebble-js
dcast
sqldataadapter
cascading
newlib
database-project
autoscaling
minko
ultraedit
genero
mri
sync
parsefloat
serializer
smartxls
azure-caching
xps
panelgrid
asp.net-4.0
shapado
winrt-async
datasheet
rjs
functional-specifications
fxcopcmd
onresize

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