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

linq SQL statements for joining two id with single list
C# Create a .NET object for JSON serialization and deserialization [duplicate]
How to disable automatic margins in LightningChart
NuGet Package version not matching reference version
No display bar codes on UserConrol
Deploy windows form c# with local database (anyone can access see my database files)
A* with jump point search slower than regular A* in XNA?
Entity framework error when attempting to update property on related entity
Able to update dataset but unable to commit changes to Database
What would be a good pattern for designing generic json models to have identity properties added at run-time based on the configured document store?
RelayCommand and delegates, trying to understand delegates
File type required to add a reference to a C# project in Visual Studio (2015)
[HttpException (0x80004005): Could not load type 'Scheduler.Models.PatientModel.Patient'.]
MongoDb c# driver and OData Web API: filtering a nested collection
Pass parameters to AccountController´s constructor using Individual Account
Cannot add view in .Net Core RC2

Categories

HOME
gcc
javafx
ns2
gsm
cors
apache-storm
python-requests
android-ndk
squeak
opc-ua
sms
mingw
grid
servicenow
rtc
google-my-business-api
fetch
guidewire
desktop-application
popup
gomobile
rvm
android-6.0-marshmallow
formtastic
bytebuffer
pushpad
mobile-development
lines
wordpress-rest-api
visual-studio-debugging
loopback
oracle-nosql
angularjs-resource
cocoa-scripting
device-driver
rtsp
libconfig
aspose.pdf
glide-image-library
mtm
smooth-streaming
ocamlbuild
jks
dmalloc
qt3d
glade
distcc
jigsaw
csc
vitamio
supervised-learning
cexception
custom-build-step
containstable
libgcrypt
personality-insights
web-standards
data-representation
avd
httpmodule
crtdbg.h
fedena
clearcanvas
fscanf
triplestore
step
episerver-7
dateadd
nodeunit
fastcgi-mono-server
mongoid4
.net-reflector
xtify
xcode6.1-gm-seed
grunt-wiredep
xrandr
friendly-url
coinbase-php
m3u
states
jquery-ui-map
flatten
helicontech
ruby-1.9
rjs
http-response-codes
datarelation
pitch-shifting
code-golf
time-management
opengl-to-opengles
managed-code
j++

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