|
-
Nov 16th, 2003, 06:46 PM
#1
Thread Starter
Hyperactive Member
Multiple Processors
Guys,
Since I have moved to C# I am quickly writing bigger and better apps than I ever could using VB. One of things I am experimenting with now is having multiple threads and processes.
I know Exchange and SQL are all multi-proc aware. If your server is running slow, you can through another processor at it and it will take advantage of it without doing anything.
My question is, and I apologize if this is in the wrong forum, I didn't feel the general computing was the right place, how do you write the code to take advantage of a system with multiple. When you spawn a new process, does Windows handle where the process gets run? Is there a way to direct it to a certain process.
The main reason I ask, I am writing an app to run on one of our servers that has 4 processors. I dont want to peg one of them out.
Thanks,
Jerel
-
Nov 16th, 2003, 07:54 PM
#2
PowerPoster
Yes, Windows generally takes care of this. You can control it somewhat by setting thread priorities and what not, but for the most part, Windows will handle it for you. Definately thread out long running processes. It just makes sense.
-
Nov 17th, 2003, 09:49 AM
#3
You can also call into the API (doesn't know if it's available in the .Net Framework) to set a preferred CPU for a thread. I can't see where this would be very useful though.
Developing for multi-CPU systems means making all your code extra thread-safe. It also means that you think hard about what code could run concurrently with other code and split those into separate threads so that they actually CAN run concurrently.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Nov 17th, 2003, 10:25 AM
#4
The .Net framework has some very sexy threading capability that will let you identify and eliminate potentially racing threads, dormant threads etc... Funky.
Managed C++, yeah!
I don't live here any more.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|