tags:

views:

114

answers:

2

Hi,

What is better approach threading or asynchronous programming.

I have read both especially in database operations we can use both of this approaches.

Is my understanding is correct?

please give some guidelines?wat all scenarios we ca use threading and waht all scenarios asynchronous programming is good?

Thanks SC

+2  A: 

Threading and asynchronous programming are essentially the same thing. Threading is the engine which makes asynchronous programming possible.

Use it in situations where you need to start a background task, so that the user can move on to other things instead of having to wait for your task to complete.

Joseph Albahari's tutorial on threading in C# is a good place to start learning.

Robert Harvey
A: 

If you need substantial scalability with small hardware resources, the async model excels, but at the expense of complexity. If you don't need to scale, then focusing on blocking I/O with threads might meet your needs. The notion of scalability varies widely. This can quickly become a rather deep subject that needs research based on what you want to achieve. Some basics on async IO can be found here. Do you need to service thousands of network requests simultaneously with a single server? If so, async I/O might be what you need. You mention database operations...in general, most DB implementations will not give you an async option. Given your vague question, I don't think there a specific answer. As with just about everything...it depends.

Todd Stout