Cowboy (Gregory A. Beamer) said:
Great addition. My two cents.
In general, multi-threading is done for architectural reasons, not
performance. I know there are instances where you do it solely for
performance, but that can lead to serious problems if designed
incorrectly. Of course, bad multi-threaded design is dangerous, no matter
how you slice it.
You generally do it, at least today, to run in parallel rather than serial
(or allow a user to continue working while a long running process runs on
another thread,k aka run in parallel). This is changing a bit now, but
also leading to some really bad applications.
Please note that I do not consider allowing a second process to run while
a long running process has its thread locked down a performance gain,
although that is one of its symptoms.
Performance is overrated. It is too often made the primary concern when it
should not be.
--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA
Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss
*************************************************
| Think outside the box! |
*************************************************
Thanks all who have responded thus far, the comments have been great...
One reason I would use multiple threads in an application is ANY time an app
I'm writing is downloading something off a slower than intranet speeds
(anything off the Internet or off an extranet). Also, anytime my
application would otherwise *hang* for even a brief period of time (ie:
looping or writing to disk), I would separate that logic into another thread
and then display a message stating what the thread is doing, or allow the
user to continue working, if appropriate. It all depends on the situation.
Now, is there anyway for the programmer to actually *take advantage* of a
multiple processor/core configuration and actually do some lower level
development to ensure the application runs specific parts on a dedicated
processor/core (all it's threads run in the same core/processor) while the
rest of the application (ie: GUI) runs on one of the others? I can see
using something like this for games or even advanced imaging/video/sound
software where processing power may be important to physics (imaging/video)
software, or dynamic realistic sound generation for 3-D environments (or
anything else NASA wants). Having a physics processor would help with that,
but if all I have is something like a QUAD-CORE processor, I'd like to run
some threads on a dedicated core that the O.S. would not use for other
things (lock it down temporarily for my own use)...
I could see some bad side effects of doing this (what if the machine has
only a single-processor with a single-core?). But all in all, can .Net, or
ANY OTHER programming framework do this?
Once again, this is all hypothetical for me. Just some questions and
thoughts that I've had regarding multiple-processors and, more accurately,
multiple-core processors.
Thanks,
Mythran