Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multi threading or Asychronous Programming ?

Status
Not open for further replies.

gazza65

Programmer
Mar 19, 2003
12
GB
Hi all

A general question to all you designers and architects out there because I've just realized I don't really have a good answer to this question. What and when is the best situation to employ asychronous programming instead of multi threaded programming and visa versa? What is the pseudo checklist I should be employing to distingush between the both of them.

The reason I ask is because I'm sure the use of multi threaded programming is a sledge hammer to crack a nut, where instead the use of asychronous programming would be a better (less complicated from a maintainance point of view) option.

Does anybody have any thoughts on the matter they want to share with the community?
 
I guess it matters on what you are doing. Multi-threading isn't necesarily a 'nuclear' option. Even simple things like performing a data fill at the click of a button can/should be multithreaded to get the process off of the primary thread.

I'm not sure about Asych programming as I've only heard it in reference to remoting which I have a zero experience.

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
Umm, asynchronous programming is using threads from the system threadpool behind the scenes. So you're really doing multi-threading anyway, just it's much easier to do. Of course, you give up control over thread creation/disposal, but maybe that's OK.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Chip H

You've almost hit the nail on the head. If asych programming is tha much easier, why go through the pain of direct control of the thread ? So I go back to my original question as to determining when its programmatically best practice to use one method over the other. Is there some generic design best practice to refer to, in just the same way as there is to help determine when to use Web Services over .NET remoting etc.

gazza65
 
There's no real cookbook answer to that -- it's a tradeoff between program complexity and the time in which you have available to create a solution. Oh, and money, of course.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top